Experience: is what you get soon after you need it.

Experience: is what you get soon after you need it.

Rasul Allah (sal Allahu alaihi wa sallam) said: "Restore the trusts of those who trust you, and deal not falsely with him who deals falsely with you." [Abu Dawud, Tirmidhi]

Search This Blog

Monday, January 14, 2013

Oracle 11g Remove trace files automatically using adcri


Oracle Automatic trace files cleanup:

In 11g we can clean/remove the trace files automatically using adrci.


adrci> help purge


Diagnostic data Purging in ADR is controlled by two attributes:
- SHORTP_POLICY which is used for automatically purging short-lived files, i.e. dump files, expressed in hours and defaults to 30 days.
- LONGP_POLICY which is used for automatically purging long-lived files, i.e. incidents, expressed in hours and defaults to 1 year.

     
adrci> show home

adrci> show home
ADR Homes:
diag/rdbms/DB1/DB11
diag/rdbms/DB3/DB31
diag/rdbms/qa/QA1
diag/rdbms/prd/DB11
diag/rdbms/DB2/DB21


Pick the home

adrci> set home diag/rdbms/DB1/DB11

adrci> show control

ADR Home = /icm01/u0001/app/diag/rdbms/DB1/DB11:
*************************************************************************
ADRID                SHORTP_POLICY        LONGP_POLICY         LAST_MOD_TIME                            LAST_AUTOPRG_TIME                        LAST_MANUPRG_TIME                        ADRDIR_VERSION       ADRSCHM_VERSION      ADRSCHMV_SUMMARY     ADRALERT_VERSION     CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
1182197510           720                  8760                 2011-12-12 21:30:04.349541 -05:00      


To set the purging policy to 7 days:

adrci> set control (SHORTP_POLICY=168)
adrci> set control (LONGP_POLICY=168)

adrci> show control

ADR Home = /icm01/u0001/app/diag/rdbms/DB1/DB11:
*************************************************************************
ADRID                SHORTP_POLICY        LONGP_POLICY         LAST_MOD_TIME                            LAST_AUTOPRG_TIME                        LAST_MANUPRG_TIME                        ADRDIR_VERSION       ADRSCHM_VERSION      ADRSCHMV_SUMMARY     ADRALERT_VERSION     CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
1182197510           168                  168                  2013-01-14 11:21:51.600312 -05:00      

To Manually purge all trace files older than 1 day (1440 mins):
Including core files: cdmp*

adrci> purge -age 1440



To purge core files older than 6 days
 
adrci> purge -age 8640 -type CDUMP


It might be needed to also run the following additional command:

 
adrci> purge -age 8640 -type UTSCDMP



-> to remove sub-folders >6 days-old having a name like "CDMP_" from TRACE.

Purge XML based Alert log file:

adrci> purge -age 60 -type ALERT

do not clean up the Text-formatted alert.log file.

The ADRCI interface is only supposed to modify the XML-formatted alert file, not the Text-formatted alert file,

5 comments:

ranjith said...

Hi Sameer bhai,
hope you are doing well.
how to purge controlfile autobackups when they are created in ASM directory "+ORAFRA".please let me know the steps to follow..


thanks in advance...

naga said...

hello sameer,
need a help.. i have uninstalled oracle11g by deleting from regedit and deleted app folder but there are some errors while deleting the app folder, trace folder is not deleting.. sowing error message like folder is not empty

sameer said...

See if any oracle process is running and kill that process then delete tbe fold

Rashida Bastwala said...

How to purge the alert log xml file automatically periodically

Ganesh Singh said...

Hi,

Is there anyway we can disable the xml alter log file...as it is generating very fast in our environment.