denrepo

OracleTemp & undo

Undo usage and ORA-01555 risk

Undo extents by status, then the longest query and any snapshot-too-old or out-of-space errors from V$UNDOSTAT (roughly the last four days).

Not yet verified. How scripts are tested

ora-undo.sql
1CLEAR COLUMNS2SET LINESIZE 140 PAGESIZE 100 TRIMOUT ON TAB OFF3COLUMN tablespace_name   HEADING "TABLESPACE"           FORMAT A204COLUMN status            FORMAT A105COLUMN mb                FORMAT 9,999,9906COLUMN extents           FORMAT 9,999,9907COLUMN since             FORMAT A168COLUMN longest_query_s   HEADING "LONGEST QUERY S"      FORMAT 9,999,9909COLUMN tuned_retention_s HEADING "TUNED RETENTION S"    FORMAT 9,999,99010COLUMN snapshot_too_old  HEADING "ORA-01555"            FORMAT 99,99011COLUMN out_of_space      HEADING "OUT OF SPACE"         FORMAT 99,99012 13SELECT tablespace_name, status,14       ROUND(SUM(bytes) / 1048576) AS mb,15       COUNT(*) AS extents16FROM dba_undo_extents17GROUP BY tablespace_name, status18ORDER BY tablespace_name, status;19 20SELECT TO_CHAR(MIN(begin_time), 'YYYY-MM-DD HH24:MI') AS since,21       MAX(maxquerylen) AS longest_query_s,22       MAX(tuned_undoretention) AS tuned_retention_s,23       SUM(ssolderrcnt) AS snapshot_too_old,24       SUM(nospaceerrcnt) AS out_of_space25FROM v$undostat;

Save it as ora-undo.sql and run it with SQL> @ora-undo.

Open in denrepo

Helps with

More Oracle scripts: Temp & undo