You are on page 1of 8

Apagar tablespace

(com dados)
SQL> drop tablespace TBS_DEST_D including contents;
Tablespace dropped.
(sem dados)
SQL> drop tablespace TBSPYDTMP02;
Tablespace dropped.

tnsnames.ora
$ORACLE_HOME/920_64/network/admin
alertSID.ora
/oracle/SID/rdbms/log/alert_SID.log
/oracle/SID/saptrace/background/alert_SID.log
listener
lsnrctl status
CHECK IF BACKUP IS ACTIVE
SQL> select distinct (status) from v$backup;
The response of above query should be 'NOT ACTIVE' which means database in NOT i
n backup mode.
On the other hand if database is in backup mode then the response will be 'ACTIV
E'. In that case
(if response is ACTIVE then either EDS will have to stop backup or wait for it t
o complete).
SQL> select distinct (status) from v$backup;
STATUS
-----------------NOT ACTIVE
----------------------------------------------------------------------------------------------------------------------VER ORACLE TRACE
tkprof pl1_ora_26515.trc trace_reorg_08072007.txt explain=yes sys=no
----------------------------------------------------------------------------------------------------------------------AUTO EXTEND OFF
1 DB02, clique na tablespace, (boto) data files / temp files
2 SQL> alter database datafile '/oracle/BWQ/sapdata1/bwdusr_1/bwdusr.data1' AUTOE

XTEND OFF;
Database altered.
----------------------------------------------------------------------------------------------------------------------DESBLOQUEAR USURIO SAP
(exemplo, se retornar 128 est bloqueado)
SQL> select uflag from sapbwq.usr02 where bname='DDIC' AND mandt='001';
select uflag from sapr3.usr02 where bname='MZ6734' AND mandt='100';
UFLAG
---------128
SQL> update sapr3.usr02 set uflag=('0') where mandt=('000') and bname=('DDIC');
mudar senha
update sapr3.usr02 set BCODE='27338240A978D161' where BNAME='DDIC'; (basis017)
----------------------------------------------------------------------------------------------------------------------ERROS ORA
plgmlaod:oraprd 22> oerr ora 01555
01555, 00000, "snapshot too old: rollback segment number %s with name \"%s\" too
small"
// *Cause: rollback records needed by a reader for consistent read are
//
overwritten by other writers
// *Action: If in Automatic Undo Management mode, increase undo_retention
//
setting. Otherwise, use larger rollback segments
----------------------------------------------------------------------------------------------------------------------LIMPAR SAPREORG
cd /oracle/<SID>/sapreorg
find . -name "cntrl.*" -atime +30 -exec ls -al {} \; # verify the dates, if sati
sfied then proceed
find . -name "cntrl.*" -atime +5 -exec rm {} \;
find . -name ".trc*" -mtime +3 -exec rm {} \;
find . -name "cntrl.*" -atime +50 -exec ls -ltr {} \;
----------------------------------------------------------------------------------------------------------------------SAPDBA
sapdba -u system/password (utiliza user system p/ entrar)
sapdba -u / (utiliza OPS$ - oraSID)
### criar data file ###
C - A - F - C 2m - B - S

### resize ###


D - H - A - S
### verificar quais tablespaces nao tem 5 extents ###
C - D - 5
----------------------------------------------------------------------------------------------------------------------IMPORTAR / EXPORTAR TABELA
>> (fora do sqlplus com oraSID) (fazer 3 exports em 3 lugares diferentes)
exp system/pw_apr07 file=RFCDES.dmp tables=sapr3.RFCDES direct=y consistent=y
imp system/pw_apr07 file=RFCDES.dmp fromuser=sapr3 touser=sapr3 ignore=y
----------------------------------------------------------------------------------------------------------------------VER / APLICAR ARCHIVES
(no sqlplus)
archive log list
recover database using backup controlfile (aplica se estiver no dir. saparch)
----------------------------------------------------------------------------------------------------------------------VARIOS
/oracle/SID/saptrace/usertrace (logs dos jobs)
!comando - executa comando do OS dentro do sqlplus
spool arquivo.txt / spool off - cria um arquivo pra enviar os logs do scripts
set lines 200
sqplus "/as sysdba"
versao do oracle - select * from v$version
initSID.ora - /oracle/PL1/920_64/dbs/initPL1.ora
----------------------------------------------------------------------------------------------------------------------shared memory - shared_pool_size (deve ser aumentado e reiniciado o banco)
shared_pool_reserved_size (deve ter 5% do tamanho do shared_pool
_size)
ex.
SQL> select name, value from v$parameter where name in ('shared_pool_size', 'sha
red_pool_reserved_size');
NAME
---------------------------------------------------------------VALUE
--------------------------------------------------------------------------------

shared_pool_size
2097152000
shared_pool_reserved_size
104857600
----------------------------------------------------------------------------------------------------------------------> Recuperar senha SAP*
delete from sapr3.usr02 where mandt=000 and bname='SAP*';
(verificar ser o parametro login/no_automatic_user_sapstar esta = 0)
delete from sapbwq.usr02 where mandt=xxx and bname='SAP*';
Obs. se no existir sapr3, dar um select * from all_users;
ver o schema, ex: SAPBWQ
----------------------------------------------------------------------------------------------------------------------> Alterar o MaxExtents de alguma tabela, verificar comando abaixo:
(sqlplus)
SQL> alter table SAPR3."YSIIMM24" storage (maxextents 350);
Table altered.
++++++ ou ++++++
alter TABLE SAPR3."YBACKLOG" storage (maxextents unlimited);
ou
alter INDEX SAPR3."YREV_4S~Z01" storage (maxextents unlimited);
alter INDEX SAPR3."YSIISD117~0" storage (maxextents 500);
Statement processed.
OBS.: Quando for tabela, colocar alter TABLE / quando for index colocar index e
colocar entre " "
- no caso de ROLBACK
alter rollback segment PRS_29 storage(maxextents UNLIMITED);
> Alterar o maxextents de uma TABLESPACE
alter TABLESPACE PSAPBTABD storage (maxextents unlimited);
----------------------------------------------------------------------------------------------------------------------> Alterar o tamanho do Next extent de alguma tabela, verificar comando abaixo:
SQL> alter table sapr3."ZSYTGL_ABKPF" storage (next 51200K);
ou alter index... ~0
Table altered.
--------------------------------------------------------------------------------

---------------------------------------ANALYSE
-verifica o ultimo analyze nas tabelas
col table_name
form a30
col last_analyzed form a20
col num_rows
form 999,999,999
col sample_size form 999,999,999
col "%"
form 999.99
select
table_Name,
num_rows,
to_char(last_analyzed,'DD/MM/YYYY HH24:MI:SS') LAST_ANALYZED,
sample_size,
round((sample_size/num_rows)*100,2) "%"
from
dba_tables
where sample_size >0
and owner='SAPR3'
order by 5 desc
/

sqlplus "/as sysdba"


SQL> select table_name, last_analyzed, sample_size
from dba_tables
where table_name = 'ZCBTS_FLUXO_STAT';
=> where table_name in ('XXXX' , 'dddd'); - pra varias tabelas
### TABLE_NAME
LAST_ANAL SAMPLE_SIZ
### ------------------------------ --------- ---------### ZCBTS_FLUXO_STAT
15-DEC-04
2942045

1 select table_name, to_char(last_analyzed, 'DD/MM/YYYY HH24:MI:SS') from dba


_tables
2 where table_name='LQUA'
3* and owner='SAPR3'
SQL> /
TABLE_NAME
TO_CHAR(LAST_ANALYZ
------------------------------ ------------------LQUA
21/03/2007 00:04:20

1
2
3*
SQL>

select table_name, last_analyzed from dba_tables


where table_name='LQUA'
and owner='SAPR3'
/

TABLE_NAME

LAST_ANAL

------------------------------ --------LQUA
21-MAR-07

SQL> ANALYZE INDEX ZCBTS_FLUXO_STATEN COMPUTE STATISTICS;


### Index analyzed.
----------------------------------------------------------------------------------------------------------------------> startup em modo standby para o DRP
- Logar no servidor com o usurio ora<sid>;
- Acessar o svrmgrl;
- Executar o comando "connect internal"
- Executar o comando "startup nomount;"
- Executar o comando "alter database mount standby database;"
- Sair do svrmgrl;
- Solicitar operao que os jobs sejam liberados para continuar a
sincronizao.
----------------------------------------------------------------------------------------------------------------------> Ver se est no ar
svrmgrl
connect internal
show sga
(dever retornar dados com abaixo)
SVRMGR> show sga
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers

17393964004
103396
2662400000
14730395648
1064960

bytes
bytes
bytes
bytes
bytes

----------------------------------------------------------------------------------------------------------------------> dropar tabela (apagar tabela)


sqlplus /nolog
SQL> connect sapsem/sap
(user/senha)
drop table "/BIC/PMEAS00";
SQL> select count(*) from "/BIC/AOD_EXPDD00";
procurar
----------------------------------------------------------------------------------------------------------------------#Verificar se user system esta locado
select username,account_status,lock_date,expiry_date,profile
from dba_users
where username='SYSTEM';

#desbloquear
alter user system account unlock;
#Alterar senha do SYSTEM
alter user system identified by <newpassword>;
(para testar) connect system/<newpassword>;
#alterar senha com brconnect
brconnect -u system/pw4_may07 -f chpass -o system -p pw6_may07
----------------------------------------------------------------------------------------------------------------------REFRESH / HSC
# localizar controlfile
select name from v$controlfile
# re-criar controlfile
alter database backup controlfile to trace;
No diretrio /oracle/SID/saptrace/usertrace ter um arquivo .TRC
TRUNCATE
truncate table sapr3.DBSTAIHORA;
truncate table sapr3."/MIC/HEADER"; (ENTRE ASPAS QND TEM BARRA)
----------------------------------------------------------------------------------------------------------------------CLCULO DO TAMANHO DA PSAPUNDO
SQL> show parameter undo_retention
NAME
TYPE
VALUE
------------------------------------ ----------- -----------------------------undo_retention
integer
21600
SQL> select count(*), sum(undoblks)/(3600)
2 from v$undostat
3 where begin_time > sysdate - 1/24;
COUNT(*) SUM(UNDOBLKS)/(3600)
---------- -------------------6
16.9588889
SQL> show parameter db_block_size
NAME
TYPE
VALUE
------------------------------------ ----------- -----------------------------db_block_size
integer
8192
21600 * 17 * 8192 * 1,1 = 3,0 GB (deve ser o tamanho mnimo)
Current: PSAPUNDO
46.137.312 kb
----------------------------------------------------------------------------------------------------------------------SELECT TAMANHO DAS TABELAS
SQL> select segment_name, bytes/1024 as kbytes from dba_segments where owner='SA

PR3' and segment_name in ('BKPF','BSAD','BSAK','BSID','BSIK','EKBE','EKET','EKKO


','EKPO','KNA1','KNB1','LFA1','LFB1','MAKT','MARA','PAYR','RBKP','REGUH','RSEG',
'SKA1','SKAT','T001','T007A','T042Z','T052','TVZBT','T003T','T007S','TBSLT','BSE
T','REGUP');
SQL> col segment_name for a10

You might also like