http://gavinsoorma.com/2010/09/purging-trace-and-dump-files-with-11g-adrci/
Purging Oracle Database's Alert Log with ADRCI Utility
http://appsjagan.blogspot.tw/2011/04/purging-oracle-databases-alert-log-with.html
修改trace file retention policy :
adrci> show homes
ADR Homes:
diag/asm/+asm/+ASM1
diag/tnslsnr/db01-adm/listener
diag/rdbms/orcl/orcl1
adrci> set homes diag/rdbms/orcl/orcl1
adrci> show control
ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl2:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
3508701005 720 8760 2013-01-26 20:36:28.062391 +08:00 1 2 80 1 2013-01-26 20:36:28.062391 +08:00
1 rows fetched
以上可看到trace 保留時間預設 LONG_POLICY 為8760 hr(365天)
adrci>
adrci> set control (LONGP_POLICY = 2160) ==> 改為保留三個月
adrci> show control
ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl1:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
1790499833 720 2160 2013-01-27 11:48:58.565650 +08:00 1 2 80 1 2013-01-26 20:16:31.849483 +08:00
1 rows fetched
其他purge 指令 (可寫在shell scripts 裡面)
#/usr/bin/bash
$file_line="$Your_Adrci_Home"
#purging ALERT older than 90 days
$ORACLE_HOME/bin/adrci exec="set homepath $file_line;purge -age 129600 -type ALERT"
#purging INCIDENT older than 30 days
$ORACLE_HOME/bin/adrci exec="set homepath $file_line;purge -age 43200 -type INCIDENT"
#purging TRACE older than 30 days
$ORACLE_HOME/bin/adrci exec="set homepath $file_line;purge -age 43200 -type TRACE"
#purging CDUMP older than 30 days
$ORACLE_HOME/bin/adrci exec="set homepath $file_line;purge -age 43200 -type CDUMP"
#purging Health Monitor older than 30 days
$ORACLE_HOME/bin/adrci exec="set homepath $file_line;purge -age 43200 -type HM"
沒有留言:
張貼留言