ADRCI工具的使用

The Automatic Diagnostic Repository Command Interpreter (ADRCI) utility is a command-line tool that you use to manage Oracle Database diagnostic data.

ADRCI是一个命令行工具用来管理Oracle数据库诊断数据。

ADRCI is a command-line tool that is part of the fault diagnosability infrastructure introduced in Oracle Database 11g. ADRCI enables you to:

  • View diagnostic data within the Automatic Diagnostic Repository (ADR).  -----查看ADR中的诊断信息

  • View Health Monitor reports.  -----查看Health Monitor报告

  • Package incident and problem information into a zip file for transmission to Oracle Support.  -----打包事故和错误信息为zip发送给Oracle Support

Diagnostic data includes incident and problem descriptions, trace files, dumps, health monitor reports, alert log entries, and more.

-----诊断数据包括故障,问题描述,trace文件,dumps,health monitor报告,告警文件等

ADR data is secured by operating system permissions on the ADR directories, hence there is no need to log in to ADRCI.

ADRCI has a rich command set, and can be used in interactive mode or within scripts. -----可以通过编写scripts来使用

[oracle@ocm1 ~]$ adrci


ADRCI: Release 11.2.0.3.0 - Production on Tue Oct 11 01:09:20 2016


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


ADR base = "/u01/app/oracle"
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> show homes   --查看当前设置的ADR家目录
ADR Homes: 
diag/tnslsnr/ocm1/lsnr2
diag/tnslsnr/ocm1/listener
diag/clients/user_oracle/host_522008804_80
diag/rdbms/prod2/PROD2
diag/rdbms/prod1/PROD1
diag/rdbms/dummy/PROD1
diag/rdbms/prod3/PROD3


adrci> set homepath diag/rdbms/prod1/PROD1  --设置家目录为目标库


adrci> show homes  --查看设置生效
ADR Homes: 
diag/rdbms/prod1/PROD1


adrci> show alert  --查看alert log目录


ADR Home = /u01/app/oracle/diag/rdbms/prod1/PROD1:
*************************************************************************


adrci> show tracefile  --查看当前家目录所有trace文件
     diag/rdbms/prod1/PROD1/trace/PROD1_mmon_3427.trc
     diag/rdbms/prod1/PROD1/trace/ALERT_LOG_28424.log
     diag/rdbms/prod1/PROD1/trace/5_100_0_788623.bkd
     diag/rdbms/prod1/PROD1/trace/PROD1_ora_27310.tr
     diag/rdbms/prod1/PROD1/trace/PROD1_dbrm_3411.trc
     diag/rdbms/prod1/PROD1/trace/alert_PROD1.log
     diag/rdbms/prod1/PROD1/trace/ALERT_LOG_28398.log
<span style="white-space:pre">	</span> 
adrci> show tracefile %mmon%  --查看包含mmon的trace文件
     diag/rdbms/prod1/PROD1/trace/PROD1_mmon_3427.trc
<span style="white-space:pre">	</span> 
adrci> show tracefile -RT  --查看当前家目录所有trace文件,并按时间倒序输出
   11-OCT-16 01:18:33  diag/rdbms/prod1/PROD1/trace/PROD1_dbrm_3411.trc
   11-OCT-16 01:16:02  diag/rdbms/prod1/PROD1/trace/PROD1_mmon_3427.trc
   10-OCT-16 22:40:08  diag/rdbms/prod1/PROD1/trace/alert_PROD1.log
   03-OCT-16 18:15:22  diag/rdbms/prod1/PROD1/trace/PROD1_ora_27310.tr
   03-OCT-16 15:57:43  diag/rdbms/prod1/PROD1/trace/5_100_0_788623.bkd
   26-SEP-16 22:03:05  diag/rdbms/prod1/PROD1/trace/ALERT_LOG_28398.log
   26-SEP-16 22:00:15  diag/rdbms/prod1/PROD1/trace/ALERT_LOG_28424.log
   
adrci> show tracefile -I 1681  --查看与incident 1681有关的trace文件


--模拟错误incident/problem
SYS@prod1> create table eoda.copy as select * from eoda.big_table where rownum<2;


Table created.


SYS@prod1> commit;


Commit complete.


SYS@prod1> select object_name, object_id, data_object_id from dba_objects where owner='EODA' and object_name='COPY';


OBJECT_NAME
----------------------------------------------------------------------------------------------------
 OBJECT_ID DATA_OBJECT_ID
---------- --------------
COPY
     85577<span style="white-space:pre">	</span>    85577




SYS@prod1> update sys.tab$ set OBJ#=88888 where OBJ#=85577;     


1 row updated.


SYS@prod1> commit;


Commit complete.


SYS@prod1> alter system checkpoint;


System altered.


SYS@prod1> startup force
ORACLE instance started.


SYS@prod1> desc eoda.copy;
ERROR:
ORA-03113: end-of-file on communication channel
Process ID: 29748
Session ID: 1 Serial number: 5       --***模拟完成***


adrci> show incident  --查看错误


ADR Home = /u01/app/oracle/diag/rdbms/prod1/PROD1:
*************************************************************************
INCIDENT_ID          PROBLEM_KEY                                                 CREATE_TIME                              
-------------------- ----------------------------------------------------------- ---------------------------------------- 
79605                ORA 7445 [kqldcdp()+58]                                     2016-10-11 01:52:19.455000 +08:00       
1 rows fetched


--SHOW INCIDENT -MODE BRIEF
--SHOW INCIDENT -MODE DETAIL  --查看详细信息 These commands produce more detailed versions of the incident report.
--SHOW INCIDENT -MODE DETAIL -P "INCIDENT_ID=1681"  --指定错误ID的详细信息


adrci> show incident -mode brief


ADR Home = /u01/app/oracle/diag/rdbms/prod1/PROD1:
*************************************************************************


**********************************************************
INCIDENT INFO RECORD 1
**********************************************************
   INCIDENT_ID                   79605
   STATUS                        ready
   CREATE_TIME                   2016-10-11 01:52:19.455000 +08:00
   PROBLEM_ID                    3
   CLOSE_TIME                    <NULL>
   FLOOD_CONTROLLED              none
   ERROR_FACILITY                ORA
   ERROR_NUMBER                  7445
   ERROR_ARG1                    kqldcdp()+58
   ERROR_ARG2                    SIGSEGV
   ERROR_ARG3                    ADDR:0x0
   ERROR_ARG4                    PC:0x95FBD20
   ERROR_ARG5                    Address not mapped to object
   ERROR_ARG6                    <NULL>
   ERROR_ARG7                    <NULL>
   ERROR_ARG8                    <NULL>
   ERROR_ARG9                    <NULL>
   ERROR_ARG10                   <NULL>
   ERROR_ARG11                   <NULL>
   ERROR_ARG12                   <NULL>
   SIGNALLING_COMPONENT          LIBCACHE
   SIGNALLING_SUBCOMPONENT       <NULL>
   SUSPECT_COMPONENT             <NULL>
   SUSPECT_SUBCOMPONENT          <NULL>
   ECID                          <NULL>
   IMPACTS                       0
1 rows fetched


adrci> show incident -mode detail


ADR Home = /u01/app/oracle/diag/rdbms/prod1/PROD1:
*************************************************************************


**********************************************************
INCIDENT INFO RECORD 1
**********************************************************
   INCIDENT_ID                   79605
   STATUS                        ready
   CREATE_TIME                   2016-10-11 01:52:19.455000 +08:00
   PROBLEM_ID                    3
   CLOSE_TIME                    <NULL>
   FLOOD_CONTROLLED              none
   ERROR_FACILITY                ORA
   ERROR_NUMBER                  7445
   ERROR_ARG1                    kqldcdp()+58
   ERROR_ARG2                    SIGSEGV
   ERROR_ARG3                    ADDR:0x0
   ERROR_ARG4                    PC:0x95FBD20
   ERROR_ARG5                    Address not mapped to object
   ERROR_ARG6                    <NULL>
   ERROR_ARG7                    <NULL>
   ERROR_ARG8                    <NULL>
   ERROR_ARG9                    <NULL>
   ERROR_ARG10                   <NULL>
   ERROR_ARG11                   <NULL>
   ERROR_ARG12                   <NULL>
   SIGNALLING_COMPONENT          LIBCACHE
   SIGNALLING_SUBCOMPONENT       <NULL>
   SUSPECT_COMPONENT             <NULL>
   SUSPECT_SUBCOMPONENT          <NULL>
   ECID                          <NULL>
   IMPACTS                       0
   PROBLEM_KEY                   ORA 7445 [kqldcdp()+58]
   FIRST_INCIDENT                79605
   FIRSTINC_TIME                 2016-10-11 01:52:19.455000 +08:00
   LAST_INCIDENT                 79605
   LASTINC_TIME                  2016-10-11 01:52:19.455000 +08:00
   IMPACT1                       0
   IMPACT2                       0
   IMPACT3                       0
   IMPACT4                       0
   KEY_NAME                      ProcId
   KEY_VALUE                     30.2
   KEY_NAME                      Client ProcId
   KEY_VALUE                     oracle@ocm1 (TNS V1-V3).29748_16275136
   KEY_NAME                      SID
   KEY_VALUE                     1.5
   OWNER_ID                      1
   INCIDENT_FILE                 /u01/app/oracle/diag/rdbms/prod1/PROD1/trace/PROD1_ora_29748.trc
   OWNER_ID                      1
   INCIDENT_FILE                 /u01/app/oracle/diag/rdbms/prod1/PROD1/incident/incdir_79605/PROD1_ora_29748_i79605.trc
1 rows fetched


adrci> show problem            


ADR Home = /u01/app/oracle/diag/rdbms/prod1/PROD1:
*************************************************************************
PROBLEM_ID           PROBLEM_KEY                                                 LAST_INCIDENT        LASTINC_TIME                             
-------------------- ----------------------------------------------------------- -------------------- ---------------------------------------- 
1                    ORA 25319                                                   49354                2016-07-10 14:09:42.126000 +08:00       
2                    ORA 1578                                                    68804                2016-10-04 16:46:42.387000 +08:00       
3                    ORA 7445 [kqldcdp()+58]                                     79605                2016-10-11 01:52:19.455000 +08:00       
3 rows fetched


adrci> show problem -p "problem_id=3"


ADR Home = /u01/app/oracle/diag/rdbms/prod1/PROD1:
*************************************************************************
PROBLEM_ID           PROBLEM_KEY                                                 LAST_INCIDENT        LASTINC_TIME                             
-------------------- ----------------------------------------------------------- -------------------- ---------------------------------------- 
3                    ORA 7445 [kqldcdp()+58]                                     79605                2016-10-11 01:52:19.455000 +08:00       
1 rows fetched


--problem和incident的关系我理解为一个incident可能产生多次的problem


Packaging Incidents
You can use ADRCI commands to package one or more incidents for transmission to Oracle Support for analysis. Background information and instructions are presented in the following topics:
--打包incident


adrci> ips create package  --创建逻辑package
Created package 1 without any contents, correlation level typical


adrci> ips create package incident 79605 correlate all  --指定incident
Created package 2 based on incident id 79605, correlation level all


adrci> ips create package problem 3  --指定problem
Created package 3 based on problem id 3, correlation level typical


[oracle@ocm1 PROD1]$ cd /u01/app/oracle/diag/rdbms/prod1/PROD1/
alert/         hm/            incpkg/        lck/           metadata_dgif/ stage/         trace/         
cdump/         incident/      ir/            metadata/      metadata_pv/   sweep/         
[oracle@ocm1 PROD1]$ cd /u01/app/oracle/diag/rdbms/prod1/PROD1/incpkg/
[oracle@ocm1 incpkg]$ ls
pkg_1  pkg_2  pkg_3


adrci> ips generate package 2 in /home/oracle/package  --建立物理package并指定路径
DIA-49428: No such directory or directory not accessible  [/home/oracle/package]


[oracle@ocm1 incpkg]$ mkdir /home/oracle/package


adrci> ips generate package 2 in /home/oracle/package
Generated package 2 in file /home/oracle/package/ORA7445kq_20161011020435_COM_1.zip, mode complete


[oracle@ocm1 package]$ ls  --打包完成可提交SR
ORA7445kq_20161011020435_COM_1.zip


--purge删除ADR文件
purge [-i {id | start_id end_id} |   -age mins [-type {ALERT|INCIDENT|TRACE|CDUMP|HM}]]
The SHOW CONTROL command displays the default purging policies for short-lived ADR contents and long-lived ADR contents. 
adrci> show control  --查看默认的删除策略


ADR Home = /u01/app/oracle/diag/rdbms/prod1/PROD1:
*************************************************************************
ADRID                SHORTP_POLICY        LONGP_POLICY         LAST_MOD_TIME                            LAST_AUTOPRG_TIME                        LAST_MANUPRG_TIME                        ADRDIR_VERSION       ADRSCHM_VERSION      ADRSCHMV_SUMMARY     ADRALERT_VERSION     CREATE_TIME                              
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ---------------------------------------- 
2542641053           720                  8760                 2016-05-21 17:52:52.395490 +08:00                                                 2016-10-10 23:10:46.160362 +08:00        1                    2                    80                   1                    2016-05-21 17:52:52.395490 +08:00       
1 rows fetched


adrci>purge --this example purges all diagnostic data in the current ADR home based on the default purging policies


adrci>purge -i 123 456  --This example purges all diagnostic data for all incidents between 123 and 456:


adrci>purge -age 60 -type incident  --This example purges all incident data from the last hour:




  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值