Oracle ADRCI诊断工具

Automatic Diagnostic Repository Comand Interpreter(ADRCI)是一个命令行工具,用来管理数据库诊断数据。

作用

1、在ADR中可以查看诊断数据

2、查看健康监控报告

3、可以把事件和问题信息打包到ZIP文件,交给Oracle支持

    ADR是一个基于文件的数据库诊断数据仓库,例如traces文件,dumps文件,alert告警日志,健康监控报告等等。它在多个实例和多个软件产品之间有一个统一的目录结构。从11g开始,Oracle ASM,其他Oracle产品和组件都把诊断数据存储在ADR中。每个产品的实例都把自己的诊断数据存储在自己的ADR主目录下,例如,在RAC环境中,ASM和共享存储,数据库实例和ASM实例都有自己的家目录在ADR中。ADR的统一目录结构使客户和Oracle支持能够在多个实例和多个产品之间相互关联和分析诊断数据。

Problem:problem是数据库中的一个critical error。critical error包括诸如ora-00600之类的内部错误和其他严重错误,如ora-07445(操作系统异常)或ora-04031(out of memory in the shared pool)。problems在ADR中被跟踪,每个problem都有一个problem键和一个唯一的问题ID.

Incident:一个problem对应一个Incident,当一个problem发生时,就会生成一个incident事件,在ADR中可追踪incident事件。每个事件都由一个数字事件ID标识,这在ADR中是唯一的。当一个事件发生时,数据库在告警日志中生成一个条目,把事件警报发送给OEM。收集incident的诊断数据转储到dump文件,并对事件的dump每个事件ID打上tag,存储在ADR中。

Problem key:每一个problem都有一个problem key,problem key是一个文本字符串包括错误编码(例如 ORA 600)和一些cases,一个或多个错误参数。如果两个事件的problem key相匹配,那么我们认为这两个事件有相同的原因造成的。

Incident Package:一个事件打包器是用来收集incident or problems数据。在发送事件数据给Oracle支持之前,你必须使用Incident Packaging Seivice(IPS)事件打包服务来收集事件数据,打成package。当package创建完之后,你可以对这个package里增加额外的文件,移除文件,或者编辑文件删除敏感数据。
一个包是一个逻辑结构,直到您从包的内容创建一个物理文件。也就是说,一个事件包从ADR中的元数据开始,在添加和删除包内容时,只修改了元数据。当您准备将数据上传到Oracle支持的时候,您可以使用ADRCI创建一个物理包,它将数据保存到zip文件中,然后您可以将zip文件上传到Oracle支持。

ADR HomeADR Home是诊断数据(traces,dumps,alert log)的根目录。你可以通过设置homepath来设置ADR home

ADR Base:ADR base 的位置可以通过设置DIAGNOSTIC_DEST参数设置,如果这个参数没有设值或者为空,这数据库会设置默认值。

Homepath:所有操作诊断数据的ADRCI命令都存在当前的ADR home下。homepath可以设置ADR home,你可以通过show home或者show homepath来查看当前的Homepath,你也可以通过set homepath命令来设置homepath。

简单练习

1、进入

[oracle@Node2 ~]$ adrci

ADRCI: Release 11.2.0.3.0 - Production on Sun Apr 16 02:31:14 2017

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

ADR base = "/u01/app/oracle"
adrci>
adrci>
adrci>
adrci>

2、使用help命令查看ADRCI的一些功能
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> HELP EXTENDED
 HELP [topic]
   Available Topics:
        BEGIN BACKUP
        CD
        CREATE STAGING XMLSCHEMA
        CREATE VIEW
        DDE
        DEFINE
        DELETE
        DESCRIBE
        DROP VIEW
        END BACKUP
        INSERT
        LIST DEFINE
        MERGE ALERT
        MERGE FILE
        MIGRATE
        QUERY
        REPAIR
        SELECT
        SET COLUMN
        SHOW CATALOG
        SHOW DUMP
        SHOW SECTION
        SHOW TRACE
        SHOW TRACEMAP
        SWEEP
        UNDEFINE
        UPDATE
        VIEW

3、查看trace文件,也可以指定格式查看

adrci> help show tracefile
  Usage: SHOW TRACEFILE [file1 file2 ...] [-rt | -t]
                        [-i inc1 inc2 ...] [-path path1 path2 ...]
  Purpose: List the qualified trace filenames.
  Options:
    [file1 file2 ...]: The trace files users are interested in to search.
    If "-i" or/and "-path" is specified, the trace files are assumed
    to be under the specified incidents or paths. Otherwise, the files
    will be searched among the trace directory and all incident directories
    of the current ADR homes. Filenames allow SQL like condition syntax.
    I.e., allowing wildcard search on filenames by using "%". For example,
    "%mmon%" means all trace files with the "mmon" substring.
    [-rt | -t]: Order the trace filenames. "-t" means in the modified
    timestamps order; "-rt" means in the reversed modified timestamps
    order. Note that the ordering is only apply to a single directory.
    [-i inc1 inc2 ...]: The trace files produced for the listed incidents.
    If no files are listed, all trace files produced for the list
    incidents are considered.
    [-path path1 path2 ...]: The trace files under the given paths will be
    queried. If no files are listed, all trace files under these paths
    are considered.
  Examples: 
    1. Show all the trace files under the current home
       "show tracefile"
    2. Show all the mmon trace files in time reverse order
       "show tracefile %mmon% -rt"
    3. Show all trace files under incidents 123 456, and /home/someone/temp
       "show tracefile -i 123 456 -path  /home/someone/temp"

4、查看alert
adrci> show alert
Choose the alert log from the following homes to view:
1: diag/tnslsnr/Node2/listener
2: diag/clients/user_oracle/host_3130356937_80
3: diag/rdbms/zxy/zxy
Q: to quit
Please select option: 1
Output the results to file: /tmp/alert_16265_1404_listener_1.ado
2017-04-14 08:28:59.415000 +08:00
Create Relation ADR_CONTROL
Create Relation ADR_INVALIDATION
Create Relation INC_METER_IMPT_DEF
Create Relation INC_METER_PK_IMPTS
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/Node2/listener/alert/log.xml
Trace information written to /u01/app/oracle/diag/tnslsnr/Node2/listener/trace/ora_59605_140051807921920.trc
Trace level is currently 0
Started with pid=59605
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Node2)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
2017-04-14 08:29:00.513000 +08:00
Listener completed notification to CRS on start
。。。。。。。。。Q 退出

adrci> show alert -tail
2017-04-15 15:25:29.047000 +08:00
Database Characterset is ZHS16GBK
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
QMNC started with pid=20, OS id=8316
Completed: alter database open
db_recovery_file_dest_size of 4122 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Starting background process CJQ0
CJQ0 started with pid=23, OS id=8332
2017-04-15 15:25:32.861000 +08:00
Setting Resource Manager plan SCHEDULER[0x318E]:DEFAULT_MAINTENANCE_PLAN via scheduler window
Setting Resource Manager plan DEFAULT_MAINTENANCE_PLAN via parameter
Starting background process VKRM
VKRM started with pid=21, OS id=8334
2017-04-15 15:35:29.522000 +08:00
Starting background process SMCO
SMCO started with pid=22, OS id=8445
2017-04-16 02:00:00.008000 +08:00
Closing scheduler window
5、查看ADRCI主目录
adrci> show home
ADR Homes:
diag/tnslsnr/Node2/listener
diag/clients/user_oracle/host_3130356937_80
diag/rdbms/zxy/zxy
5.1可设置ADRCI家目录
adrci> set home diag/rdbms/zxy/zxy
adrci> show home
ADR Homes:
diag/rdbms/zxy/zxy

6、查看incident

adrci> show incident
ADR Home = /u01/app/oracle/diag/rdbms/zxy/zxy:
*************************************************************************

查看事件详情,可以使用help

adrci> help show incident
  Usage: SHOW INCIDENT [-p <predicate_string>]
                       [-mode BASIC|BRIEF|DETAIL]
                       [-last <num> | -all]
                       [-orderby (field1, field2, ...) [ASC|DSC]]
  Purpose: Show the incident information. By default, this command will
           only show the last 50 incidents which are not flood controlled.
  Options:
    [-p <predicate_string>]: The predicate string must be double-quoted.
    [-mode BASIC|BRIEF|DETAIL]: The different modes of showing incidents.
    BASIC will show the basic information of non-flooded controlled
    incidents, which is the default mode. In this mode, only the following
    fields can be used in the predicate clause:
        INCIDENT_ID                   number
        PROBLEM_KEY                   text(550)
        CREATE_TIME                   timestamp
    BRIEF will display incident information from the incident relation.
    In this mode, the fields can appear in the predicate are:
        INCIDENT_ID                   number
        PROBLEM_ID                    number
        CREATE_TIME                   timestamp
        CLOSE_TIME                    timestamp
        STATUS                        number
        FLAGS                         number
        FLOOD_CONTROLLED              number
        ERROR_FACILITY                text(10)
        ERROR_NUMBER                  number
        ERROR_ARG1                    text(64)
        ERROR_ARG2                    text(64)
        ERROR_ARG3                    text(64)
        ERROR_ARG4                    text(64)
        ERROR_ARG5                    text(64)
        ERROR_ARG6                    text(64)
        ERROR_ARG7                    text(64)
        ERROR_ARG8                    text(64)
        SIGNALLING_COMPONENT          text(64)
        SIGNALLING_SUBCOMPONENT       text(64)
        SUSPECT_COMPONENT             text(64)
        SUSPECT_SUBCOMPONENT          text(64)
        ECID                          text(64)
        IMPACT                        number
    DETAIL will display all incident-related information, such as incident
    files. The fields can appear in the predicate is the same as the ones
    in the brief mode.
    [-last <num> | -all]: This option allows users to either select
    the last <num> of qualified incidents to show or to show all the
    qualified incidents. If this option is not specified, this command
    will only show 50 incidents.
    [-orderby (field1, field2, ...) [ASC|DSC]]: If specified, the results
    will be ordered by the specified fields' values. By default, it will be
    in the ascending order unless "DSC" is specified. Note that the field
    names that can be specified here are from the "INCIDENT" relation.
  Examples: 
    show incident
    show incident -mode detail
    show incident -mode detail -p "incident_id=123"


0 rows fetched

7、查看problem

adrci> show problem
ADR Home = /u01/app/oracle/diag/rdbms/zxy/zxy:
*************************************************************************
0 rows fetched

8、创建事件包分为三步
8.1、创建逻辑包,逻辑包不包括内容,只是ADR中的元数据,在第二步中可添加内容

ips create package
当然你创建逻辑包的时候可以加上内容,这样第二步就可有可无了,创建命令
IPS CREATE PACKAGE INCIDENT incident_number
IPS CREATE PACKAGE PROBLEM problem_id
IPS CREATE PACKAGE PROBLEMKEY “problem_key”
IPS CREATE PACKAGE TIME 'start_time' TO 'end_time'
8.2、把诊断数据增加到逻辑包
IPS ADD INCIDENT incident_number PACKAGE package_number
也可以增加文件
IPS ADD FILE filespec PACKAGE package_number
8.3、生成物理事件包
IPS GENERATE PACKAGE package_number IN path
上面这个命令会在path路径下生成一个zip文件。
例如:IPS GENERATE PACKAGE 2 IN /home/oracle/diagnostics


猜你喜欢

转载自blog.csdn.net/qq_31943653/article/details/76572074