oracle中通常有好多日志文件,遇到异常情况会产生大量日志,造成磁盘空间紧张。
故需要清理对应文件。包括trace文件,incident文件,listener log文件等
11g中oracle提供了一个ADRCI的命令行工具来查看ADR中的alert日志和trace信息,可以批量删除对应的日志文件。
adrci的位置在$ORACLE_HOME/bin目录下
删除incident文件
1.登陆 oracle用户下
[oracle@ ~]$ adrci ADRCI: Release 12.1.0.1.0 - Production on Thu Dec 21 15:02:14 2017 Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved. ADR base = "/home/oracle/app/oracle"
2.查看目录
adrci> show home ADR Homes: diag/rdbms/test/test diag/tnslsnr/test/listener
3.由于当前adr_base下有好多目录,需要指定单一目录
adrci> set homepath diag/rdbms/test/test adrci> show home ADR Homes: diag/rdbms/test/test
4.查看incident
adrci> show incident ADR Home = /home/oracle/app/oracle/diag/rdbms/test/test: ************************************************************************* INCIDENT_ID PROBLEM_KEY CREATE_TIME -------------------- ----------------------------------------------------------- ---------------------------------------- 456824 ORA 4031 2017-09-04 00:01:51.753000 +08:00 456776 ORA 4031 2017-09-04 01:58:39.451000 +08:00 456496 ORA 4031 2017-09-04 01:58:54.765000 +08:00 456777 ORA 4031 2017-09-04 01:59:00.045000 +08:00
5.删除10天前的incident 14400=60min*24*10
adrci> purge -age 14400 -type incident adrci> exit
6.adrci其他相关命令
adrci> help 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 -i 123 456 purge -age 60 -type incident
评论前必须登录!
注册