Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Daily Heath report script

RE: Daily Heath report script

From: Marquez, Chris <cmarquez_at_collegeboard.org>
Date: Fri, 4 Nov 2005 13:47:54 -0500
Message-ID: <B30C2483766F9342B6AEF108833CC84E05BD608B@ecogenemld50.Org.Collegeboard.local>

I guess this explains it, but who would own this code (trigger), SYS?

Chris Marquez
Oracle DBA



Use the SERVERERROR event.
This trigger is fired When the error eno occurs. If no condition is given, then this event fires when any error occurs. Does not apply to ORA-1034, ORA-1403, ORA-1422, ORA-1423, and ORA-4030 conditions, because they are not true errors or are too serious to continue processing.

For more details refer to documentation: 'Chapter 16 Working With System Events' of
'Oracle9i Application Developer's Guide - Fundamentals'

[]$ oerr ora 1034
01034, 00000, "ORACLE not available"
// *Cause: Oracle was not started up. Possible causes include the following:

//         - The SGA requires more space than was allocated for it.
//         - The operating-system variable pointing to the instance is
//           improperly defined.

// *Action: Refer to accompanying messages for possible causes and correct
// the problem mentioned in the other messages. // If Oracle has been initialized, then on some operating systems, // verify that Oracle was linked correctly. See the platform // specific Oracle documentation.

[]$ oerr ora 1403
01403, 00000, "no data found"
// *Cause:
// *Action:

[]$ oerr ora 1422
01422, 00000, "exact fetch returns more than requested number of rows"
// *Cause: The number specified in exact fetch is less than the rows returned.
// *Action: Rewrite the query or change number of rows requested

[]$ oerr ora 1423
01423, 00000, "error encountered while checking for extra rows in exact fetch"
// *Cause:
// *Action: See the following error and take appropriate action.

[]$ oerr ora 4030
04030, 00000, "out of process memory when trying to allocate %s bytes (%s,%s)"
// *Cause: Operating system process private memory has been exhausted
// *Action:

-----Original Message-----
From: oracle-l-bounce_at_freelists.org on behalf of Marquez, Chris Sent: Fri 11/4/2005 1:34 PM
To: Dave.Herring_at_acxiom.com; oracle-l_at_freelists.org Subject: RE: Daily Heath report script  

Dave,

This looks really interesting...not sure I'm aware of the DBMS_STANDARD.SERVER_ERROR package.

I'm trying to follow the logic of the code...one question. Does code/proc track *all* db "server" errors or only "ORA-" errors that happen for (failed) executed SQL. Meaning catch all of the (same) ORA- errors found in the alert log, plus those thrown to individual SQL sessions?

What version of Oracle do you run this on?

Thanks,

Chris Marquez
Oracle DBA

-----Original Message-----
From: oracle-l-bounce_at_freelists.org on behalf of Herring Dave - dherri Sent: Wed 11/2/2005 4:44 PM
To: oracle-l_at_freelists.org
Subject: FW: Daily Heath report script  

You may want to capture all (actually "most") ORA- errors and report daily. Here's a simple trigger you can use to capture them:

CREATE OR REPLACE TRIGGER SYS.AUD_ORA_ERROR_SETG    AFTER SERVERERROR ON DATABASE
    WHEN (DBMS_STANDARD.SERVER_ERROR(1) NOT IN (1003,1017,1594,1595,1720)) DECLARE

   v_machine            VARCHAR2(64);
   v_osuser             VARCHAR2(30);
   v_process            VARCHAR2(12);
   v_program            VARCHAR2(48);
   v_sql_stmt           VARCHAR2(4000);
   v_sql_text           ora_name_list_t;
   v_tmp_counter        PLS_INTEGER;
   v_tmp_sql_chunks     PLS_INTEGER;

BEGIN
   BEGIN
      SELECT s.osuser
           , s.machine
           , p.spid
           , s.program
        INTO v_osuser, v_machine, v_process, v_program
        FROM sys.v_$session s
           , sys.v_$process p
       WHERE s.sid = (SELECT /*+ FIRST_ROWS(1) */ sid
                        FROM sys.v_$mystat
                       WHERE rownum < 2)
         AND s.username = ora_login_user
         AND s.paddr = p.addr;
   EXCEPTION
      WHEN no_data_found THEN
         v_sql_stmt := '';

   END;
   IF DBMS_STANDARD.SERVER_ERROR(1) IN (900,1400,1401,1722)
      OR DBMS_STANDARD.SERVER_ERROR(1) BETWEEN 900 AND 985 THEN
      v_tmp_sql_chunks := ora_sql_txt(v_sql_text);
      FOR v_tmp_counter IN 1..v_tmp_sql_chunks LOOP
/*
 * Chunks are set at 64K each and since the max VACHAR2 variable is 4000, going beyond

Dave

If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.

If you have received this communication in error, please resend this communication to the sender and delete the original message or any copy of it from your computer system.

Thank You.


--
http://www.freelists.org/webpage/oracle-l






--
http://www.freelists.org/webpage/oracle-l
Received on Fri Nov 04 2005 - 12:53:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US