数据库
首页 > 数据库> > oracle ADR

oracle ADR

作者:互联网

自 Oracle Database 11g 发行版 1 起,所有跟踪、意外事件转储和程序包、预警日志、健康状况监视报告、核心转储等文件都存储在 ADR 这一基于文件的资料档案库中,以提供数据库诊断数据。它对多个实例和多种产品使用一个统一的目录结构,并存储在任何数据库之外。其位置由 DIAGNOSTIC_DEST 初始化参数设置。如果省略该参数或将其留空,则数据库在启动时按如下所示设置 DIAGNOSTIC_DEST:如果设置了环境变量 ORACLE_BASE,DIAGNOSTIC_DEST 会设置为 $ORACLE_BASE。如果未设置环境变量 ORACLE_BASE,DIAGNOSTIC_DEST 会设置为 $ORACLE_HOME/log。

adrci命令可用于管理ADR下相关日志,.trc,.trm文件不再需要手动或写脚本去定时清理,使用adrci即可实现自动清理:

[oracle@prodb ~]$ adrci

ADRCI: Release 11.2.0.4.0 - Production on Thu May 31 14:32:48 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/u01"
adrci> help

 HELP [topic]
   Available Topics:
        CREATE REPORT
        ECHO
        EXIT
        HELP
        HOST
        IPS
        PURGE
        RUN
        SET BASE
        SET BROWSER
        SET CONTROL
        SET ECHO
        SET EDITOR
        SET HOMES | HOME | HOMEPATH
        SET TERMOUT
        SHOW ALERT
        SHOW BASE
        SHOW CONTROL
        SHOW HM_RUN
        SHOW HOMES | HOME | HOMEPATH
        SHOW INCDIR
        SHOW INCIDENT
        SHOW PROBLEM
        SHOW REPORT
        SHOW TRACEFILE
        SPOOL

 There are other commands intended to be used directly by Oracle, type
 "HELP EXTENDED" to see the list

adrci> 

1.显示adr_home

adrci> show homes
ADR Homes: 
diag/tnslsnr/prodb/listener
diag/rdbms/prodb/prodb
diag/clients/user_oracle/host_3001804591_80

2.指定adr_home

adrci> set home diag/rdbms/prodb/prodb
adrci> show homes
ADR Homes: 
diag/rdbms/prodb/prodb

3.显示alter文件

adrci> show alert  #按q退出
adrci> show alert -tail 10   #显示最后10行
adrci> show alert -tail 10   #tail -f alert_sid.log
adrci> show alert -p "message_text like '%ORA%'"

3.显示告警事件

adrci> show incident
adrci> show incident -mode detail
adrci> show incident -mode detail -p "incident_id=123"

4.显示问题

adrci> show problem

5.删除10天前的incident 14400=60min2410

adrci> purge -age 14400 -type incident

6.生成诊断package
创建逻辑包

adrci> ips create package incident 373
adrci> ips add incident 168 package 1

输出物理包

adrci>ips generate package 1 in /home/oracle

可将生成的包提交给SR用于诊断

7.设置trc,trm日志保留天数为5-7天。等号后为小时

adrci> set control (SHORTP_POLICY = 120); 
adrci> set control (LONGP_POLICY = 168);

标签:SET,ADR,SHOW,show,adrci,incident,oracle,prodb
来源: http://blog.51cto.com/hunt1574/2348523