自动诊断存储库
自动诊断存储库跟踪数据库中发生的所有问题和事件。ADR 是一个基于文件的存储库,用于存储传统的诊断数据(如警报日志和跟踪文件)以及新型诊断数据(如运行状况监视器报告)。不仅数据库,而且
ASM、CRS 和其他 Oracle 产品和组件都将其所有诊断数据存储在 ADR 中。请务必了解,Oracle 产品的每个实例在 ADR 中都有自己单独的 ADR 主目录。因此,每个数据库实例都将其诊断数据存储在 ADR 中的单独目录中。例如,在具有 RAC 和 ASM 存储的环境中,每个数据库
实例和 ASM 实例在 ADR 下都有自己的主目录。有趣的是,ADR 在所有 Oracle 产品和所有实例中使用一致的诊断数据格式,从而使用户和 Oracle 支持人员能够更轻松地关联来自多个实例的诊断数据。
请注意,ADR 取代了我们多年来一直在使用的传统诊断目录,如 bdump 和 cdump 目录。传统的 *_dump_dest 初始化参数(如 bdump)仍然存在,但数据库将在新版本中忽略它们。使用新的初始化参数diagnostic_dest设置 ADR 基目录的位置,该目录是 ADR 结构的根目录。
ADR
的结构 使用新的初始化参数diagnostic_dest来设置 ADR 库的位置。diagnostic_dest参数是可选的,不是必需的,但
允许您为 ADR 的位置选择自己的选项。如果未指定 diagnostic_dest 参数的值,则数据库本身将在数据库启动时为参数设置一个值
。以下是甲骨文确定 ADR 基数的默认位置的方法:
- 如果设置ORACLE_BASE环境变量,则数据库会将diagnostic_dest参数值设置为 $ORACLE_BASE 环境变量的值。
- 如果尚未设置ORACLE_BASE环境变量,则数据库会将diagnostic_dest参数值设置为 $ORACLE_HOME/log。
区分 ADR 库(ADR 库是 ADR 的公共根目录)和 ADR 主页非常重要。前者是您在diagnostic_dest参数的帮助下设置的位置。ADR 主页表示当前数据库实例的 ADR 主页的路径。ADR 库可以包含多个 ADR 主目录,每个主目录都用作特定 Oracle 组件或产品的特定实例的根目录。每个 ADR 主页都有以下路径,从 ADR 基数开始:
诊断/product_type/product_id/instance_id
例如,对于具有相同 SID 和数据库名称 orcl2 且 ADR 基数为 /u05/app/oracle 的数据库,ADR 主页将如下所示:
/u05/app/oracle/诊断/rdbms/orcl2/orcl2
诊断数据包括警报日志内容、跟踪文件、与事件和问题相关的数据以及运行状况监视器报告。XML 格式的警报日志位于每个 ADR 主页的警报目录中。文本格式的警报日志位于 TRACE 目录中。
ADR 主目录
每个数据库实例都将其诊断数据存储在各个子目录中,其中最重要的是:
- 警报:Oracle 在此目录中以 XML 格式存储警报日志。
- hm:包含检查器运行报告,这些报告由新的运行状况监视器工具生成。
- 事件:包含实例的事件报告。
- trace:包含基于文本的报警日志,类似于传统的报警日志文件。
在 Oracle RAC 环境中,您可以在每个节点上创建一个 ADR 基,也可以在共享存储上设置一个中央 ADR 基础。在共享存储上设置基于中央 ADR 的设置使您能够查看 RAC 中所有实例的聚合诊断,此外还允许您使用功能强大的数据恢复顾问来诊断和修复数据故障。如果不使用共享存储,则无法使用数据恢复顾问。
查看替代性争议解决位置
以下是重要的 ADR 位置列表:
SQL>从 v$diag_info
中选择 * INST_ID 名称值
--------- ------------------------- ----------------------------------------
1 诊断启用 TRUE
1 ADR 基础 /u01/应用程序
1 ADR 主页 /u01/应用程序/诊断/rdbms/orcl/orcl
1 诊断跟踪 /u01/应用/诊断/rdbms/orcl/orcl/trace
1 诊断警报 /u01/应用程序/诊断/诊断/rdbms/orcl/orcl/警报
1 诊断事件 /u01/应用程序/诊断/rdbms/orcl/orcl/orcl/事件
1 诊断数 cdump /u01/应用程序/诊断/rdbms/orcl/orcl/cdump
1 运行状况监视器 /u01/应用程序/诊断/rdbms/orcl/orcl/orcl/hm
1 默认跟踪文件 /u01/应用程序/诊断/rdbms/orcl/orcl/trace/orcl_ora_11347.trc
1 活动问题计数 0
1 活动事件计数 0
11 行已选择。
Note:Default trace file Path to the session trace files (SQL trace files).
Note that there really is no environment variable named $ADR_HOME to enable the setting of the ADR home. You set the ADR home by using the set homepath command after starting the ADRCI tool.
ADRCI
The ADR Command Interpreter (ADRCI) is a brand-new command-line tool that is a key component of the new fault diagnosability infrastructure. The ADRCI tool enables you to interact with the ADR from the command line. You can do the following with the help of the ADRCI:
- View ADR diagnostic data
- Package together incident and problem data for transmission to Oracle Support using the Incident Packaging Service (IPS)
- View Health Monitor reports
All ADRCI commands work with data in the current ADR home and you can have multiple ADR homes current at any given time. Some ADR commands work with multiple ADR homes but other commands require a single ADR home to be current in order for those commands to work. The key here is the ADR homepath, which points to the directory under the ADR base. By default, the value of the homepath is null when you start ADRCI, meaning that all ADR homes under the ADR base are current. If you want to make a single ADR home the current ADR home, you must set the homepath.
Starting ADRCI
You don’t need to log into ADRCI because the ADRCI data isn’t considered secure
data and is, therefore, merely secured by operating system permissions on the
ADR directories.
$ adrci
ADRCI: Release 11.1.0.6.0 - Beta on Thu Sep 27 16:59:27 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
ADR base = "/u01/app/oracle"
To view a list of all ADRCI commands, enter help at the ADRCI prompt:
adrci> help
HELP [topic]
Available Topics:
CREATE REPORT
ECHO
.................................................................................................
SPOOL
There are other commands intended to be used directly by Oracle, type "HELP EXTENDED" to see the list
adrci> help ips create package
Usage: IPS CREATE PACKAGE
[INCIDENT <incid> | PROBLEM <prob_id> |
PROBLEMKEY <prob_key> |
SECONDS <seconds> |
TIME <start_time> TO <end_time>]
[CORRELATE BASIC | TYPICAL | ALL]
Purpose: Create a package, and optionally select contents for the package.
........................................................................
Setting the ADR Homepath
As mentioned earlier, by default, the ADR homepath is set to null when you firststart up ADRCI. This means that all ADR homes for all the instances or components you have under the ADR base are current. Here’s an example that shows this:
adrci> show homes
ADR Homes:
diag/rdbms/orcl/orcl
diag/rdbms/orcl2/orcl2
diag/rdbms/eleven/eleven
diag/rdbms/nina/nina
The ADR homepath points to multiple ADR homes. Note that the ADR homepath is shown relative to the ADR base. This means that if the ADR base is /u01/app/oracle, the absolute homepath of the database and instance which are both named orcl2, for example, would be the following:
/u01/app/oracle/diag/rdbms/orcl2/orcl2
If I want only the single ADR home for the orcl2 instance to be current, I must set the ADR homepath in the following way, by using the set homepath command.
adrci> set homepath diag/rdbms/orcl2/orcl2
Confirm the setting of the single ADR home with the following command:
adrci> show homes
ADR Homes:
diag/rdbms/orcl2/orcl2
By setting the homepath to diag/rdbms/orcl2/orcl2, only the ADR home for the instance with the SID orcl2 would be current. This means that when you execute the various commands from ADRCI now, the ADRCI will access diagnostic data from this ADR home, which pertains to just the orl2 instance.
Using ADRCI in Batch Mode
Thus far, you’ve seen how to use the ADRCI tool by invoking it from the operating system command line. However, you can also use the ADRCI tool from the batch mode, just as you do the SQL*Loader tool, for example, thus allowing you to incorporate ADRCI commands in shell scripts and Windows batch files.
Two command line parameters—exec and script—help you perform batch operations with ADRCI commands.
For example, to run the show homes command from the command line (in batch mode), you enter the following command:
$ adrci exec="show homes"
ADR Homes:
diag/rdbms/orcl/orcl
$ adrci exec="show homes;show home"
ADR Homes:
diag/rdbms/orcl/orcl
ADR Homes:
diag/rdbms/orcl/orcl
The other command-line parameter, script, helps you run ADRCI scripts.A script file can consist of any number of ADRCI commands, each separated by a semicolon or a line break. For example, the ADRCI script adrci.txt consists of the following commands:
set homepath diag/rdbms/orcl2/orcl2
show alert
In order to run the script file adrci.txt, enter the following command at the operating system command prompt:
adrci script=adrci.txt
The script shown here will run the show homes and show incident commands.
Incidents and Problems
Oracle introduces two new diagnostic concepts in Oracle Database 11g: problems and incidents. These concepts are crucial to the understanding of the new fault diagnosability infrastructure:
- Any critical error in the database is called a problem—for example, a critical error such as the one manifested by the Oracle error ORA-4031 . A problem is identified by a problem key , which is a text string that describes the problem and includes Oracle error codes.
- A single occurrence of a problem is called an incident. Multiple occurrences of the same problem lead to multiple incidents. An incident is identified by a unique incident ID.
The ADR tracks both problems and incidents in the database. When the database encounters a critical error, it displays an incident alert in the Database Home page of the Enterprise Manager. You then use either the Enterprise Manager or the command-line utility ADRCI to view the incidents and the associated problem.
Following an incident, the database adds information about the incident to the alert log and collects diagnostic data about the incident and attaches an incident ID to this data before storing it in a subdirectory it creates for this incident in the ADR.
Each incident is tagged with a problem key that relates the incident to a problem.ADR automatically creates a problem when the first incident of that problem key occurs. It removes the problem metadata after the last incident with that problem key is removed from the ADR.
ADR uses what it refers to as a flood-controlled incident system, whereby it allows only a certain number of incidents under a problem to log diagnostic data.By default, ADR allows 5 diagnostic data dumps per hour for a single problem. If an incident occurs 20 times but all the incidents are connected to the same problem,
you have to report to Oracle Support only one incident.
The set of diagnostic data pertaining to an incident or incidents relating to a problem (or problems) is called an incident package. When you ask for help from Oracle Support, it’s this incident package that they will expect.
By default, the database automatically creates incidents upon the occurrence of a critical error. You can also create incidents yourself through the new Enterprise Manager Support Workbench when you want to report problems to Oracle Support that haven’t been raising any critical errors in the database.
ADR follows a retention policy so it can limit the amount of diagnostic data it must store. The retention policy actually includes two different settings, one for metadata retention and the other for incident files and dumps retention, as explained here:
- The incident metadata retention policy, which has a default setting of one year, determines how long ADR retains the incident metadata.
- The incident files and dumps retention policy, with a default setting of one month, determines how long ADR retains the dump files generated for critical errors.
The MMON background process is in charge of automatically purging expired ADR data.Besides,You can’t disable automatic incident creation for critical errors.
An incident can be in any one of the following states at a given point in time:
- Collecting:A newly created incident is currently collecting diagnostic data.
- Ready: The incident’s data collection phase is complete, and you can package the incident to send to Oracle Support.
- Tracking:The incident must be kept in the ADR indefinitely because the DBA is currently working on it. You must manually set the incident status to this value.
- Closed:The incident is resolved and the ADR will purge it once the incident passes its retention period.
- Data-Purged:The incident metadata is still valid but the associated files have been detached from the incident.
If an incident remains in the collecting or ready state for a period that’s twice as long as its retention period, it automatically is moved to a closed state.To check an incident’s current status, use either the Support Workbench or issue the following ADRCI command:
adrci> show incident –mode detail
You can issue just the plain show incident command to get basic details about all incidents currently considered open.
Incident Packaging Service
In previous releases of the Oracle database, you had to manually gather diagnostic data from multiple sources to submit to Oracle Support when you notified them of a problem. Oracle Database 11g provides a new feature called the incident packaging service (IPS), which lets you automatically gather all diagnostic data pertaining to a critical error such as the trace files and dump files that you’re familiar with, as well
as the new health check reports, SQL test cases, and related information, and package the data into a Zip file for sending to Oracle Support. The IPS uses a critical error’s incident number to automatically identify and gather all relevant diagnostic files and adds them to the incident package. The IPS uses rules to package all dumps and traces for a given problem and lets you package them easily for sending to Oracle Support.You can use rules to gather files generated around a time period, or related to a particular client or a specific error code, for example.
You are allowed the latitude to add, delete, or remove diagnostic files before finalizing an incident package and sending it to Oracle Support. Here are some things you need to know about incident packages:
- An incident package is a logical construct that represents one or more problems. By default, the first and the last three incidents for a problem are included in an incident package. It contains just the metadata for a problem,
- The package you need to send in the form of a Zip file to Oracle Support is a physical package (Zip file) that contains all the files referenced by the metadata in the logical incident package.
- You must finalize a package before the ADRCI can generate a physical package from the initial logical package. During the “finalizing” stage, you can add other diagnostic information in the form of alert log entries, trace files, SQL test cases, and configuration information. You can finalize a package manually
- through the ADRCI utility and can remove any files you want after reviewing the finalized package.
- You can generate complete and incremental Zip files.
- Oracle employs an incident flood control mechanism, as explained earlier,to limit the amount of diagnostic data that a problem generates in the ADR.Flood control in this context means that ADRCI lets only a certain number of incidents under a given problem be dumped during a given time interval.Once a certain threshold is reached, a flood controlled incident merely generates an alert log entry but not any incident dumps. You can’t change the preset threshold levels for incident flood control. Here’s how the thresholds are determined:
- After 5 incidents relating to a certain problem in one hour, further incidents are flood controlled for that hour.
- After 25 incidents occur for any problem during one day, further incidents for that problem key are flood controlled for that day.
Packaging Incidents with ADRCI
You manage the IPS through either the new Support Workbench, which you can access from the Enterprise Manager, or through the ADRCI tool. You can create packages and upload them to Oracle Support through either means, although the Support Workbench is more intuitive. The ADRCI tool, however, makes up by providing more capabilities to manage incidents and problems in the database.
Creating a Logical Package
Before you can create a physical incident package and transmit it to Oracle Support, you must create a logical package, which the ADR stores as metadata.You can create a logical package as an empty package and add diagnostic information later on. Or, you can create a logical package based on an incident number, problem number, problem key, or a time interval. When you create a non-empty logical package, diagnostic information is automatically added to the logical package.
To create an empty package, use this command:
adrci> ips create package
Created package 4 without any contents,
correlation level typical
The package just created (Package 4) is an empty logical package. To create a nonempty logical package with diagnostic information about an incident, use the following command.
adrci> ips create package incident 17060
Created package 5 based on incident id 17060,
correlation level typical
You can also create a logical package covering all incidents between two time periods, as shown here:
adrci> ips create package time '2007-09-20 00:00:00 -12:00' to
'2007-09-30 00:00:00 -12:00'
The previous command will create a logical package that includes diagnosticinformation for all incidents that occurred between September 20 and September 30 of 2007. If you want, you can also use the following variations of the create package command:
ips create package problem:Create a package based on a problem ID.
ips create package problemkey:Create a package based on a problem key.
ips create problem seconds:Create a package that includes all incidents generated from the specified number of seconds in the past until the present time.
Adding Logical Information to a Logical Package
If you create a logical
package by using the ips create package command without specifying an incident ID, problem ID, or time range, the package will be empty and you must then add diagnostic information to the existing logical package. Here’s how you add diagnostic information for an incident to an empty logical package:
adrci> ips add incident 17060 package 4
Added incident 17060 to package 4
You can add files to an existing package by using the following command:
adrci> ips add file <file_name> package <package_number>
Note that you can add only those files that are located in the ADR directory hierarchy (under the ADR base).
Generating a Physical Incident Package
加载包含诊断数据的逻辑包后,就可以创建物理包,以便将其发送给 Oracle 支持部门。下面介绍如何创建物理事件包:
adrci> ips 在 /u01/app/oracle/diag
中生成包 4 在文件
/u01/应用/预言机/诊断/IPSPKG_20070929163401_COM_1.zip中生成包 4,模式完成
上一个命令从您之前创建的逻辑包 4 中生成一个物理包/ u01/app/oracle/支持。请注意,物理文件的文件名中包含COM_1后缀,表示它是一个完整的事件文件。您可以通过指定关键字 incremental 来创建增量物理事件包,如下所示:adrci>
ips 在 /u01/app/oracle/diag 中生成包 4 在文件
/u01/app/oracle/diag/IPSPKG_20070929163401_INC_2.zip中
生成软件包 4,模式增量
一旦您合并了所有诊断数据并准备好将物理包传输到 Oracle 支持, 您可以使用以下命令完成事件包:
adrci> ips 完成包 4
最终确定包 4
您现在可以将刚刚创建的物理包上传到 Oracle 支持。请注意,您仍然必须通过手动上传文件以老式方式发送文件。如果使用支持工作台打包事件,则可以自动传输包。
参考至:《McGraw.Hill.OCP.Oracle.Database.11g.New.Features.for.Administrators.Exam.Guide.Apr.2008》
http://docs.oracle.com/cd/E11882_01/server.112/e40540/startup.htm#CNCPT89061
本文原创,转载请注明出处、作者
如有错误,欢迎指正
、