ADRCI and listener purging

I won’t go into any details on ADRCI as others have already done a better job than I could. The key piece of information for this post is that the MMON process shoulders the responsibility for ADR purging. So what if there isn’t an MMON process?

Note: All ADRCI “show control” output on this page has been edited for readability

Below is the ADR purge details for my local listener. These settings were defined using “set control (SHORTP_POLICY = 168,LONGP_POLICY = 336)”. “168″ = 7 days and “336″ = 14 days.

adrci
set home diag/tnslsnr/n01/listener
show control

ADRID      SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME              LAST_AUTOPRG_TIME LAST_MANUPRG_TIME
---------- ------------- ------------ -------------------------- ----------------- ----------------------------
1794992421 168           336          2012-01-25 20:41:09.052526

adrci> host
$ date

Thu Feb 16 21:26:16 GMT 2012

$ cd  /u01/app/oracle/diag/tnslsnr/n01/listener/alert
$ ls -ltr

total 30260
-rw-r----- 1 grid oinstall 10485934 Jan 25 03:45 log_1.xml
-rw-r----- 1 grid oinstall 10485779 Feb  4 03:11 log_2.xml
-rw-r----- 1 grid oinstall  9954308 Feb 16 21:43 log.xml

Notice that the “LAST_AUTOPRG_TIME” column is blank. It looks like this system is not being purged automatically. Also notice that the date of this test was Feb 16th and the oldest file in the “alert” directory is dated “Jan 25″. According to M.O.S note “Which Files Are Part Of SHORTP_POLICY And LONGP_POLICY In ADR? [ID 975448.1]” the “alert” directory is under LONGP_POLICY which is 14 days so the file “log_1.xml” should have been purged.

Below I force a manual purge

adrci> purge
adrci> host

$ cd  /u01/app/oracle/diag/tnslsnr/n01/listener/alert
$ ls -ltr

total 20004
-rw-r----- 1 grid oinstall 10485779 Feb  4 03:11 log_2.xml
-rw-r----- 1 grid oinstall  9960304 Feb 16 21:53 log.xml

It has now gone. And LAST_MANUPRG_TIME has been set to record the fact.

ADRID      SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME              LAST_AUTOPRG_TIME LAST_MANUPRG_TIME
---------- ------------- ------------ -------------------------- ----------------- --------------------------
1794992421 168           336          2012-01-25 20:41:09.052526                   2012-02-16 21:53:51.761639

So my recommendation is that alongside ADR’s auto purging and your own maintenance on the alert.log & listener.log files in the “trace” directories you should also routinely call something like below:

for i in `adrci exec="show homes"|grep listener`;do
 echo "adrci exec=\"set home $i;purge\""
 adrci exec="set home $i;purge";
 # maybe check $? here
done

I noticed this M.O.S note recently too. I’ve never seen the symptoms but it’s worth taking a look.

ADR Auto Purge Does Not Work On All RAC Instances, ASM and Standby Databases [ID 1326983.1]

About these ads

4 thoughts on “ADRCI and listener purging

  1. Hi Neil, Thanks for your article. As your header is listener purging ( You mentioned alert directory but didn’t trace directory) therefore I would like to add below:
    LISTENER LOGS:
    cd /usr/app/oracle/diag/tnslsnr/jdcijisprod/listener
    $adrci
    ADRCI: Release 11.1.0.7.0 – Production on Wed Oct 24 08:46:37 2012
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    ADR base = “/usr/app/oracle”
    adrci> show control
    adrci> show homepath
    ADR Homes:
    diag/tnslsnr/jdcijisprod/listener
    adrci>purge
    Note: this reduces logs_*.xml from alert directory;

    For Trace directory: /usr/app/oracle/diag/tnslsnr/jdcijisprod/listener/trace
    There is a big listener.log on trace directory

    So what I did very basic mv current logfile and system creates a new one.

    We can also use :
    lsnrctl set log_status off
    rm listener.log
    lsnrctl set log_status on

    Cheers
    Monowar

  2. Hi Monowar,
    Thanks for your comments. I think we agree.

    My reference to “your own maintenance on the alert.log & listener.log files” was referring to the fact that they are not auto purged. As an aside at 11g you don’t need to set log_status off/on to move the file as the listener opens and closes the log each time, I covered this in the article below:

    http://oraganism.wordpress.com/2011/06/21/interesting-change-in-database-listener-behaviour-at-11g/

    Also my recommendation to purge the listener ADR homes in the shell script example is similar to your example.
    Neil

  3. With an MMON process running I was caught out by the auto purge. I had a test database where I would have liked to have pruned the listener logs every 2 days. I could set my LONGP_POLICY to 2 days easily enough but unfortunately the auto purge only kicks in either 12 hours following a database restart otherwise every 7 days and this can’t be changed.

    • Hi Paul,
      That’s interesting. So are you saying that a database auto purge purged the listener log? As far as I know the auto purge will only purge the ADR home for that database instance and for listeners you need to set up a job yourself using adrci as suggested at the end of the above post.
      I did once ask someone in Oracle Support if listener auto purging is planned for a future release and he looked at me like I was suggesting the sky is falling down. I take that to mean it’s not planned :-)
      Cheers
      Neil

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s