adrci

Using SQL commands on ADRCI

While working with ADRCI , I came to know that we can run normal SQL commands for some of the operation.e.g To display current purge policy , you can run select * from adr_control instead of show control.

adrci> desc ADR_CONTROL
Name                          Type            NULL?      
----------------------------- --------------- -----------
ADRID                         number                     
SHORTP_POLICY                 number                     
LONGP_POLICY                  number                     
LAST_MOD_TIME                 timestamp                  
LAST_AUTOPRG_TIME             timestamp                  
LAST_MANUPRG_TIME             timestamp                  
ADRDIR_VERSION                number                     
ADRSCHM_VERSION               number                     
ADRSCHMV_SUMMARY              number                     
ADRALERT_VERSION              number                     
CREATE_TIME                   timestamp

Since I am only interested in few columns, I can create a view

adrci> create view my_control as select SHORTP_POLICY,LONGP_POLICY,LAST_AUTOPRG_TIME,LAST_MANUPRG_TIME from ADR_CONTROL;

View MY_CONTROL Created

Now you can query this new view

adrci> select * from my_control;

ADR Home = /home/oracle/diag/rdbms/tintin/tintin1:
*************************************************************************
SHORTP_POLICY        LONGP_POLICY         LAST_AUTOPRG_TIME                        LAST_MANUPRG_TIME                        
-------------------- -------------------- ---------------------------------------- ---------------------------------------- 
720                  8760                 2012-12-27 23:09:47.140711 +00:00                                                
1 rows fetched

You can find the list of all metadata tables under ADR_HOME/metadata.

oradbdev01:tintin1:/home/oracle/diag/rdbms/tintin/tintin1/metadata>ls -ltr HM*
-rw-r----- 1 oracle dba   65536 Jan 13  2012 HM_INFO.ams
-rw-r----- 1 oracle dba   65536 Jan 13  2012 HM_FDG_SET.ams
-rw-r----- 1 oracle dba   65536 Jan 13  2012 HM_MESSAGE.ams
-rw-r----- 1 oracle dba   65536 Dec 27 23:09 HM_RECOMMENDATION.ams
-rw-r----- 1 oracle dba   65536 Dec 27 23:09 HM_FINDING.ams
-rw-r----- 1 oracle dba 9895936 Jan  3 05:44 HM_RUN.ams

We can run query on HM_RUN table like this

adrci> select RUN_ID,RUN_NAME,CHECK_NAME,MODE,START_TIME,END_TIME,STATUS from HM_RUN where rownum

I tried running substr command to format the column but this gives error 🙂

adrci> select RUN_ID,substr(RUN_NAME,1,20),CHECK_NAME,MODE,START_TIME,END_TIME,STATUS from HM_RUN where rownum <2;
DIA-48001: internal error code, arguments: [dbgrmdmmr_marshall_rec_null_terminate], [1], [8], [8], [], [], [], []

There is SET COLUMN text size command, but it sets length for all Text columns and can’t be used to size individual column. This is useful if you are querying big field like “Text” column of VIEW. e.g

adrci> set column text 100
adrci> select text from view where name='MY_CONTROL';

ADR Home = /home/oracle/diag/rdbms/tintin/tintin1:
*************************************************************************
TEXT                                                                                                 
---------------------------------------------------------------------------------------------------- 
select SHORTP_POLICY,LONGP_POLICY,LAST_AUTOPRG_TIME,LAST_MANUPRG_TIME from ADR_CONTROL;

Understanding of Oracle 11g Automatic Diagnostic Repository – Part 1

INTRODUCTION

In an endeavour to move towards self managed database and provide better support solutions, Oracle 11g introduces another new feature in 11g called the Automatic Diagnostic Repository or ADR. As the name implies ADR is a automatically managed file based repository of diagnostic information such as trace files, core dumps, alert log, etc… ADR is like a mini database managing traces of multiple instances and multiple prouducts (database, ASM, CRS, etc…) with metadata of these traces being maintained under a unified directory structure. ADR promises to use consistent diagnostic data structures across products. Set of tools bundled with ADR facilitate us in analyzing diagnostic data.

As an outcome of this feature:
– Critical errors captured in the diagnostic repository show up as alerts in EM. In cases where the issue is a known issue, Oracle recommends corrective actions to be implemented by DBA.
– It is intended to make it easy for DBAs to consolidate and transfer diagnostic data to Oracle support, thus facilitating faster resolution of the issue.

ARCHITECTURE

Starting with Oracle 11g R1, traditional *_DUMP_DEST parameters are ignored and the trace location is decided based on DIAGNOSTIC_DEST parameter. If this parameter is not set explicitly, it defaults to ORACLE_BASE environment variable if this is set, if this is not set, then it defaults to ORACLE_HOME/log.

DIAGNOSTIC_DEST is the ADR root directory also known as ADR base.

Each instance of each product stores diagnostic data in its own ADR home directory. For example, in a Real Application Clusters (RAC) environment with shared storage and ASM, each database instance and each ASM instance have a home directory within ADR.

Under ADR base are multiple ADR homes. ADR home is the root directory for all traces within an instance of a product. i.e. Each instance of a product has an ADR home. Directroy structure of ADR is pictorial represented as below:

Under the ADR base there will be a folder “diag”. Within this folder there will be seperate folders for each product like rdbsm, asm, crs, clients, lsnrctl, netcman, etc… Each of these folders will have seperate folders for every instance of the product.

For an instance of Oracle database, the structure is as depicted. All traces that used to be within USER_DUMP_DEST and BACKGROUND_DUMP_DEST are with trace folder. There is a seperate folder for alert log. A copy of the alert log in XML format is mainted in the alert folder.

Problem and Incident are two terms used frequently in ADR. All errors like the ora-600, ora-7445 or any other error like ora-470 that crashes database instance are termed as critical error. A critical error is termed as a Problem and is given a problem id by ADR based on it’s symptoms. Each occurrence of a critical error is termed as an Incident.

Incident directory contains multiple subdirectories, where each subdirectory is named for a particular incident, and where each contains dumps pertaining only to that incident.

Metadata directory contains ADR’s metadata.

HM directory contains health monitor reports which are part of ADR.

ADRCI – ADR command interpreter and EM support work bench are the two interfaces to ADR.

We will discuss these tools in our next post.