adrci命令怎么用


这篇文章给大家分享的是有关adrci命令怎么用的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
在oracle11g中,dump file的目录已经有所改变,bdump和udump整合到trace中,cdump独立出一个。
oracle新增了一个ADRCI(Automatic Diagnostic Repository Command Interpreter)的工具
统一管理ASM实例和多个数据库实例的alert文件、后台trace文件、用户trace文件,dump文件等等。
而且这个工具可以快速查询错误相关的所有trace文件,并将这些文件打包到一个zip文件,以便将问题
相关的信息提供给Oracle的技术支持。

二、查看文件
1)进入、退出adrci
–显示帮助
[root@oratest ~]# su – oracle
[oracle@oratest ~]$ which adrci
~/bin/adrci

[oracle@oratest trace]$ adrci
ADRCI: Release 11.2.0.3.0 – Production on Wed Dec 23 10:30:26 2015
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>

–设定一下adrci的主目录:
adrci> show home —若非我们想要的目录,可以指定 set home diag/rdbms/tinadb/tinadb
ADR Homes:
diag/rdbms/tinadb/tinadb

–退出ADRCI:
adrci>>exit或者quit 回车

–备注
1.在adrci中命令大小写不敏感 但使用搜索串的时候是敏感的,比如:show tracefile %mmon%

2.在adrci中不能使用退格(backspace)怎么办
跟sqlplus一样,有下面几种选择:
用del键;
使用Ctrl+backspace;
使用Ctrl+u删除整行(bash下);
在os命令行下stty erase ^h (可以直接写到oracle的.profile/.bash_profile下面)

2)查看alert日志
1.show alert -tail (默认是10条条目)
2.show alert -tail -f(类似tail -f alertlog一样)
3.show alert
4.show alert -p “MESSAGE_TEXT like ‘%ORA-%'”
更多可见 help show alert
注意,show alert的起始点是在control中设置的保留时间之后的日志,或者说是purge之后的日志,之前的日志无法显示。

举例:
adrci> show alert -tail -f
2015-12-23 08:35:13.712000 +08:00
Current log# 2 seq# 191 mem# 0: /u01/oradata/tinadb/redo02.log
Archived Log entry 296 added for thread 1 sequence 190 ID 0x637eb2fb dest 1:
2015-12-23 08:50:18.242000 +08:00
Thread 1 advanced to log sequence 192 (LGWR switch)
Current log# 3 seq# 192 mem# 0: /u01/oradata/tinadb/redo03.log
Archived Log entry 297 added for thread 1 sequence 191 ID 0x637eb2fb dest 1:
2015-12-23 09:05:17.755000 +08:00
Thread 1 advanced to log sequence 193 (LGWR switch)
Current log# 1 seq# 193 mem# 0: /u01/oradata/tinadb/redo01.log
Archived Log entry 298 added for thread 1 sequence 192 ID 0x637eb2fb dest 1:
2015-12-23 09:20:20.346000 +08:00
Thread 1 advanced to log sequence 194 (LGWR switch)
Current log# 2 seq# 194 mem# 0: /u01/oradata/tinadb/redo02.log
Archived Log entry 299 added for thread 1 sequence 193 ID 0x637eb2fb dest 1:

3)查看control
adrci> show control
ADR Home = /u01/diag/rdbms/tinadb/tinadb:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
——————– ——————– ——————– —————————————- —————————————- —————————————- ——————– ——————– ——————– ——————– —————————————-
2092229604 720 8760 2015-12-09 17:41:58.349021 +08:00 2015-12-23 10:05:32.222256 +08:00 1 2 80 1 2015-12-09 17:41:58.349021 +08:00
1 rows fetched
关于control的设置,除了默认的SHORTP_POLICY为720小时,LONGP_POLICY为8760小时外,我们可以修改这2个时间:

adrci> set control (SHORTP_POLICY = 360)
adrci> set control (LONGP_POLICY = 2160)
adrci> show control
ADR Home = /u01/diag/rdbms/tinadb/tinadb:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
——————– ——————– ——————– —————————————- —————————————- —————————————- ——————– ——————– ——————– ——————– —————————————-
2092229604 360 2160 2015-12-09 17:41:58.349021 +08:00 2015-12-23 10:05:32.222256 +08:00 1 2 80 1 2015-12-09 17:41:58.349021 +08:00

这样就改成了tracefiles保留360小时,即15天,incident file保留2160小时,即90天。
上述就是oracle自己保留日志的期限,我们也可以通过purge这个命令来手工的清空。

4)快速定位tracefile
(1)列出所有跟踪文件: show tracefile
(2)模糊查询跟踪文件,比如某个进程的,注意这里区分大小写 show tracefile %mmon%
(3)可以指定某个路径 show tracefile %mmon% -path /home/steve/temp
(4)按时间排序 show tracefile -rt

举例:
adrci> show tracefile %mmon%
diag/rdbms/tinadb/tinadb/trace/tinadb_mmon_7202.trc
diag/rdbms/tinadb/tinadb/trace/tinadb_mmon_21083.trc
diag/rdbms/tinadb/tinadb/trace/tinadb_mmon_8320.trc
diag/rdbms/tinadb/tinadb/trace/tinadb_mmon_4137.trc

三、定位incident和problem
常用:
show incident
show incident -mode detail -p “incident_id=1”
show problem
show problem -p “problem_id=2”
更多信息见help show incident或help show problem。

举例:
adrci> show incident
ADR Home = /u01/diag/rdbms/tinadb/tinadb:
*************************************************************************
INCIDENT_ID PROBLEM_KEY CREATE_TIME
——————– ———————————————————– —————————————-
53353 ORA 600 [krbnpdf_wrngdbid_3] 2015-12-17 10:09:33.291000 +08:00
53354 ORA 600 [krbnbeg_norestart] 2015-12-17 10:24:52.395000 +08:00
53355 ORA 600 [krbnpdf_nonid] 2015-12-17 10:28:17.766000 +08:00
53417 ORA 600 [krbnbeg_norestart] 2015-12-17 10:32:58.256000 +08:00
53418 ORA 600 [krbnpdf_nonid] 2015-12-17 10:34:22.881000 +08:00
5 rows fetched

adrci> show problem
ADR Home = /u01/diag/rdbms/tinadb/tinadb:
*************************************************************************
PROBLEM_ID PROBLEM_KEY LAST_INCI免费云主机域名DENT LASTINC_TIME
——————– ———————————————————– ——————– —————————————-
1 ORA 600 [krbnpdf_wrngdbid_3] 53353 2015-12-17 10:09:33.291000 +08:00
2 ORA 600 [krbnbeg_norestart] 53417 2015-12-17 10:32:58.256000 +08:00
3 ORA 600 [krbnpdf_nonid] 53418 2015-12-17 10:34:22.881000 +08:00
3 rows fetched

我们看到有5个incident和3个problem
problem指的是大的问题,叫criticial error, 一个大问题会由很多小的incidents所导致。所以他们是1:n的关系.

查看细节:
adrci> show incident -mode detail -p “incident_id=53353”
ADR Home = /u01/diag/rdbms/tinadb/tinadb:
*************************************************************************

**********************************************************
INCIDENT INFO RECORD 1
**********************************************************
INCIDENT_ID 53353
STATUS ready
CREATE_TIME 2015-12-17 10:09:33.291000 +08:00
PROBLEM_ID 1
CLOSE_TIME
FLOOD_CONTROLLED none
ERROR_FACILITY ORA
ERROR_NUMBER 600
ERROR_ARG1 krbnpdf_wrngdbid_3
ERROR_ARG2 /u01/oradata/tinadb/system01.dbf
ERROR_ARG3 1669126943
ERROR_ARG4 1668473151
ERROR_ARG5 1669126943
ERROR_ARG6

四、ips打包
将相关的incident的文件打包给oracle,上传到SR上。我们这里用到一个IPS(incident package service)服务。
我们先创建一个逻辑的package,有以下几种方式:

1.什么参数都不带,表示以默认的level typical, 里面无任何内容。
adrci> ips create package
Created package 1 without any contents, correlation level typical

2.加incident参数,指明某个incident。默认level还是typical。
adrci> ips create package incident 53353
Created package 2 based on incident id 53353, correlation level typical

3.加incident参数,指定某个incident,设置level为all。
adrci> ips create package incident 53354 correlate all
Created package 3 based on incident id 53354, correlation level al

4.加problem参数,指定某个problem。默认level还是typical。
adrci> ips create package problem 2
Created package 4 based on problem id 2, correlation level typical

5.加problem参数,指定某个problem,设置level为basic。
adrci> ips create package problem 1 correlate basic
Created package 5 based on problem id 1, correlation level basic

6.加time参数,设置开始时间to结束时间,后面的+8:00表示东八区。
adrci> ips create package time ‘2015-12-22 00:00:00’ to ‘2015-12-23 00:00:00’
Created package 6 based on time range 2015-12-22 00:00:00.000000 +08:00 to 2015-12-23 00:00:00.000000 +08:00, correlation level typical

还可以追加文件到PACKAGE 3:
adrci> ips add new incidents package 3
Added new incidents to package 3
adrci> ips add problem 12 package 3
Added problem 12 to package 3

五、将包放到实际的物理位置
adrci> ips generate package 3
Generated package 3 in file /u01/diag/rdbms/tinadb/tinadb/trace/ORA600krb_20151223104459_COM_1.zip, mode complete

自定义路径,加in参数即可:
adrci> ips GENERATE PACKAGE 3 in /tmp
Generated package 3 in file /tmp/ORA600krb_20151223104459_COM_2.zip, mode complete

注意:ips的调用和perl有关。需要预先在os安装 yum install -y perl 否则这里会报错

有了这个zip包,我们可以直接发送给oracle技术支持了。

六、解压
最后简单介绍一下UNPACK命令,这个命令可以将得到的zip文件解压到指定目录:

adrci> ips get metadata from file /tmp/ORA600krb_20151223104459_COM_2.zip
IPS metadata from file /tmp/ORA600krb_20151223104459_COM_2.zip:
———————————————————-
3 ORA600krb_20151223104459 Complete
2
2
2015-12-23 11:33:51.703402 +08:00
/u01
/u01/diag/rdbms/tinadb/tinadb rdbms tinadb tinadb


1

———————————————————-
adrci> ips unpack file /tmp/ORA600krb_20151223104459_COM_2.zip into /tmp
Unpacking file /tmp/ORA600krb_20151223104459_COM_2.zip into target /tmp

七、清除purge
(1)清除incident,我们可以用purge命令:
adrci> purge -age 2

(2)清除problem,我们可以用delete命令:
adrci> delete from problem where problem_id=1

(3)清除trace
adrci> purge -age 1440 -type trace –可以删除24h以前的trace

八、命令行执行adrci命令
[oracle@oratest ~]$ adrci exec=”show homes;echo ‘20070712’;echo ”;show base; “感谢各位的阅读!关于“adrci命令怎么用”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

相关推荐: 怎么用Oracle修复ORA-01578和ORA-26040错误

这篇文章主要介绍“怎么用Oracle修复ORA-01578和ORA-26040错误”,在日常操作中,相信很多人在怎么用Oracle修复ORA-01578和ORA-26040错误问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么用…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 01/14 11:19
下一篇 01/14 11:19