ADRCI工具是Oracle11g才推出的新工具,主要用来管理alert文件、trace文件、dump文件、健康监事报告等。
这一篇简单介绍ADRCI工具。
用过11g的人都会发现,11g中alert文件以及trace文件的存放位置都发生了变化。从原来的ORACLE_BASE/admin/INSTANCE_NAME目录变成了ORACLE_BASE/diag/rdbms/DBNAME/INSTANCE_NAME目录。
Oracle之所以修改了这个跨越多个版本都没有修改过的参数设置,就是因为Oracle在11g中推出了ADRCI。这个工具可以统一管理ASM实例和多个数据库实例的alert文件、后台trace文件、用户trace文件,dump文件等等。
而且这个工具可以快速查询错误相关的所有trace文件,并将这些文件打包到一个zip文件,以便将问题相关的信息提供给Oracle的技术支持。
看一下ADRCI工具的简单命令:
C:Documents and Settingsytk>adrci
ADRCI: Release 11.1.0.6.0 - Beta on 星期日 3月 29 21:23:57 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
ADR base = "e: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
HELP列出了ADRCI工具的所有命令,还可以通过HELP加个别命令的方式来列出这个命令的具体语法,比如:
adrci> HELP IPS
HELP IPS [topic]
Available Topics:
ADD
ADD FILE
ADD NEW INCIDENTS
CHECK REMOTE KEYS
COPY IN FILE
COPY OUT FILE
CREATE PACKAGE
DELETE PACKAGE
FINALIZE PACKAGE
GENERATE PACKAGE
GET MANIFEST
GET METADATA
GET REMOTE KEYS
PACK
REMOVE
REMOVE FILE
SET CONFIGURATION
SHOW CONFIGURATION
SHOW FILES
SHOW INCIDENTS
UNPACK FILE
USE REMOTE KEYS
adrci> HELP IPS ADD
Usage: IPS ADD
[INCIDENT <incid> | PROBLEM <prob_id> | PROBLEMKEY <prob_key> |
SECONDS <seconds> | TIME <start_time> TO <end_time>]
PACKAGE <package_id>
Purpose: Add incidents to an existing package.
Arguments:
<incid>: ID of incident to add to package contents.
<prob_id>: ID of problem to add to package contents.
<prob_key>: Problem key to add to package contents.
<seconds>: Number of seconds before now for adding package contents .
<start_time>: Start of time range to look for incidents in.
<end_time>: End of time range to look for incidents in.
Example:
ips add incident 22 package 12
adrci> HELP SHOW PROBLEM
Usage: SHOW PROBLEM [-p <predicate_string>]
[-last <num> | -all]
[-orderby (field1, field2, ...) [ASC|DSC]]
Purpose: Show the problem information. By default, this command will
only show the last 50 problems.
Options:
[-p <predicate_string>]: The predicate string must be double-quoted.
The field names that users can specify in the predicate are:
PROBLEM_ID number
PROBLEM_KEY text(550)
FIRST_INCIDENT number
FIRSTINC_TIME timestamp
LAST_INCIDENT number
LASTINC_TIME timestamp
IMPACT1 number
IMPACT2 number
IMPACT3 number
IMPACT4 number
SERVICE_REQUEST text(64)
BUG_NUMBER text(64)
[-last <num> | -all]: This option allows users to either select
the last <num> of qualified problems to show or to show all the
qualified problems. 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 "PROBLEM" relation.
Examples:
show problem
show problem -p "problem_id>123"
下面是查询数据库中错误的几个小例子:
adrci> show base
ADR base is "e:oracle"
adrci> show home
ADR Homes:
diagclientsuser_systemhost_3414944083_11
diagclientsuser_unknownhost_3414944083_11
diagclientsuser_unknownhost_411310321_11
diagclientsuser_ytkhost_3414944083_11
diagrdbmsytk1110ytk1110
diagtnslsnrytk-thinkpadlistener
adrci> set home diagrdbmsytk1110ytk1110
adrci> show alert -tail 5
2009-02-25 22:51:17.640000 +08:00
Completed: alter database open
2009-02-25 22:55:26.171000 +08:00
Starting background process CJQ0
CJQ0 started with pid=7, OS id=14428
2009-02-25 22:55:49.796000 +08:00
Errors in file e:oraclediagrdbmsytk1110ytk1110traceytk1110_j008_15220.trc
:
ORA-12012: 自动执行作业 11689 出错
ORA-01403: 未找到任何数据
2009-02-25 23:20:39.828000 +08:00
Thread 1 advanced to log sequence 75
Current log# 3 seq# 75 mem# 0: E:ORACLEORADATAYTK111REDO03.LOG
2009-02-26 08:31:51.296000 +08:00
***********************************************************************
Fatal NI connect error 12638, connecting to:
(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
Oracle Bequeath NT Protocol Adapter for 32-bit Windows: Version 11.1.0.6.0 - Pro
duction
Time: 26-2月 -2009 08:31:51
Tracing not turned on.
Tns error struct:
ns main err code: 12638
TNS-12638: 身份证明检索失败
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
除了上面交互式的方式外,还可以调用脚本,或者指定一系列命令来批量执行命令:
C:Documents and Settingsytk>adrci -help
Syntax:
adrci [-help] [script=script_filename]
[exec = "one_command [;one_command;...]"]
Options Description (Default)
-----------------------------------------------------------------
script script file name (None)
help help on the command options (None)
exec exec a set of commands (None)
-----------------------------------------------------------------
比如:
C:Documents and Settingsytk>adrci exec="show base;show home;set home diagrdb
msytk1110ytk1110;show home"
ADR base is "e:oracle"
ADR Homes:
diagclientsuser_systemhost_3414944083_11
diagclientsuser_unknownhost_3414944083_11
diagclientsuser_unknownhost_411310321_11
diagclientsuser_ytkhost_3414944083_11
diagrdbmsytk1110ytk1110
diagtnslsnrytk-thinkpadlistener
ADR Homes:
diagrdbmsytk1110ytk1110