oracle 使用adrci清理incident文件

oracle中通常有好多日志文件,遇到异常情况会产生大量日志,造成磁盘空间紧张。

故需要清理对应文件。包括trace文件,incident文件,listener log文件等


11g中oracle提供了一个ADRCI的命令行工具来查看ADR中的alert日志和trace信息,可以批量删除对应的日志文件。

adrci的位置在$ORACLE_HOME/bin目录下


--删除incident文件

--登陆  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"


--查看目录
adrci> show home
ADR Homes: 
diag/rdbms/test/test
diag/tnslsnr/test/listener


--由于当前adr_base下有好多目录,需要指定单一目录
adrci> set homepath diag/rdbms/test/test
adrci> show home
ADR Homes: 
diag/rdbms/test/test

--查看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       


--删除10天前的incident 14400=60min*24*10
adrci> purge -age 14400 -type incident
adrci> exit


--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

  • 0
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值