Overview: Using adrci tool to remove oracle monitor alarm logs, monitoring of routine maintenance log is possible warning of large disk space needs to be cleaned.
ADRCI role
Diagnostic data in ADR to view Oracle Support diagnostic information includes: Incident, problem, the trace Files, dumps, etc. Health Monitor Reports
Recently discovered a listening alarm log directory oracle alert log is very large (log.xml log [0-9] .xml file) reached about 7G, monitor log log.xml log [0-9] .xml file in the log put $ ORACLE_BASE / diag / tnslsnr / machine name / listener / alert directory
1, the user switch to the oracle.
# SU - oracle
2, adrci (you run the command)
$ adrci ADRCI: Release 11.2.0.4.0 - Production on Thu Jul 18 13:46:19 2019 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. ADR base = "/u01/app/oracle" adrci>
3, use the command ADRCI first need to set Homepath
View control, otherwise some will report the following error ADRCI> SHOW CONTROL DIA-48 448: This does not the Command Support Multiple ADR Homes ADRCI> Show Homes --- if not we want the directory, you can specify the set homepath diag / tnslsnr / 2018 / listener Homes ADR: diag / the RDBMS / the Test / the Test diag / tnslsnr / hostname / listener ADRCI> the SET HOMEPATH diag / tnslsnr / hostname / listener
4, clear the log
adrci> help purge --查看purge帮助命令 Usage: PURGE [[-i <id1> | <id1> <id2>] | [-age <mins> [-type ALERT|INCIDENT|TRACE|CDUMP|HM|UTSCDMP]]]: Purpose: Purge the diagnostic data in the current ADR home. If no option is specified, the default purging policy will be used. Options: [-i id1 | id1 id2]: Users can input a single incident ID, or a range of incidents to purge. [-age <mins>]: Users can specify the purging policy either to all the diagnostic data or the specified type. The data older than <mins> ago will be purged [-type ALERT|INCIDENT|TRACE|CDUMP|HM|UTSCDMP]: Users can specify what type of data to be purged. Examples: purge purge 123 456 -i purge-AGE -type Incident 60 If the above multiple databases, in order to set before running Home ADRCI> SET HOMEPATH diag / tnslsnr / hostname / listener ADRCI> Show Home (Show HOMEPATH) - Set home after the second viewing, set the ok ADR Homes: diag / tnslsnr / y2018 / listener ADRCI> the PURGE -age ALERT # 1440 the -type delete alert log the day before the [delete (24h X 60s = 1440) one day before the log, the default is to purge minute]
5, set the log retention time
It contains two properties SHORTP_POLICY, LONGP_POLICY
SHORTP_POLICY Trace files Core dump files Packaging information LONGP_POLICY Incident information Incident dumps Alert logs
View control
adrci> show control
ADR Home = /u01/app/oracle/diag/tnslsnr/y2018/listener:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
2422723473 720 8760 2018-04-27 12:27:13.758790 +08:00 1 2 80 1 2018-04-27 12:27:13.758790 +08:00
Provided on the control, in addition to the default SHORTP_POLICY is 720 hours (30 days), LONGP_POLICY of 8760 hours (i.e., 365 days), the
We can modify the time these two attributes:
adrci> set control (SHORTP_POLICY = 360)
adrci> set control (LONGP_POLICY = 2160)
adrci> show control
ADR Home = /u01/app/oracle/diag/tnslsnr/y2018/listener:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
2422723473 360 2160 2018-04-27 12:27:13.758790 +08:00 1 2 80 1 2018-04-27 12:27:13.758790 +08:00
This changed tracefiles retention for 360 hours, 15 days, incident file retention 2160 hours, i.e. 90 days.
Above is the oracle own log retention period, we can also manually empty the purge command.
Exit ADRCI:
adrci >> exit or quit Enter