Introduction to ADR in ORACLE 11G:
Adrci's Oracle Log view
In the 11g version of Oracle, the location of the alert file has changed, while Oracle provides a command-line tool, Adrci, that makes it easy to see the exceptions that occur in the database. Let's show you how to view Oracle's warning logs in 11g using Adrci (ADR Command Interface).
1. Go to adrci command line mode
[email protected]/home/oracle$ which Adrci
/oracle/u01/app/oracle/product/1101/db/bin/adrci
[Email protected]/home/oracle$ Adrci-help
Syntax:
Adrci [-help] [Script=script_filename]
[EXEC = "one_command [; one_command; ....]"]
Options Description (Default)
------------------------------------------------------
Script script. File name (None)
Help and Help on the command options (None)
EXEC exec a set of commands (None)
------------------------------------------------------
[Email protected]/home/oracle$ Adrci
Adrci:release 11.1.0.6.0-beta on Fri Feb 27 15:23:52 2009
Copyright (c) 1982, Oracle. All rights reserved.
ADR base = "/oracle/u01/app/oracle"
Adrci>
2. Use the Help show alert command to view the assistance document
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 is other commands intended to being used directly by Oracle, type
"Help EXTENDED" to see the list
adrci> Help Show alert
Usage:show ALERT [-P <predicate_string>] [-term]
[[-tail [num] [-f]] | [-file <alert_file_name>]]
Purpose:show alert messages.
Options:
[-P <predicate_string>]: The predicate string must be double quoted.
The fields in the predicate is 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 ten messages is displayed. If "-F" is specified, new data
Would append at the end as new alert messages is generated.
[-term]: Direct results to terminal. If This option isn't specified,
The results is being open in an editor.
By default, it would open in Emacs, but the "set editor" can be used
To set other editors.
[-file <alert_file_name>]: Allow users to specify an alert file which
May is not is in ADR. <alert_file_name> must is specified with full path.
Note that this option cannot is used with THE-TAIL option
Examples:
Show alert
Show alert-p "Message_text like '%incident% '"
Show Alert-tail 20
Adrci>
3. Use Show alert to list the log directory under each directory, enter the number 4, the system will automatically call the VI editor to view the database alert log
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. Another way to view this is to specify a specific HomePath and then use "show Alert-tail 15" To view the next 15 lines of the corresponding log file
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 would 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>
Structure and location of ADR:
The initialization parameter diagnostic_dest specifies the root directory of the ADR. Even if you omit the initialization parameter. Oracle also creates ADR.
If you set the ORACLE_BASE environment variable, then the Diagnostic_dest default value is the directory. If you do not set the Oracle_base variable, the parameter value is the $oracle_home/log directory.
ADR stores diagnostic data for all Oracle products. ADR assigns a separate home directory for each Oracle product and its instances. Therefore, an ADR directory contains multiple home directories.
Each ADR home directory is a diagnostic file that is stored for each DB instance or other Oracle product or component. Its directory structure is as follows:
Adr_base/diag/product_type/product_id/instance_id/
For example, a diagnostic_dest initialization parameter is/u05/app/oracle. The home directory for an Oracle database with a SID of Prod1 is as follows:
/u05/app/oracle/diag/rdbms/prod1/prod1/
There are many subdirectories in the home directory of an ADR:
Alert: an instance of an alarm log file (in XML format).
Cdump:core file.
HM: Health Check report.
Incident: A subdirectory of each event that contains all trace dump files.
INCPKG: The event package that you created is used to send Oracle support.
IR: Contains the instance event report.
Trace: Stores the reply trace file.
You can query the directory and its location through view 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
As you can see, the view V$diag_info includes the number of issues and events.
For example, use the following command to view all ora-errors:
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 '
After exiting like the VI editor, you can find the output of the screen in the file/tmp/alert_10191_1638_rac_1.ado. Easy to analyze,
This feature is visible and grep in Unix | The ora-command is very different because the latter can only output error rows, but the time at which the error line occurs cannot be displayed, while Show alert displays both the error and the occurrence time.
5. Summary
With the Adrci command, the log files in each directory can be viewed centrally, which can effectively improve the productivity.
This article is from the "SYSDBA" blog, make sure to keep this source http://sysdba.blog.51cto.com/10492366/1703294
Oracle Automated Diagnostics Repository (Automatic Diagnostic Repository,adr)