ADR
Automatic Diagnostics Repository
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...
SHOW ALERT
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'
Startup/Shutdown times
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 aboveUsing nawk to simplify output
Shutdown...
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"
Startup/Shutodown Shell script
Querying the Listener Log
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
Example Output
Purge
To check Autopurge settings use...
adrci
select SHORTP_POLICY,LONGP_POLICY,LAST_AUTOPRG_TIME,LAST_MANUPRG_TIME from ADR_CONTROL;
Incident Packaging Service (IPS)
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
Bibliography
12.1 - Oracle Database Net Services Reference - ADR Diagnostic Parameters in sqlnet.ora
12.1 Database Utilitieshttps://docs.oracle.com/database/121/SUTIL/GUID-8D62D6A0-99F4-465C-B088-5CCF259B7D80.htm#SUTIL1519https://docs.oracle.com/database/121/SUTIL/GUID-AA8EA548-8756-4A18-9F93-4F2C27FFD81D.htm#SUTIL1472
My Oracle Support (https://support.oracle.com)DIA-48448 Is Raised When Executing PURGE command in ADRCI Utility (Doc ID 951023.1)ADR Different Methods to Create IPS Package (Doc ID 411.1)How To Filter ADRCI 'Show Alert' Output By Date and Time (Doc ID 1221773.1)Database 11g / 12c: Quick Steps to Package and Send Critical Error Diagnostic Information to Support (Doc ID 443529.1)Understanding Automatic Diagnostic Repository (Doc ID 422893.1)ADR Different Methods to Create IPS Package (Doc ID 738732.1) - deprecated - use 411.1 instead
Otherhttps://oracle-base.com/articles/11g/automatic-diagnostics-repository-11gr1 https://www.morganslibrary.org/reference/adr.html https://uhesse.com/2011/06/01/adrci-a-survival-guide-for-the-dba/ https://askdba.org/weblog/oracle11g/adrci/https://stepintooracledba.blogspot.com/2014/05/adrci-command-ouput-is-not-fully.html