oracle的adr,Oracle 自动诊断信息库(Automatic Diagnostic Repository,ADR)

本文主要是介绍oracle的adr,Oracle 自动诊断信息库(Automatic Diagnostic Repository,ADR),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Oracle 11G中的ADR介绍:

ADRCI 之oracle 日志查看

在Oracle的11g版本中,alert文件的位置发生了变化,与此同时Oracle提供了一个命令行工具ADRCI,它可以很便利的查看数据库中出现的异常。 以下给大家展示一下使用ADRCI (ADR Command Interface) 在11g中查看Oracle的警告日志的方法。

1.进入到adrci命令行模式

ora11g@RHEL53 /home/oracle$ which adrci

/oracle/u01/app/oracle/product/1101/db/bin/adrci

ora11g@RHEL53 /home/oracle$ 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)

------------------------------------------------------

ora11g@RHEL53 /home/oracle$ adrci

ADRCI: Release 11.1.0.6.0 - Beta on Fri Feb 27 15:23:52 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

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

adrci>

2.使用 help show alert 命令查看帮助文档

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 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

adrci>

3.使用 show alert 列出各个目录下的日志目录,输入编号4,系统会自动调用vi编辑器查看数据库的alert日志

adrci> show alert

Choose the alert log from the following homes to view:

1: diag/tnslsnr/RHEL53/listener

2: diag/clients/user_unknown/host_411310321_11

3: diag/clients/user_oracle/host_2175824367_11

4: diag/rdbms/ora11g/ora11g

Q: to quit

Please select option:4

4.另外一种查看方式是,指定具体的 homepath 然后使用“show alert -tail 15”查看对应日志文件的后15行

adrci> show homepath

ADR Homes:

diag/tnslsnr/RHEL53/listener

diag/clients/user_unknown/host_411310321_11

diag/clients/user_oracle/host_2175824367_11

diag/rdbms/ora11g/ora11g

adrci> set homepath diag/rdbms/ora11g/ora11g

adrci> show alert -tail 15

2009-02-27 14:25:05.036000 +08:00

Starting background process SMCO

SMCO started with pid=21, OS id=3855

Starting background process FBDA

FBDA started with pid=22, OS id=3857

replication_dependency_tracking turned off (no async multimaster replication found)

2009-02-27 14:25:07.246000 +08:00

Starting background process QMNC

QMNC started with pid=23, OS id=3859

2009-02-27 14:25:17.325000 +08:00

db_recovery_file_dest_size of 4096 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.

2009-02-27 14:25:33.727000 +08:00

Completed: ALTER DATABASE OPEN

2009-02-27 14:29:59.158000 +08:00

Starting background process CJQ0

CJQ0 started with pid=25, OS id=3892

adrci>

ADR的结构和位置:

初始化参数diagnostic_dest指定了ADR的根目录。即使你忽略了该初始化参数。oracle也会创建ADR。

如果你设置了ORACLE_BASE环境变量,那么diagnostic_dest缺省值是该目录。如果你没有设置ORACLE_BASE变量,该参数值为$ORACLE_HOME/log目录。

ADR存储所有oracle产品的诊断数据。ADR为每一个oracle产品及其实例分配一个单独的home目录。因此一个ADR目录包含多个home目录。

每一个ADR的home目录是一个为每一个数据库实例或其它oracle产品或组件存储其诊断文件。其目录结构如下:

ADR_base/diag/product_type/product_id/instance_id/

比如一个 diagnostic_dest初始化参数为 /u05/app/oracle。那么一个oracle数据库的sid为prod1的home目录就如下所示:

/u05/app/oracle/diag/rdbms/prod1/prod1/

在一个ADR的home目录下有很多子目录:

alert:一个实例的告警日志文件(xml格式)。

cdump:core文件。

hm:健康检查报告。

incident:每一个事件一个子目录,其中包含所有trace dump文件。

incpkg:你创建的事件包,用于发给oracle支持所用。

ir:包含实例事件报告。

trace:存储回话trace文件。

可以通过视图v$diag_info来查询目录及其位置:

SQL> select name, value from v$diag_info;

NAME                                    VALUE

-------------------    ---------------------------

Diag Enabled            TRUE

ADR Base                /u01/app/oracle

ADR Home                /01/app/oracle/diag/rdbms/prod/prod1

Diag Trace              /u01/app/oracle/diag/rdbms/prod/prod1/trace

Diag Alert              /u01/app/oracle/diag/rdbms/ prod/prod1/alert

Diag Incident          /u01/app/oracle/diag/rdbms/prod/prod1/incident

Diag Cdump              /u01/app/oracle/diag/rdbms/ prod/prod1/cdump

Health Monitor          /u01/app/oracle/diag/rdbms/ prod/prod1/hm

Default Trace File      /u01/app/oracle/diag/rdbms/ prod/prod1/

trace/eleven_ora_9417.trc

Active Problem Count    3

Active Incident Count  8

正如你所见,视图v$diag_info中包括问题和事件数量。

比如使用如下命令查看所有ORA-错误:

adrci> set homepath diag/rdbms/rac/rac

adrci> set editor vi

adrci> show alert -p "message_text like '%ORA-%'"

ADR Home = /home/oracle/diag/rdbms/rac/rac:

*************************************************************************

Output the results to file: /tmp/alert_10191_1638_rac_1.ado

2012-03-29 20:56:12.266000 +08:00

ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...

2012-03-29 20:56:27.810000 +08:00

Errors in file /home/oracle/diag/rdbms/rac/rac/trace/rac_ora_10453.trc:

ORA-00313: ??????? 1 (???? 1) ???

ORA-00312: ???? 1 ?? 1: '/home/oracle/oradata/rac/redo01.log'

像vi编辑器一样退出后,可以在文件/tmp/alert_10191_1638_rac_1.ado中找到屏幕输出结果。便于分析,

可见这个特性和unix中的grep |ORA-  命令是大不相同,因为后者只能输出错误行,但是错误行发生的时间却不能显示,而 show alert则同时显示错误和发生时间。

5.小结

使用ADRCI命令可以很好的对各个目录中的日志文件进行集中查看,可以有效的提高工作效率。

0b1331709591d260c1c78e86d0c51c18.png

这篇关于oracle的adr,Oracle 自动诊断信息库(Automatic Diagnostic Repository,ADR)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/412790

相关文章

IDEA如何让控制台自动换行

《IDEA如何让控制台自动换行》本文介绍了如何在IDEA中设置控制台自动换行,具体步骤为:File-Settings-Editor-General-Console,然后勾选Usesoftwrapsin... 目录IDEA如何让控制台自http://www.chinasem.cn动换行操作流http://www

vscode保存代码时自动eslint格式化图文教程

《vscode保存代码时自动eslint格式化图文教程》:本文主要介绍vscode保存代码时自动eslint格式化的相关资料,包括打开设置文件并复制特定内容,文中通过代码介绍的非常详细,需要的朋友... 目录1、点击设置2、选择远程--->点击右上角打开设置3、会弹出settings.json文件,将以下内

Oracle查询优化之高效实现仅查询前10条记录的方法与实践

《Oracle查询优化之高效实现仅查询前10条记录的方法与实践》:本文主要介绍Oracle查询优化之高效实现仅查询前10条记录的相关资料,包括使用ROWNUM、ROW_NUMBER()函数、FET... 目录1. 使用 ROWNUM 查询2. 使用 ROW_NUMBER() 函数3. 使用 FETCH FI

Python脚本实现自动删除C盘临时文件夹

《Python脚本实现自动删除C盘临时文件夹》在日常使用电脑的过程中,临时文件夹往往会积累大量的无用数据,占用宝贵的磁盘空间,下面我们就来看看Python如何通过脚本实现自动删除C盘临时文件夹吧... 目录一、准备工作二、python脚本编写三、脚本解析四、运行脚本五、案例演示六、注意事项七、总结在日常使用

数据库oracle用户密码过期查询及解决方案

《数据库oracle用户密码过期查询及解决方案》:本文主要介绍如何处理ORACLE数据库用户密码过期和修改密码期限的问题,包括创建用户、赋予权限、修改密码、解锁用户和设置密码期限,文中通过代码介绍... 目录前言一、创建用户、赋予权限、修改密码、解锁用户和设置期限二、查询用户密码期限和过期后的修改1.查询用

Oracle数据库使用 listagg去重删除重复数据的方法汇总

《Oracle数据库使用listagg去重删除重复数据的方法汇总》文章介绍了在Oracle数据库中使用LISTAGG和XMLAGG函数进行字符串聚合并去重的方法,包括去重聚合、使用XML解析和CLO... 目录案例表第一种:使用wm_concat() + distinct去重聚合第二种:使用listagg,

SpringBoot项目启动后自动加载系统配置的多种实现方式

《SpringBoot项目启动后自动加载系统配置的多种实现方式》:本文主要介绍SpringBoot项目启动后自动加载系统配置的多种实现方式,并通过代码示例讲解的非常详细,对大家的学习或工作有一定的... 目录1. 使用 CommandLineRunner实现方式:2. 使用 ApplicationRunne

oracle中exists和not exists用法举例详解

《oracle中exists和notexists用法举例详解》:本文主要介绍oracle中exists和notexists用法的相关资料,EXISTS用于检测子查询是否返回任何行,而NOTE... 目录基本概念:举例语法pub_name总结 exists (sql 返回结果集为真)not exists (s

Oracle的to_date()函数详解

《Oracle的to_date()函数详解》Oracle的to_date()函数用于日期格式转换,需要注意Oracle中不区分大小写的MM和mm格式代码,应使用mi代替分钟,此外,Oracle还支持毫... 目录oracle的to_date()函数一.在使用Oracle的to_date函数来做日期转换二.日

Springboot的ThreadPoolTaskScheduler线程池轻松搞定15分钟不操作自动取消订单

《Springboot的ThreadPoolTaskScheduler线程池轻松搞定15分钟不操作自动取消订单》:本文主要介绍Springboot的ThreadPoolTaskScheduler线... 目录ThreadPoolTaskScheduler线程池实现15分钟不操作自动取消订单概要1,创建订单后