oracle中通常有好多日志文件,遇到异常情况会产生大量日志,造成磁盘空间紧张。
故需要清理对应文件。包括trace文件,incident文件,listener log文件等
11g中oracle提供了一个ADRCI的命令行工具来查看ADR中的alert日志和trace信息,可以批量删除对应的日志文件。
adrci的位置在$ORACLE_HOME/bin目录下
[root@prod-idm-storage incident]# adrci
ADRCI: Release 11.2.0.2.0 - Production on Tue May 7 15:19:08 2019
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
ADR base = "/app/oracle"
adrci> show home
ADR Homes:
diag/rdbms/orcl/orcl
adrci> show incident
ADR Home = /app/oracle/diag/rdbms/orcl/orcl:
*************************************************************************
INCIDENT_ID PROBLEM_KEY CREATE_TIME
-------------------- ----------------------------------------------------------- ----------------------------------------
243353 ORA 227 2018-08-31 09:22:40.871000 +08:00
262554 ORA 227 2018-08-31 09:34:26.395000 +08:00
339426 ORA 1578 2018-09-22 06:01:46.329000 +08:00
339370 ORA 1578 2018-09-22 10:07:49.852000 +08:00
339402 ORA 1578 2018-09-22 14:08:23.558000 +08:00
339386 ORA 1578 2018-09-22 18:08:47.587000 +08:00
339394 ORA 1578 2018-09-22 22:09:26.524000 +08:00
339410 ORA 1578 2018-09-23 06:01:17.392000 +08:00
339387 ORA 1578 2018-09-23 10:10:58.257000 +08:00
339411 ORA 1578 2018-09-23 14:11:21.786000 +08:00
339412 ORA 1578 2018-09-23 18:11:59.186000 +08:00
339413 ORA 1578 2018-09-23 22:12:19.998000 +08:00
339414 ORA 1578 2018-09-24 22:01:20.661000 +08:00
339434 ORA 1578 2018-09-25 22:01:21.496000 +08:00
339415 ORA 1578 2018-09-26 22:01:09.127000 +08:00
339442 ORA 1578 2018-09-27 22:01:26.124000 +08:00
339450 ORA 1578 2018-09-28 22:01:21.893000 +08:00
339403 ORA 1578 2018-09-29 06:01:25.350000 +08:00
339418 ORA 1578 2018-09-29 10:07:14.940000 +08:00
339388 ORA 1578 2018-09-29 14:07:53.091000 +08:00
339389 ORA 1578 2018-09-29 18:08:10.510000 +08:00
339404 ORA 1578 2018-09-29 22:08:50.151000 +08:00
339419 ORA 1578 2018-09-30 06:01:15.858000 +08:00
339390 ORA 1578 2018-09-30 10:10:21.898000 +08:00
339391 ORA 1578 2018-09-30 14:10:47.874000 +08:00
339371 ORA 1578 2018-09-30 18:11:24.833000 +08:00
339405 ORA 1578 2018-09-30 22:11:47.994000 +08:00
339372 ORA 1578 2018-10-01 22:01:17.620000 +08:00
339435 ORA 1578 2018-10-02 22:01:30.078000 +08:00
339451 ORA 1578 2018-10-03 22:01:23.725000 +08:00
339420 ORA 1578 2018-10-04 22:01:21.404000 +08:00
339416 ORA 1578 2018-10-05 22:01:15.775000 +08:00
339421 ORA 1578 2018-10-06 06:01:29.564000 +08:00
339417 ORA 1578 2018-10-06 10:08:21.342000 +08:00
339422 ORA 1578 2018-10-06 14:08:52.711000 +08:00
345607 ORA 1578 2018-10-06 18:09:17.919000 +08:00
345609 ORA 1578 2018-10-06 22:09:56.154000 +08:00
339436 ORA 1578 2018-10-07 06:01:18.502000 +08:00
339406 ORA 1578 2018-10-07 10:01:23.514000 +08:00
339407 ORA 1578 2018-10-07 14:01:46.542000 +08:00
339354 ORA 1578 2018-10-07 18:02:21.533000 +08:00
339355 ORA 1578 2018-10-07 22:02:45.654000 +08:00
339498 ORA 1578 2018-10-08 22:01:23.626000 +08:00
339466 ORA 1578 2018-10-09 22:01:21.970000 +08:00
339467 ORA 1578 2018-10-10 22:01:11.649000 +08:00
339499 ORA 1578 2018-10-11 22:01:17.955000 +08:00
339443 ORA 1578 2018-10-12 22:01:24.071000 +08:00
339423 ORA 1578 2018-10-13 06:01:17.901000 +08:00
339373 ORA 1578 2018-10-13 10:06:37.319000 +08:00
339374 ORA 1578 2018-10-13 14:07:14.910000 +08:00
First 50 rows fetched (*** more available ***)
adrci>purge -age 144000 -type incident
adrci> exit
adrci> help purge
Usage: PURGE [[-i | ] |
[-age [-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 ]: Users can specify the purging policy either to all
the diagnostic data or the specified type. The data older than
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
adrci> show tracefile
diag/rdbms/oam/oam/trace/oam_vkrm_10487.trc
diag/rdbms/oam/oam/trace/oam_vkrm_6627.trc
diag/rdbms/oam/oam/trace/oam_j003_26131.trc
diag/rdbms/oam/oam/trace/oam_m000_404.trc
diag/rdbms/oam/oam/trace/oam_m000_20336.trc
diag/rdbms/oam/oam/trace/oam_w000_3502.trc
diag/rdbms/oam/oam/trace/oam_vkrm_31062.trc
diag/rdbms/oam/oam/trace/oam_m000_14702.trc
diag/rdbms/oam/oam/trace/oam_j000_949.trc
diag/rdbms/oam/oam/trace/oam_vkrm_28172.trc
diag/rdbms/oam/oam/trace/alert_oam.log
diag/rdbms/oam/oam/trace/oam_vkrm_12182.trc
diag/rdbms/oam/oam/trace/oam_w000_31588.trc
diag/rdbms/oam/oam/trace/oam_j000_6363.trc
diag/rdbms/oam/oam/trace/oam_w001_8741.trc
diag/rdbms/oam/oam/trace/oam_m000_15978.trc
diag/rdbms/oam/oam/trace/oam_vkrm_15883.trc
diag/rdbms/oam/oam/trace/oam_m000_5141.trc
diag/rdbms/oam/oam/trace/oam_j001_15641.trc
diag/rdbms/oam/oam/trace/oam_j000_21062.trc
diag/rdbms/oam/oam/trace/oam_m000_24268.trc
diag/rdbms/oam/oam/trace/oam_m000_21366.trc
diag/rdbms/oam/oam/trace/oam_vkrm_14072.trc
adrci> purge -age 8760 -type TRACE