Showing posts with label ADRCI. Show all posts
Showing posts with label ADRCI. Show all posts

Tuesday, October 5, 2010

Monitoring Alert Log

Monitoring Alert Log has become lot easier with Oracle 11g . In Oracle 11g , the contents of the alert log are exposed via fixed table . 

Also , in  Oracle 11g , the alert log is also stored in xml format . You can ADRCI to view / purge the contents . For ADRCI , please see one of my post here ( http://mfzahirdba.blogspot.com/2010/05/health-check.html)

Prior to this release , you can construct an external table poiniting to alert log . For this approach , please refer to chapter 3 of Tom Kyte's Expert Oracle book .

Let us returned to using fixed table ( it does not seems to be documented ) . Alert log is exposed as "X$DBGALERTEXT".

Let us create a view , so that we can grant access to non sys users.

SQL> CREATE OR REPLACE VIEW SYS.ALERT_LOG_v
2 AS
3 SELECT * FROM X$DBGALERTEXT;



View created.

SQL> grant select on SYS.ALERT_LOG_v to scott ;

Grant succeeded.

SQL> conn scott/tiger



Connected.


SQL> desc sys.alert_log_v


Name Null?                                Type

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

ADDR                                      RAW(8)
INDX                                      NUMBER
INST_ID                                   NUMBER
ORIGINATING_TIMESTAMP                     TIMESTAMP(3) WITH TIME ZONE
NORMALIZED_TIMESTAMP                      TIMESTAMP(3) WITH TIME ZONE
ORGANIZATION_ID                           VARCHAR2(64)
COMPONENT_ID                              VARCHAR2(64)
HOST_ID                                   VARCHAR2(64)
HOST_ADDRESS                              VARCHAR2(46)
MESSAGE_TYPE                              NUMBER
MESSAGE_LEVEL                             NUMBER
MESSAGE_ID                                VARCHAR2(64)
MESSAGE_GROUP                             VARCHAR2(64)
CLIENT_ID                                 VARCHAR2(64)
MODULE_ID                                 VARCHAR2(64)
PROCESS_ID                                VARCHAR2(32)
THREAD_ID                                 VARCHAR2(64)
USER_ID                                   VARCHAR2(64)
INSTANCE_ID                               VARCHAR2(64)
DETAILED_LOCATION                         VARCHAR2(160)
PROBLEM_KEY                               VARCHAR2(64)
UPSTREAM_COMP_ID                          VARCHAR2(100)

....
.....
 
I can issue the following query  ( in a recurring job ) to see if there are lot of "ORA-" errors in the last 15 minutes .
 
SQL> SELECT message_text ,

2 client_id ,
3 originating_timestamp
4 FROM sys.alert_log_v
5 WHERE originating_timestamp >= sysdate-(1/24/60)*15
6 AND message_text LIKE '%%ORA-%%';


no rows selected


Monitoring Alert Log is made easier with this approach .

Wednesday, May 12, 2010

Health Check

Oracle 11g provides a new tool to check the Health of the database .
The package is DBMS_HM. The database detects the issues , when it encounters them .
This can also be invoked manually . However , not all checks can be executed .

The following is the structure of the view v$hm_check


SQL> desc v$hm_check

ID               NUMBER
NAME             VARCHAR2(64)
NAME_NLS         VARCHAR2(1024)
CLSID            NUMBER
CLS_NAME         VARCHAR2(15)
FLAGS            NUMBER
INTERNAL_CHECK   VARCHAR2(1)
OFFLINE_CAPABLE  VARCHAR2(1)
DESCRIPTION      VARCHAR2(1024)
Only the checks with Internal Check <> 'Y' can be executed manually .
The results can be viewed thru ADRCI tool
These are the checks in v$hm_check .


SQL> col name format a35 wrapped
SQL> col description format a55 wrapped
SQL> Select name , description , internal_check from v$hm_check;


HM Test Check                       Check for health monitor functionality Y
DB Structure Integrity Check        Checks integrity of all database files N
CF Block Integrity Check            Checks integrity of a control file block N

Data Block Integrity Check          Checks integrity of a data file block N

Redo Integrity Check                Checks integrity of redo log content N

Logical Block Check                 Checks logical content of a block Y
Transaction Integrity Check         Checks a transaction for corruptions N
Undo Segment Integrity Check        Checks integrity of an undo segment N
No Mount CF Check                   Checks control file in NOMOUNT mode Y
Mount CF Check                      Checks control file in mount mode Y
CF Member Check                     Checks a multiplexed copy of the control Y
file
All Datafiles Check                 Checks all datafiles in the database Y
Single Datafile Check               Checks a data file Y
Tablespace Check Check              Checks a tablespace Y
Log Group Check                     Checks all members of a log group Y
Log Group Member Check              Checks a particular member of a log grou Y
p


.....
.....27 rows selected.


SQL> exec dbms_hm.run_check('Dictionary Integrity Check' , 'HM run');
PL/SQL procedure successfully completed.

View the results of the check in ADRCI.

D:\test>adrci
ADRCI: Release 11.2.0.1.0 - Production on Wed May 12 13:15:03 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
ADR base = "c:\app\oracle"
adrci>






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


HM RUN RECORD 9


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


RUN_ID                           21

RUN_NAME                         HM run

CHECK_NAME                       Dictionary Integrity Check

NAME_ID                          24

MODE                             0

START_TIME                       2010-05-12 13:09:22.671000 -04:00
RESUME_TIME                     
END_TIME                         2010-05-12 13:09:37.781000 -04:00
MODIFIED_TIME                    2010-05-12 13:09:37.781000 -04:00
TIMEOUT                          0
FLAGS                            0
STATUS                           5
SRC_INCIDENT_ID                  0
NUM_INCIDENTS                    0
ERR_NUMBER                       0
REPORT_FILE                      



As mentioned above , only the non-internal checks can be invoked manually .
As you can see , the following gives the error message , as this is a internal check .

SQL> exec dbms_hm.run_check('CF Member Check' , 'HM run');
BEGIN dbms_hm.run_check('CF Member Check' , 'HM run'); END;
*
ERROR at line 1:
ORA-51001: check [CF Member Check] not found in HM catalog
ORA-06512: at "SYS.DBMS_HM", line 191
ORA-06512: at line 1


Also , some of the checks are only for ASM instance .

SQL> exec dbms_hm.run_check('ASM Disk Visibility Check' , 'HM check asm run');
BEGIN dbms_hm.run_check('ASM Disk Visibility Check' , 'HM check asm run'); END;
*
ERROR at line 1:
ORA-51037: check [ASM Disk Visibility Check] can only be executed in ASM
instance
ORA-06512: at "SYS.DBMS_HM", line 191
ORA-06512: at line 1

Welcome any feedback.