Automatic Diagnostic Repository (ADR)
2 min readADRCI is a command-line tool that is part of the fault diagnosability infrastructure introduced in Oracle Database 11g. ADRCI enables you to:
View diagnostic data within the Automatic Diagnostic Repository (ADR) View Health Monitor reports.
Diagnostic data includes incident and problem descriptions, trace files, dumps, health monitor reports, alert log entries, and more.
ShortPolicy and LongPolicy Settings
- LONGP_POLICY (long term) is set to 365 days by default. It is responsible for Incidents and Health Monitor warnings. - SHORTP_POLICY (short term) is set to 30 days by default. It manages the trace and core dump files.
Check Current Settings
select SHORTP_POLICY,LONGP_POLICY,LAST_AUTOPRG_TIME,LAST_MANUPRG_TIME from ADR_CONTROL;
Set Policy
The policies can be set to the desired value using commands, set control (SHORTP_POLICY = 168) – For 7 Days Retention set control (LONGP_POLICY = 1440) – For 60 Days
1. Get current base location:( Also known as ADR_BASE)
[oracle@dg11 ~]$ adrci
ADRCI: Release 19.0.0.0.0 - Production on Tue Sep 20 23:49:56 2022
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
ADR base = "/u01/app/oracle"
adrci> show base
ADR base is "/u01/app/oracle"
adrci>
2. Set new ORACLE_BASE(ADR_BASE)
adrci> set base /u01/app/oracle
3. List current ORACLE_HOME
adrci> show homes
ADR Homes:
diag/rdbms/orcl/orcl
diag/rdbms/prod/prod
diag/rdbms/p101/P1011
diag/tnslsnr/dg11/listener
4. View alert log
adrci> show alert
Choose the home from which to view the alert log:
1: diag/rdbms/orcl/orcl
2: diag/rdbms/prod/prod
3: diag/rdbms/p101/P1011
4: diag/clients/user_oracle/host_3154652517_110
5: diag/tnslsnr/dg11/listener
Q: to quit
Please select option: 1
5. Purge alerts and trace files
-- This will purge data older than 600 minutes. adrci> purge -age 600 -type ALERT adrci> purge -age 600 -type TRACE adrci> purge -age 600 -type incident adrci> purge -age 10080 -type cdump
ADRCI Purge Script
#!/bin/ksh -x export ORACLE_HOME=/opt/app/oracle/product/19.0.0/dbhome_1 export PATH=$PATH:$ORACLE_HOME/bin for f in $( adrci exec="show homes" | grep -v "ADR Homes:" ); do echo "Purging ${f}:"; adrci exec="set home $f; purge ;" done
Schedule In Crontab
ADRCI PURGE
50 3 * * * /u01/app/scripts/adrci_purge.sh > /u01/app/scr_log/file_cleanup.log 2>&1