Oracle (SecureCRT) : Important Queries for UNDO Management
Dear Readers, In this article, we will see the following Oracle (SecureCRT) : Important Queries for UNDO Management. MenuBar : UNDO Tab Name : Undo_Usage
1 2 |
set linesize 200 pagesize 200 compute sum of "Total Space in GB" on report |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
select tablespace_name, status segment_status, count(extent_id) "Extent Count", sum(blocks) "Total Blocks", sum(blocks)*8/(1024) "Total Space in MB" from dba_undo_extents group by tablespace_name, status order by tablespace_name / TABLESPACE_NAME SEGMENT_S Extent Count Total Blocks Total Space in MB ------------------------------ --------- ------------ ------------ ----------------- UNDOTBS1 EXPIRED 173 10264 80.1875 UNDOTBS1 UNEXPIRED 68 5944 46.4375 UNDOTBS2 EXPIRED 177 9816 76.6875 UNDOTBS2 UNEXPIRED 76 6608 51.625 |
Tab Name : Undo_Contetion
1 2 3 4 |
SET TERMOUT OFF; COLUMN current_instance NEW_VALUE current_instance NOPRINT; SELECT rpad(instance_name, 17) current_instance FROM v$instance; SET TERMOUT ON; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
PROMPT PROMPT +------------------------------------------------------------------------+ PROMPT | Report : Undo Contention | PROMPT | Instance : ¤t_instance | PROMPT +------------------------------------------------------------------------+ SET ECHO OFF SET FEEDBACK 6 SET HEADING ON SET LINESIZE 180 SET PAGESIZE 50000 SET TERMOUT ON SET TIMING OFF SET TRIMOUT ON SET TRIMSPOOL ON SET VERIFY OFF CLEAR COLUMNS CLEAR BREAKS CLEAR COMPUTES COLUMN instance_name FORMAT a10 HEAD 'Instance' COLUMN class FORMAT a18 HEADING 'Class' COLUMN ratio HEADING 'Wait Ratio' BREAK ON instance_name SKIP 2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
SELECT i.instance_name instance_name , w.class class , ROUND(100*(w.count/SUM(s.value)),8) ratio FROM gv$instance i , gv$waitstat w , gv$sysstat s WHERE i.inst_id = w.inst_id AND i.inst_id = s.inst_id AND w.class IN ( 'system undo header' , 'system undo block' , 'undo header' , 'undo block' ) AND s.name IN ('db block gets', 'consistent gets') GROUP BY i.instance_name , w.class , w.count ORDER BY i.instance_name , w.class; Instance Class Wait Ratio ---------- ------------------ ---------- ORCL11 system undo block 0 system undo header 0 undo block .0001595 undo header .0002848 ORCL12 system undo block 0 system undo header 0 undo block .00018723 undo header .00030043 |
Tab Name : Undo_Trend_Today
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
set linesize 300 SELECT TO_CHAR(BEGIN_TIME, 'MM/DD/YYYY HH24:MI:SS') BEGIN_TIME, TO_CHAR(END_TIME, 'MM/DD/YYYY HH24:MI:SS') END_TIME, UNDOTSN, UNDOBLKS, TXNCOUNT, MAXCONCURRENCY AS "MAXCON", MAXQUERYLEN, TUNED_UNDORETENTION FROM v$UNDOSTAT WHERE rownum <= 144; Instance Class Wait Ratio ---------- ------------------ ---------- ORCL11 system undo block 0 system undo header 0 undo block .0001595 undo header .0002848 ORCL12 system undo block 0 system undo header 0 undo block .00018723 undo header .00030044 |
Tab Name : Undo_Usage_For_Sessions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
set linesize 300 set pagesize 300 col sid_serial for a30 SELECT TO_CHAR(s.sid)||','||TO_CHAR(s.serial#) sid_serial, NVL(s.username, 'None') orauser, s.program, r.name undoseg, t.used_ublk * TO_NUMBER(x.value)/1024||'K' "Undo" FROM sys.v_$rollname r, sys.v_$session s, sys.v_$transaction t, sys.v_$parameter x WHERE s.taddr = t.addr AND r.usn = t.xidusn(+) AND x.name = 'db_block_size'; |
Tab… Read More