ADRCI的常规操作介绍

ADRCI
简介
ADRCI全称 Automatic Diagnostic Repository Command Interpreter,是Oracle在11g提出的一个管理诊断数据的命令行工具。
诊断数据包括事件和问题描述、trace文件、dumps文件、HM(Health Monitor)报告和alert日志记录等。
ADRCI具有下面三个功能:
1, 查看ADR中的诊断数据;
2, 查看HM(Health Monitor)报告;
3, 打包事件和问题信息为ZIP发送给Oracle Support。

使用
ADRCI命令所在位置为$ORACLE_HOME/bin,在使用ADRCI命令时请确认设定正确的ORACLE_HOME和BIN环境变量。
测试环境:Linux 6.3下的11.2.0.4 oracle database。
进入
进入ADRCI交互界面:在控制台输入ADRCI。
退出
退出ADRCI交互界面:在ADRCI交互界面输入EXIT or QUIT。
HELP
用途:
获取帮助信息。
在ADRCI命令交互界面上使用HELP命令:

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

可以使用help继续对上述命令进行显示帮助信息,比如show alert:

adrci> help show alert

  Usage: SHOW ALERT [-p ]  [-term]
                    [ [-tail [num] [-f]] | [-file ] ]
  Purpose: Show alert messages.

  Options:
    [-p ]: The predicate string must be double-quoted.
    The fields in the predicate are the fields:
        ORIGINATING_TIMESTAMP         timestamp
        NORMALIZED_TIMESTAMP          timestamp
        ORGANIZATION_ID               text(65)
        COMPONENT_ID                  text(65)
        HOST_ID                       text(65)
        HOST_ADDRESS                  text(17)
        MESSAGE_TYPE                  number
        MESSAGE_LEVEL                 number
        MESSAGE_ID                    text(65)
        MESSAGE_GROUP                 text(65)
        CLIENT_ID                     text(65)
        MODULE_ID                     text(65)
        PROCESS_ID                    text(33)
        THREAD_ID                     text(65)
        USER_ID                       text(65)
        INSTANCE_ID                   text(65)
        DETAILED_LOCATION             text(161)
        UPSTREAM_COMP_ID              text(101)
        DOWNSTREAM_COMP_ID            text(101)
        EXECUTION_CONTEXT_ID          text(101)
        EXECUTION_CONTEXT_SEQUENCE    number
        ERROR_INSTANCE_ID             number
        ERROR_INSTANCE_SEQUENCE       number
        MESSAGE_TEXT                  text(2049)
        MESSAGE_ARGUMENTS             text(129)
        SUPPLEMENTAL_ATTRIBUTES       text(129)
        SUPPLEMENTAL_DETAILS          text(129)
        PROBLEM_KEY                   text(65)

    [-tail [num] [-f]]: Output last part of the alert messages and 
    output latest messages as the alert log grows. If num is not specified, 
    the last 10 messages are displayed. If "-f" is specified, new data
    will append at the end as new alert messages are generated.

    [-term]: Direct results to terminal. If this option is not specified,
    the results will be open in an editor. 
    By default, it will open in emacs, but "set editor" can be used
    to set other editors.

    [-file ]: Allow users to specify an alert file which 
    may not be in ADR.  must be specified with full path.
    Note that this option cannot be used with the -tail option

  Examples:  
    show alert 
    show alert -p "message_text like '%incident%'"
show alert -tail 20

可以得到进一步的帮助信息。

CREATE REPORT
用途:
创建一个指定报告类型和执行名称的报告,存储于ADR中。当前支持的报告类型只有hm_run(Health Monitor)报告类型。
语法描述:

create report report_type run_name

其中report_type必须为hm_run。
注:create report必须在单ADR homes设置下使用。
例子:
在创建report之前,需要在database中创建相应的检查,如创建run_dict1:
在数据库中执行:

BEGIN
    DBMS_HM.RUN_CHECK('Dictionary Integrity Check', 'run_dict1');
END;
/

在ADRCI中执行:

adrci> create report hm_run run_dict1

创建完成。
如果数据库中没有相应的report,在创建时将会报错

adrci> create report hm_run rum_dict2
DIA-48482: Report is not generated
DIA-48614: HM run with name [rum_dict2] not found
ECHO

用途:
输出输入的字符串,也可以自定义输出ADRCI脚本。
语法描述:
echo quoted_string
注:1,字符串必须使用单引号或者双引号;
2,此命令在使用前不需要对ADR主目录进行设置。
例子:

输出 hello word
adrci> echo "Hello, world!"
Hello, world!
adrci> echo 'Hello, world!'
Hello, world!

HOST
用途:
在ADECI中使用操作系统指令。
语法描述:
host [“host_command_string”]
例子:

adrci> host
[oracle@O11g ~]$ exit
Exit
adrci>
adrci> host "ls -l"
total 4
drwxr-xr-x. 2 oracle oinstall 4096 Apr  7 14:00 test
PURGE

用途:
根据当前的清除策略清除当前ADR home下的诊断数据。
ADR中的诊断数据有各自默认的生命周期,比如事件和问题信息默认将于1年后清除,而转储文件(dump file)默认保存30天。
使用show control显示 short-lived ADR contents 和 long-lived ADR 内容默认清除策略。
语法描述:
purge [-i {id | start_id end_id} |
-age mins [-type {ALERT|INCIDENT|TRACE|CDUMP|HM}]]

-i {id1 | start_id end_id} 根据事件ID进行清除,一个或者多个事件ID;
-age mins 清除存在时间超过mins的数据,单位分钟;
-type{ALERT|INCIDENT|TRACE|CDUMP|HM} 清除指定类型的诊断数据。
例子:

adrci> purge
adrci> purge -i 123 456
adrci> purge -age 60 -type incident

RUN
用途:
执行ADRCI脚本。
语法描述:
run script_name
@ script_name
@@ script_name
其中run和@是同义词,@@和@在执行脚本时没有区别, @@会优先使用路径定位脚本,而不是当前路径。
注:脚本默认扩展名为.adi.
例子:

adrci> @a
total 8
-rw-r--r--. 1 oracle oinstall  6 Apr  7 14:00 aa
-rw-r--r--. 1 oracle oinstall 13 Apr  7 15:03 a.adi
adrci> run a
total 8
-rw-r--r--. 1 oracle oinstall  6 Apr  7 14:00 aa
-rw-r--r--. 1 oracle oinstall 13 Apr  7 15:03 a.adi
adrci> @@a
total 8
-rw-r--r--. 1 oracle oinstall  6 Apr  7 14:00 aa
-rw-r--r--. 1 oracle oinstall 13 Apr  7 15:03 a.adi

SET BASE
用途:
设置当前ADRCI回话的ADR base。
语法描述:
set base base_str base_str是一个具有完整路径的目录
例子:

adrci> set base /oracle

SET BROWSER
用途:
设置显示报告的默认浏览器。
语法描述:
set browser browser_program
例子:

set browser mozilla

SET CONTROL
用途:
设置ADR内容的清除策略。
语法描述:
set control (purge_policy = value, …)

SHORTP_POLICY:设置Trace files、Core dump files、 Packageing information的生存周期,单位是小时;默认值为720小时;最大设置值大小为35791394;
LONGP_POLICY:设置Incident information、Incident dumps、Alert logs的生存周期,单位是小时;默认值为8760小时;最大设置值大小为35791394;
例子:

set control (SHORTP_POLICY = 360)   value单位为小时。

此命令使用需要设置ADR Home。
SET ECHO
用途:
打开或关闭命令输出,此命令仅适用于执行脚本或在spool模式。
语法描述:
Set echo on|off
例子:

set echo off
SET EDITOR

用途:
设置显示alert日志和trace文件内容的编辑器。
语法描述:
set editor editor_program
editor_program表示编辑器的名称,ADRCI默认编辑器为操作系统环境变量EDITOR控制,如果没有设置环境变量,默认为VI编辑器。
例子:

set editor xemacs

SET HOMES | HOME | HOMEPATH
用途:
设置当前ADRCI的主目录(可设置多个)。
语法描述:
set homepath homepath_str1 homepath_str2 …
例子:

set homepath diag/rdbms/orcldw/orcldw1  diag/rdbms/orcldw/orcldw2

SET TERMOUT
用途:
在spooling时打开或关闭终端输出。
语法描述:
set termout on| off
例子:

set termout on

SHOW ALERT
用途:
使用默认编辑器显示目录下alert日志。
语法描述:

show alert [-p "predicate_string"] [-tail [num] [-f]] [-term]
  [-file alert_file_name]

-p “predicate_string” 显示符合predicate_string条件的的alert日志条目。
-tail [num] [-f] 显示最近的alert日志。num表示显示的行数;-f跟踪alert日志;只
能使用于单ADR home模式下。
-term 在终端显示alert日志信息,若不指定该参数,则使用默认编辑器打开。
-file alert_file_name 打开指定的在ADR之外的告警文件,必须指定完整路径及文件名,并
且不能使用-tail选项。

predicate_string可以使用的字段:

字段 类型
ORIGINATING_TIMESTAMP timestamp
NORMALIZED_TIMESTAMP timestamp
ORGANIZATION_ID text(65)
COMPONENT_ID text(65)
HOST_ID text(65)
HOST_ADDRESS text(17)
MESSAGE_TYPE number
MESSAGE_LEVEL number
MESSAGE_ID text(65)
MESSAGE_GROUP text(65)
CLIENT_ID text(65)
MODULE_ID text(65)
PROCESS_ID text(33)
THREAD_ID text(65)
USER_ID text(65)
INSTANCE_ID text(65)
DETAILED_LOCATION text(161)
UPSTREAM_COMP_ID text(101)
DOWNSTREAM_COMP_ID text(101)
EXECUTION_CONTEXT_ID text(101)
EXECUTION_CONTEXT_SEQUENCE number
ERROR_INSTANCE_ID number
ERROR_INSTANCE_SEQUENCE number
MESSAGE_TEXT text(2049)
MESSAGE_ARGUMENTS text(129)
SUPPLEMENTAL_ATTRIBUTES text(129)
SUPPLEMENTAL_DETAILS text(129)
PROBLEM_KEY text(65)

例子:
使用默认编辑器显示alert日志
Show alert
在终端显示alert日志
Show alert –term
有条件的显示alert日志
show alert -p “message_text like ‘%incident%’”
显示alert日志后20行信息并跟踪日志
Show alert –tail 20 –f
多ADR home下显示alert日志

adrci> show alert

Choose the alert log from the following homes to view:

1: diag/rdbms/orcl/orcl
2: diag/tnslsnr/O11g/listener
Q: to quit

Please select option:

选择需要输出的日志。
SHOW BASE
用途:
显示当前ADR 基目录。
语法描述:
show base [-product product_name]
-product选项表示选择产品,目前支持的产品有CLIENT和ADRCI。
例子:

adrci> show base
ADR base is "/oracle"

adrci> show base -product client
ADR base is "/oracle"

SHOW CONTROL
用途:
显示ADR的各种属性,包括下列的ADR清除属性。
SHORTP_POLICY:Trace files、Core dump files、 Packageing information的生存周期,单位是小时;
LONGP_POLICY:Incident information、Incident dumps、Alert logs的生存周期,单位是小时;语法描述:
Show control
例子:

adrci> show control

ADR Home = /oracle/diag/rdbms/orcl/orcl:
*************************************************************************
ADRID                SHORTP_POLICY        LONGP_POLICY         LAST_MOD_TIME                            LAST_AUTOPRG_TIME                        LAST_MANUPRG_TIME                        ADRDIR_VERSION       ADRSCHM_VERSION      ADRSCHMV_SUMMARY     ADRALERT_VERSION     CREATE_TIME                              
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ---------------------------------------- 
1335663986           720                  8760                 2015-04-07 12:08:42.693423 +08:00                                                 2015-04-07 14:49:49.783035 +08:00        1                    2                    80                   1                    2015-04-07 12:08:42.693423 +08:00       
1 rows fetched

注:此命令使用前需要设置ADR Home。
SHOW HM_RUN
用途:
显示Health Monitor运行信息。
语法描述:
show hm_run [-p “predicate_string”]
predicate_string为条件字段,其中能使用的字段如下表:

字段 类型
RUN_ID number
RUN_NAME text(31)
CHECK_NAME text(31)
NAME_ID number
MODE number
START_TIME timestamp
RESUME_TIME timestamp
END_TIME timestamp
MODIFIED_TIME timestamp
TIMEOUT number
FLAGS number
STATUS number
SRC_INCIDENT_ID number
NUM_INCIDENTS number
ERR_NUMBER number
REPORT_FILE bfile

例子:

show hm_run
show hm_run -p "run_id=123"

SHOW HOMES | HOME | HOMEPATH
用途:
显示ADR HOME的值;
语法描述:
Show homes|home|homepath
例子:

adrci> show homes
ADR Homes: 
diag/rdbms/orcl/orcl
diag/tnslsnr/O11g/listener

adrci> show home
ADR Homes: 
diag/rdbms/orcl/orcl
diag/tnslsnr/O11g/listener

adrci> show homepath
ADR Homes: 
diag/rdbms/orcl/orcl
diag/tnslsnr/O11g/listener
SHOW INCDIR

用途:
显示指定事件的trace文件;
语法描述:
show incdir [id | id_low id_high] 可以对一个或一个范围内的ID号进行查询

例子:

adrci> show incdir

ADR Home = /oracle/diag/rdbms/orcl/orcl:
*************************************************************************
diag/rdbms/orcl/orcl/incident/incdir_6177/orcl_cjq0_24028_i6177.trc
diag/rdbms/orcl/orcl/incident/incdir_6179/orcl_cjq0_24028_i6179.trc
diag/rdbms/orcl/orcl/incident/incdir_6153/orcl_ora_24092_i6153.trc
diag/rdbms/orcl/orcl/incident/incdir_6178/orcl_cjq0_24028_i6178.trc
diag/rdbms/orcl/orcl/incident/incdir_6180/orcl_cjq0_24028_i6180.trc

ADR Home = /oracle/diag/tnslsnr/O11g/listener:


adrci> show incdir 6177 6180

ADR Home = /oracle/diag/rdbms/orcl/orcl:
*************************************************************************
diag/rdbms/orcl/orcl/incident/incdir_6177/orcl_cjq0_24028_i6177.trc
diag/rdbms/orcl/orcl/incident/incdir_6179/orcl_cjq0_24028_i6179.trc
diag/rdbms/orcl/orcl/incident/incdir_6178/orcl_cjq0_24028_i6178.trc
diag/rdbms/orcl/orcl/incident/incdir_6180/orcl_cjq0_24028_i6180.trc

ADR Home = /oracle/diag/tnslsnr/O11g/listener:
*************************************************************************

SHOW INCIDENT
用途:
列表显示当前ADR HOME下所有相关事件,包括打开和关闭的。
语法描述:

show incident [-p "predicate_string"] [-mode {BASIC|BRIEF|DETAIL}]                 [-orderby field1, field2, ... [ASC|DSC]]

-orderby field1, field2, … [ASC|DSC] 对输出结果进行排序 ASC升序 DSC降序
-mode {BASIC|BRIEF|DETAIL} 选择事件输出格式,默认为basic;
BASIC模式下只显示INCIDENT_ID, PROBLEM_ID, and CREATE_TIME;
BRIEF模式下显示所有事件的相关信息,包括的选项如下表:
DETAIL模式下显示所有事件的所有信息。
-p “predicate_string” 筛选满足条件的事件,predicate可以使用的项目如下表:
BRIEF模式下显示的项目及predicate可以使用的项目:

项目 类型 描述
INCIDENT_ID number ID of the incident
PROBLEM_ID number ID of the problem to which the incident belongs
CREATE_TIME timestamp Time when the incident was created
CLOSE_TIME timestamp Time when the incident was closed
STATUS number Status of this incident
FLAGS number Flags for internal use
FLOOD_CONTROLLED number (decoded to a text status by ADRCI) Encodes the flood control status for the incident
ERROR_FACILITY text(10) Error facility for the error that caused the incident
ERROR_NUMBER number Error number for the error that caused the incident
ERROR_ARG1 text(64) First argument for the error that caused the incidentError arguments provide additional information about the error, such as the code location that issued the error.
ERROR_ARG2 text(64) Second argument for the error that caused the incident
ERROR_ARG3 text(64) Third argument for the error that caused the incident
ERROR_ARG4 text(64) Fourth argument for the error that caused the incident
ERROR_ARG5 text(64) Fifth argument for the error that caused the incident
ERROR_ARG6 text(64) Sixth argument for the error that caused the incident
ERROR_ARG7 text(64) Seventh argument for the error that caused the incident
ERROR_ARG8 text(64) Eighth argument for the error that caused the incident
SIGNALLING_COMPONENT text(64) Component that signaled the error that caused the incident
SIGNALLING_SUBCOMPONENT text(64) Subcomponent that signaled the error that caused the incident
SUSPECT_COMPONENT text(64) Component that has been automatically identified as possibly causing the incident
SUSPECT_SUBCOMPONENT text(64) Subcomponent that has been automatically identified as possibly causing the incident
ECID text(64) Execution Context ID
IMPACT number Encodes the impact of the incident
ERROR_ARG9 text(64) Ninth argument for the error that caused the incident
ERROR_ARG10 text(64) Tenth argument for the error that caused the incident
ERROR_ARG11 text(64) Eleventh argument for the error that caused the incident
ERROR_ARG12 text(64) Twelfth argument for the error that caused the incident

例子:

adrci> show incident

ADR Home = /oracle/diag/rdbms/orcl/orcl:
*************************************************************************
INCIDENT_ID          PROBLEM_KEY                                                 CREATE_TIME                              
-------------------- ----------------------------------------------------------- ---------------------------------------- 
6153                 ORA 4031                                                    2015-04-08 11:45:52.207000 +08:00       
6177                 ORA 4031                                                    2015-04-08 11:46:02.526000 +08:00       
6178                 ORA 4031                                                    2015-04-08 11:46:13.952000 +08:00       
6179                 ORA 4031                                                    2015-04-08 11:46:30.368000 +08:00       
6180                 ORA 4031                                                    2015-04-08 11:46:41.322000 +08:00       

ADR Home = /oracle/diag/tnslsnr/O11g/listener:
*************************************************************************
0 rows fetched


adrci> show incident -mode DETAIL -p "incident_id=6177"    

ADR Home = /oracle/diag/rdbms/orcl/orcl:
*************************************************************************

**********************************************************
INCIDENT INFO RECORD 1
**********************************************************
   INCIDENT_ID                   6177
   STATUS                        ready
   CREATE_TIME                   2015-04-08 11:46:02.526000 +08:00
   PROBLEM_ID                    1
   CLOSE_TIME                    
   FLOOD_CONTROLLED              none
   ERROR_FACILITY                ORA
   ERROR_NUMBER                  4031
   ERROR_ARG1                    400
   ERROR_ARG2                    shared pool
   ERROR_ARG3                    select max(FA#) from SYS_FBA_FA
   ERROR_ARG4                    SQLA^337fc737
   ERROR_ARG5                    opixpop:kctdef
   ERROR_ARG6                    
   ERROR_ARG7                    
   ERROR_ARG8                    
   ERROR_ARG9                    
   ERROR_ARG10                   
   ERROR_ARG11                   
   ERROR_ARG12                   
   SIGNALLING_COMPONENT          KGH
   SIGNALLING_SUBCOMPONENT       
   SUSPECT_COMPONENT             
   SUSPECT_SUBCOMPONENT          
   ECID                          
   IMPACTS                       0
   PROBLEM_KEY                   ORA 4031
   FIRST_INCIDENT                6153
   FIRSTINC_TIME                 2015-04-08 11:45:52.207000 +08:00
   LAST_INCIDENT                 6125
   LASTINC_TIME                  2015-04-08 11:50:56.201000 +08:00
   IMPACT1                       34668547
   IMPACT2                       34668546
   IMPACT3                       0
   IMPACT4                       0
   KEY_NAME                      Client ProcId
   KEY_VALUE                     [email protected]_140219277530880
   KEY_NAME                      PQ
   KEY_VALUE                     (0, 1428464739)
   KEY_NAME                      ProcId
   KEY_VALUE                     22.2
   KEY_NAME                      SID
   KEY_VALUE                     23.3
   OWNER_ID                      1
   INCIDENT_FILE                 /oracle/diag/rdbms/orcl/orcl/trace/orcl_cjq0_24028.trc
   OWNER_ID                      1
   INCIDENT_FILE                 /oracle/diag/rdbms/orcl/orcl/incident/incdir_6177/orcl_cjq0_24028_i6177.trc

ADR Home = /oracle/diag/tnslsnr/O11g/listener:
*************************************************************************
0 rows fetched

SHOW PROBLEM
用途:
显示当前ADR HOME下problem的信息。
语法描述:

show problem [-p "predicate_string"] [-last num | -all]
[-orderby field1, field2, ... [ASC|DSC]]

-last num | -all 显示最后num个problem或显示全部的problem,默认情况下显示的
problem数目为最近50条。
-orderby field1, field2, … [ASC|DSC] 对输出结果进行排序 ASC升序 DSC降序。
-p “predicate_string” 根据predicate_string筛选满足条件的problem信息,predicate_string(必须使用双引号)可用字段如下表:

字段 类型 描述
PROBLEM_ID number ID of the problem
PROBLEM_KEY text(550) Problem key for the problem
FIRST_INCIDENT number Incident ID of the first incident for the problem
FIRSTINC_TIME timestamp Creation time of the first incident for the problem
LAST_INCIDENT number Incident ID of the last incident for the problem
LASTINC_TIME timestamp Creation time of the last incident for the problem
IMPACT1 number Encodes an impact of this problem
IMPACT2 number Encodes an impact of this problem
IMPACT3 number Encodes an impact of this problem
IMPACT4 number Encodes an impact of this problem
SERVICE_REQUEST text(64) Service request for the problem (entered through Support Workbench)
BUG_NUMBER text(64) Bug number for the problem (entered through Support Workbench)

例子:

show problem -all
show problem -p "problem_id=4"

SHOW REPORT
用途:
显示指定类型,指定名称的报告。目前报告的类型只支持HM_RUN,输出为XML格式。
语法描述:
show report report_type run_name
该命令使用前需要指定ADR HOME;
例子:

adrci> show report hm_run run_dict1


    HM Report: run_dict1
    
        Dictionary Integrity Check
        1
        run_dict1
        MANUAL
        COMPLETED
        0
        0
        0
        2015-04-08 15:07:48.595949 +08:00
        2015-04-08 15:07:55.512115 +08:00
    
    
        TABLE_NAME=ALL_CORE_TABLES
        CHECK_MASK=ALL
    
    
        
            Dictionary Inconsistency
            2
            FAILURE
            OPEN
            CRITICAL
            0
            2015-04-08 15:07:49.990878 +08:00
            SQL dictionary health check: file$ pk 42 on object FILE$ failed
            Damaged rowid is AAAAARAABAAAADpAAE - description: No further damage description available
        
    

SHOW TRACEFILE
用途:
列表显示trace文件。
语法描述:

show tracefile [file1 file2 ...] [-rt | -t]
  [-i inc1 inc2 ...] [-path path1 path2 ...] 

file1 file2 … 对结果进行筛选,可使用%做通配符;
-rt | -t 根据时间戳对文件名进行排序,-t表示升序,-rt则相反;
-i inc1 inc2 … 显示指定incident id的trace文件;
-path path1 path2 … 显示指定目录下的trace文件;
例子:

adrci> show tracefile
adrci> show tracefile %mmon% -rt
   08-APR-15 15:17:20  diag/rdbms/orcl/orcl/trace/orcl_mmon_24002.trc
   08-APR-15 11:32:38  diag/rdbms/orcl/orcl/trace/orcl_mmon_23538.trc
   08-APR-15 11:02:10  diag/rdbms/orcl/orcl/trace/orcl_mmon_23410.trc
   08-APR-15 10:52:06  diag/rdbms/orcl/orcl/trace/orcl_mmon_7654.trc
   07-APR-15 12:12:31  diag/rdbms/orcl/orcl/trace/orcl_mmon_7525.trc

adrci> show tracefile %ora%
     diag/rdbms/orcl/orcl/incident/incdir_6153/orcl_ora_24092_i6153.trc
     diag/rdbms/orcl/orcl/trace/orcl_ora_7622.trc
     diag/rdbms/orcl/orcl/trace/orcl_ora_7661.trc

SPOOL
用途:
将ADRCI内容输出到一个文件中。
语法描述:
SPOOL filename [[APPEND] | [OFF]]

APPEND 向指定文件中追加信息;
OFF 关闭输出。
例子:
输出到myfile文件中:
spool myfile
追加到myfile.ado文件中:
spool myfile.ado append
关闭spool:
spool off

IPS
IPS全称Incident Packaging Service,事件打包服务。IPS命令提供选项创建事件逻辑包,然后添加诊断数据到包,生成物理包发送给Oracle Support。
IPS ADD
用途:
将事件添加到包。
语法描述:
ips add {incident first [n] | incident inc_id | incident last [n] |
problem first [n] | problem prob_id | problem last [n] |
problemkey pr_key | seconds secs | time start_time to end_time}
package package_id

incident first [n] 将最近N个incident添加到包,若不指定n,表示最近1个;
incident inc_id 将指定的incident添加到包;
incident last [n] 将最后N个incident添加到包,若不指定n,表示最近1个;
problem first [n] 将最近N个problem添加到包,若不指定n,表示最近1个;
problem prob_id 将指定的problem添加到包;
problem last [n] 将最后N个problem添加到包,若不指定n,表示最近1个;
problemkey pr_key 添加incident 的problem 键;
seconds secs 将距离现在secs秒内的incident添加至包;
time start_time to end_time 添加时间段内的incident到包,时间的格式为:YYYY-MM-YY
HH24:MI:SS.FF TZR
package package_id 指定incident添加到哪个包。

例子:
添加incident 22到 package 12中:
ips add incident 22 package 12
添加problem 6到package 2中:
Ips add probrem 6 package 2

IPS ADD FILE
用途:
向已存在的包中添加文件。
语法描述:
ips add file file_name package package_id
file_name要具有完整的路径,可以使用

例子:
ips add file /trace/orcl_ora_13579.trc package 12

IPS ADD NEW INCIDENTS
用途:
查找并添加所有问题的新事件到指定包中。
语法描述:
ips add new incidents package package_id
例子:

ips add new incidents package 12

IPS COPY IN FILE
用途:
复制外部系统文件到ADR中。
解释:想要在package中编辑文件,首先需要将文件复制到外部指定目录,编辑后重新复制到package中。
语法描述:

ips copy in file filename [to new_name][overwrite] package package_id
     [incident incid]

例子:

ips copy in file /home/nick/trace/orcl_ora_13579.trc to /trace/orcl_ora_13579.trc package 2 incident 4

IPS COPY OUT FILE
用途:
将ADR中的文件复制到外部操作系统中。
语法描述:

ips copy out file source to target [overwrite]

例子:

ips copy out file /trace/orcl_ora_13579.trc to
/home/nick/trace/orcl_ora_13579.trc

IPS CREATE PACKAGE
用途:
创建一个新的package,ADRCI会自动分配package的号码。
语法描述:
ips create package {incident first [n] | incident inc_id |
incident last [n] | problem first [n] | problem prob_id |
problem last [n] | problemkey prob_key | seconds secs |
time start_time to end_time} [correlate {basic |typical | all}]

incident first [n] 将最近N个incident添加到包,若不指定n,表示最近1个;
incident inc_id 将指定的incident添加到包;
incident last [n] 将最后N个incident添加到包,若不指定n,表示最近1个;
problem first [n] 将最近N个problem添加到包,若不指定n,表示最近1个;
problem prob_id 将指定的problem添加到包;
problem last [n] 将最后N个problem添加到包,若不指定n,表示最近1个;
problemkey pr_key 添加incident 的problem 键;
seconds secs 将距离现在secs秒内的incident添加至包;
time start_time to end_time 添加时间段内的incident到包,时间的格式为:YYYY-MM-YY
HH24:MI:SS.FF TZR
correlate {basic |typical | all } 选择包中包含相关事件的方式。分三种:
BASE incident dump,incident process trace file
TYPICAL incident dump,5分钟内的所有trace文件,
ALL incident dump,从上次到现在所有的trace文件
例子:
创建包含时间6153的包:

adrci> ips create package incident 6153
Created package 1 based on incident id 6153, correlation level typical

创建一个空的包:
adrci> ips create package
Created package 2 without any contents, correlation level typical
IPS DELETE PACKAGE
用途:
删除包以及在ADR中的内容。
语法描述:
ips delete package package_id

例子:
删除包2:

adrci> ips delete package 2
Deleted package 2

IPS FINALIZE PACKAGE
用途:
上传前完成打包。
语法描述:
ips finalize package package_id

例子:

adrci> ips finalize package 1
Finalized package 1

IPS GENERATE PACKAGE
用途:
在目标目录下创建一个物理包。
语法描述:

ips generate package package_id [in path] [complete | incremental]

path 指定目录
complete 默认模式,强制ADRCI打包所有package文件;
incremental 增量打包,仅打包与上次打包修改的和增加的文件,速度较快。
例子:

adrci> ips generate package 1 in /home/oracle/test/
Generated package 1 in file /home/oracle/test/ORA4031_20150408165324_COM_1.zip, mode complete

IPS GET MANIFEST
用途:
提取package 压缩包中的清单并显示。
语法描述:
ips get manifest from file filename

例子:

adrci> ips get manifest from file /home/oracle/test/ORA4031_20150408165324_COM_1.zip
IPS manifest from file /home/oracle/test/ORA4031_20150408165324_COM_1.zip
----------------------------------------------------------


    Manifest for package 1
    
        1
        2015-04-08 16:53:24.796250 +08:00
        2015-04-08 17:29:42.538296 +08:00
        1
        Complete
        Generating
        Flags: (No flags set)
        1
        6153
        Typical
    
    
        1
…………
IPS GET METADATA 
用途:
从包文件中抽取ADR相关的元数据并显示出来。
语法描述:
ips get metadata {from file filename | from adr}
例子:
adrci> ips get metadata from file /home/oracle/test/ORA4031_20150408165324_COM_1.zip
IPS metadata from file /home/oracle/test/ORA4031_20150408165324_COM_1.zip:
----------------------------------------------------------


    1
    ORA4031_20150408165324
    Complete
    1
    1
    2015-04-08 17:29:42.538296 +08:00
    /oracle
    /oracle/diag/rdbms/orcl/orcl
    rdbms
    orcl
    orcl
    
    
    1


----------------------------------------------------------
adrci>

IPS PACK
用途:
创建一个package并立即生成一个物理包。
语法描述:

ips pack [incident first [n] | incident inc_id | incident last [n] | 
     problem first [n] | problem prob_id | problem last [n] | 
     problemkey prob_key | seconds secs | time start_time to end_time] 
     [correlate {basic |typical | all}] [in path]

incident first [n] 将最近N个incident添加到包,若不指定n,表示最近1个;
incident inc_id 将指定的incident添加到包;
incident last [n] 将最后N个incident添加到包,若不指定n,表示最近1个;
problem first [n] 将最近N个problem添加到包,若不指定n,表示最近1个;
problem prob_id 将指定的problem添加到包;
problem last [n] 将最后N个problem添加到包,若不指定n,表示最近1个;
problemkey pr_key 添加incident 的problem 键;
seconds secs 将距离现在secs秒内的incident添加至包;
time start_time to end_time 添加时间段内的incident到包,时间的格式为:YYYY-MM-YY
HH24:MI:SS.FF TZR
correlate {basic |typical | all } 选择包中包含相关事件的方式。分三种:
BASE incident dump,incident process trace file;
TYPICAL incident dump,5分钟内的所有trace文件;
ALL incident dump,从上次到现在所有的trace文件。
In path 指定物理包所在目录。

例子:

adrci> ips pack incident 6177 in /home/oracle/test
Generated package 5 in file /home/oracle/test/ORA4031_20150408174920_COM_1.zip, mode complete

IPS REMOVE
用途:
从已有的package中清除incident,problem,problemkey。
语法描述:

ips remove {incident inc_id | problem prob_id | problemkey prob_key} 
     package package_id

例子:

adrci> ips remove incident 6177 package 1;
Removed incident 6177 from package 1

IPS REMOVE FILE
用途:
从已有的package中清除文件。
语法描述:

ips remove file file_name package package_id

例子:

adrci> ips remove file /trace/ orcl_cjq0_24028_i6177.trc package 1;
Removed file  /trace/ orcl_cjq0_24028_i6177.trc from package 1

IPS SET CONFIGURATION
用途:
修改IPS配置参数的值。
语法描述:

ips set configuration {parameter_id | parameter_name} value

查看IPS参数的id及name,请使用ips show configuration命令。
例子:

adrci>  ips set configuration 3 10
Set parameter 3 to value 10

IPS SHOW CONFIGURATION
用途:
列表显示IPS配置参数以及他的值。
语法描述:
ips show configuration {parameter_id | parameter_name}]
每个配置参数有一下属性:
· Parameter ID
· Name
· Description
· Unit used by parameter (such as days or hours)
· Value
· Default value
· Minimum Value
· Maximum Value
· Flags

例子:

adrci> ips show configuration
PARAMETER INFORMATION:
   PARAMETER_ID           1
   NAME                   CUTOFF_TIME
   DESCRIPTION            Maximum age for an incident to be considered for inclusion
   UNIT                   Days
   VALUE                  90
   DEFAULT_VALUE          90
   MINIMUM                1
   MAXIMUM                4294967295
   FLAGS                  0

PARAMETER INFORMATION:
   PARAMETER_ID           2
   NAME                   NUM_EARLY_INCIDENTS
   DESCRIPTION            How many incidents to get in the early part of the range
   UNIT                   Number
   VALUE                  3
   DEFAULT_VALUE          3
   MINIMUM                1
   MAXIMUM                4294967295
   FLAGS                  0

…….

adrci> ips show configuration 3
PARAMETER INFORMATION:
   PARAMETER_ID           3
   NAME                   NUM_LATE_INCIDENTS
   DESCRIPTION            How many incidents to get in the late part of the range
   UNIT                   Number
   VALUE                  10
   DEFAULT_VALUE          3
   MINIMUM                1
   MAXIMUM                4294967295
   FLAGS                  0

IPS SHOW FILES
用途:
列表显示指定package中包含的文件。
语法描述:

ips show files package package_id

例子:

adrci> ips show files package 1
   FILE_ID                1
   FILE_LOCATION          /incident/incdir_6177
   FILE_NAME              orcl_cjq0_24028_i6177.trc
   LAST_SEQUENCE          1
   EXCLUDE                Explicitly excluded

   FILE_ID                2
   FILE_LOCATION          /incident/incdir_6177
   FILE_NAME              orcl_cjq0_24028_i6177.trm
   LAST_SEQUENCE          1
   EXCLUDE                Explicitly excluded

   FILE_ID                3
   FILE_LOCATION          /trace
   FILE_NAME              orcl_cjq0_24028.trc
   LAST_SEQUENCE          1
   EXCLUDE                Included

…….

IPS SHOW INCIDENTS
用途:
列表显示指定package中的incident。
语法描述:

ips show incident package package_id

例子:

adrci> ips show incidents package 1
MAIN INCIDENTS FOR PACKAGE 1:
   INCIDENT_ID            6153
   PROBLEM_ID             1
   EXCLUDE                Included

   INCIDENT_ID            6177
   PROBLEM_ID             1
   EXCLUDE                Explicitly excluded

CORRELATED INCIDENTS FOR PACKAGE 1:
   INCIDENT_ID            6178
   PROBLEM_ID             1
   EXCLUDE                Included

   INCIDENT_ID            6179
   PROBLEM_ID             1
   EXCLUDE                Included

   INCIDENT_ID            6180
   PROBLEM_ID             1
   EXCLUDE                Included

IPS SHOW PACKAGE
用途:
显示指定package的信息。
语法描述:

i`ps show package package_id {basic | brief | detail}`

basic:使用basic选项显示最基本的信息,如果未指定package id,此选项为默认选项。
brief:使用brief选项显示的信息比basic多,若指定package id,此选项为默认选项。
detail:使用detail选项不仅显示package当前的信息,还包括package历史信息以及事件和
文件信息。
例子:

adrci> ips show package 1 basic
   PACKAGE_ID             1
   PACKAGE_NAME           ORA4031_20150408165324
   PACKAGE_DESCRIPTION    
   DRIVING_PROBLEM        1
   DRIVING_PROBLEM_KEY    ORA 4031
   DRIVING_INCIDENT       6153
   DRIVING_INCIDENT_TIME  2015-04-08 11:45:52.207000 +08:00
   STATUS                 Generated (4)
   CORRELATION_LEVEL      Typical (2)
   PROBLEMS               1 main problems, 1 correlated problems
   INCIDENTS              2 main incidents, 3 correlated incidents
   INCLUDED_FILES         61
adrci> ips show package 1 brief
DETAILS FOR PACKAGE 1:
   PACKAGE_ID             1
   PACKAGE_NAME           ORA4031_20150408165324
   PACKAGE_DESCRIPTION    
   DRIVING_PROBLEM        1
   DRIVING_PROBLEM_KEY    ORA 4031
   DRIVING_INCIDENT       6153
   DRIVING_INCIDENT_TIME  2015-04-08 11:45:52.207000 +08:00
   STATUS                 Generated (4)
   CORRELATION_LEVEL      Typical (2)
   PROBLEMS               1 main problems, 1 correlated problems
   INCIDENTS              2 main incidents, 3 correlated incidents
   INCLUDED_FILES         61
   SEQUENCES              Last 1, last full 1, last base 0
   UNPACKED               FALSE
   CREATE_TIME            2015-04-08 16:53:24.796250 +08:00
   UPDATE_TIME            2015-04-08 16:54:03.286728 +08:00
   BEGIN_TIME             N/A
   END_TIME               N/A
   FLAGS                  0

IPS UNPACK FILE
用途:
解压包文件到指定目录。
语法描述:

ips unpack file file_name [into path]

例子:

ips unpack file /tmp/ORA603_20060906165316_COM_1.zip into /tmp/newadr

IPS UNPACK PACKAGE
用途:
解压缩包到指定目录。
语法描述:

IPS UNPACK PACKAGE  [INTO ]

例子:

ips unpack package IPSPKG_20061026010203 into /tmp/newadr

你可能感兴趣的:(Oracle,Oracle,ADRCI,告警日志)