The Automatic Diagnostics Repository (ADR) is simply the file structure under /u01/app/oracle/diag.
Using the ADRCI tool it is possible to query the files. Some examples are provided on this page...
To tail the last 10 lines of the current alert log...
adrci exec="set homepath diag/rdbms/$(echo $ORACLE_SID | tr '[:upper:]' '[:lower:]')/$ORACLE_SID;show alert -tail"
To tail the last 50 lines of the current alert log...
adrci exec="set homepath diag/rdbms/$(echo $ORACLE_SID | tr '[:upper:]' '[:lower:]')/$ORACLE_SID;show alert -tail 50"
To tail the last 10 lines of the current alert log and show more lines as they arrive...
adrci exec="set homepath diag/rdbms/$(echo $ORACLE_SID | tr '[:upper:]' '[:lower:]')/$ORACLE_SID;show alert -tail -F"
To show an entry at a specific timestamp...
adrci
show alert -term -p "ORIGINATING_TIMESTAMP = '2021-07-16 09:55:37.840343 -01:00'"
To show all entries between specific timestamps...
adrci
show alert -term -p "ORIGINATING_TIMESTAMP > '2021-07-16 09:55:00.000000 -01:00' AND ORIGINATING_TIMESTAMP < '2021-07-16 09:58:00.000000 -01:00'
Using current alert.log
adrci
show alert -p "originating_timestamp > systimestamp-1 and message_group like '%ddl%'" -term
Using older alert.log
echo show alert -p "message_group like '%ddl%'" -term -file /u01/app/oracle/diag/rdbms/$(echo $ORACLE_SID | tr '[:upper:]' '[:lower:]')/${ORACLE_SID}/alert/log.xml.2018-09-15_23:59
adrci
cut and paste the output from the command aboveShutdown...
adrci exec=show alert -p "originating_timestamp > systimestamp-1 and message_group like '%ddl%'" -term | \
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=1 a=0 s="^ALTER DATABASE CLOSE"
Startup...
adrci exec=show alert -p "originating_timestamp > systimestamp-1 and message_group like '%ddl%'" -term | \
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=1 a=0 s="^Completed: ALTER DATABASE OPEN"
This script show all TNS errors complete with failed connection information...
adrci exec=show alert -p "message_text like '%TNS-%' or message_text like '% * 1%'" -file /u01/app/oracle/diag/tnslsnr/$(hostname -s)/${LISTENER_NAME}/alert/log.xml -term
To check Autopurge settings use...
adrci
select SHORTP_POLICY,LONGP_POLICY,LAST_AUTOPRG_TIME,LAST_MANUPRG_TIME from ADR_CONTROL;
adrci
show home
set homepath /my/home
show problem
show incident -p "problem_key='ORA 1578'"
show incident -p "problem_key='ORA 1578'" -all
ips pack incident 99999 in /tmp
Other usage for ips...
ips pack problem 999 in /tmp
ips pack problemkey "ORA 1578" in /tmp
ips pack seconds 8 in /tmp
ips pack time '2021-07-01 10:00:00.00' to '2021-07-01 23:00:00.00'
Launch adrci
Show list of locations that may contain log files
Set preferred location
Show Problems
Show Incidents related to the Problem Key
Show all Incidents related to the Problem Key
Create a zipfile of all relevant log files
Pack at problem level
Pack at problem level based on key
Pack incidents occurring in next 8 seconds
Pack incidents occurring between timestamps