Monday, February 21, 2011

Viewing ASM trace files and alert logs in Unix/Linux

ASM trace files begin with the "+" prefix.  On Unix/Linux I normally view database trace files using the more/less or vi/vim/view commands.  These commands and their variants however accept the "+" command as an option. Run 'man' on any of the commands to see what the "+" option does. Trying to use either of these commands may leave you a bit bewildered at first.

[grid@oelgrid01 trace]$ more +ASM1_ora_15496.trc
usage: more [-dflpcsu] [+linenum | +/pattern] name1 name2 ...
 
[grid@oelgrid01 trace]$ less +ASM1_ora_15496.trc 
Missing filename ("less --help" for help)
You have several other options to viewing these trace files.  Of course, you could do a tail/head against the file e.g tail -50 +ASM_filename.trc.  But if the file was pretty big you would probably want to traverse back and forth.  For a small tracefile whose standard output fits on the screen you could just issue either of the following commands:
cat +ASM_filename.trc
cat +ASM_filename.trc | more
A more elaborate way of doing this using the find command:

find . -name '+ASM_filename.trc' -exec vi {} \;

Oracle 11g also provides a utility to help gather, report and view alert logs and list tracefiles.  ADR Command Interpreter (ADRCI) makes this possible.  Typing adrci at the shell prompt takes you into the adrci command-line interface.  ADRCI commands can also be executed in batch mode. Set your ORACLE_HOME and PATH environment variables before executing the adrci commands.

[grid@oelgrid01 trace]$ adrci
ADRCI: Release 11.2.0.2.0 - Production on Mon Feb 21 21:18:27 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
ADR base = "/u01/app/grid"
adrci> 
To view the alert log use the SHOW ALERT command:
adrci> show alert
ADR Home = /u01/app/grid/diag/asm/+asm/+ASM1:
*************************************************************************
Output the results to file: /tmp/alert_7917_14049_+ASM1_1.ado
2011-01-23 19:24:21.550000 -06:00
* instance_number obtained from CSS = 1, checking for the existence of node 0...
* node 0 does not exist. instance_number = 1
Starting ORACLE instance (normal)
2011-01-23 19:24:23.695000 -06:00
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
You can also tail the alert log 
adrci> show alert -tail
To view a l ist of tracefiles use the SHOW TRACEFILE command:
adrci> show tracefile
     diag/asm/+asm/+ASM1/trace/+ASM1_gcr0_4631.trc
     diag/asm/+asm/+ASM1/trace/+ASM1_ora_4030.trc
     diag/asm/+asm/+ASM1/trace/+ASM1_lmd0_4102.trc
     diag/asm/+asm/+ASM1/trace/+ASM1_dia0_4098.trc
     diag/asm/+asm/+ASM1/trace/+ASM1_lmon_4100.trc
     diag/asm/+asm/+ASM1/trace/+ASM1_lmhb_4108.trc
     diag/asm/+asm/+ASM1/trace/+ASM1_ora_4136.trc
     diag/asm/+asm/+ASM1/trace/alert_+ASM1.log
     diag/asm/+asm/+ASM1/trace/+ASM1_rbal_4120.trc
Note however that unlike the SHOW ALERT command this does not show the contents of the tracefile and you may want to resort to one of the methods I indicated before.

ADRCI has many more options available and is worthy of its own blog post. 

1 comment:

  1. you can user »--«,it marks the end of option arguments.

    less -- +ASM1_ora_15496.trc

    works fine
    andreas

    ReplyDelete

IOUG Collaborate 14

IOUG Collaborate 14
IOUG Collaborate 14 Las Vegas