Thursday, November 01, 2012

Daily check on the database before business volume picks up

Session Count

SQL>
    SELECT a.inst_id, COUNT (1) "Session Count"
     FROM sys.gv_$session a
    GROUP BY a.inst_id
SQL> /

   INST_ID Session Count
---------- -------------
         1            67
         2           105

Long Operation – Time Remaining is greater than Zero.

SQL> l
    SELECT * FROM sys.gv_$session_longops
    WHERE  TIME_REMAINING > 0

DBMS Jobs

SELECT job,
       SUBSTR (what, 1, 30),
       schema_user,
       last_date,
       next_date,
       broken,
       NVL2 (this_date, 'Y', 'N') running
  FROM dba_jobs s
ORDER BY schema_user, last_date

Buffer Gets

Replace the v.sql text with the frequent SQL statements important to your application.

SELECT v.inst_id,
       ROUND (v.buffer_gets / v.executions, 1) avggets,
       v.executions,
       v.module,
       SUBSTR (v.sql_text, 1, 60) querysql
  FROM sys.gv_$sql v
WHERE v.buffer_gets > 0
   AND v.executions > 0
   AND v.executions IS NOT NULL
   AND DECODE (executions, 0, NULL, (v.buffer_gets / v.executions)) > 10
   AND (v.sql_text LIKE 'FROM TBL_ABC%'
     OR  v.sql_text LIKE 'FROM TBL_XYZ%') 
ORDER BY v.inst_id, avggets DESC;

No comments: