For more information about Undo tablespace management, see Oracle undo tablespace management.
We can use the following script to view the information of the Oracle undo segment:
- /* FormattedOn18:10:55 (QP5 v5.185.11230.41888 )*/
- SELECTT1.USN,
- T2.NAME,
- T1.STATUS,
- T1.LATCH,
- T1.EXTENTS,
- T1.WRAPS,
- T1.EXTENDS
- FROMV $ ROLLSTAT T1, V $ ROLLNAME T2
- WHERET1.USN = T2.USN;
When the Undo tablespace fails, we need to pay attention to the undo segment information:
How to deal with Currentonline Redo and Undo corruption
Combined with the v $ session and v $ transaction views, you can confirm that each transaction uses the undo segment. When the undo tablespace is abnormal, you can use the following script to check whether the transaction uses the undo segment:
- /* FormattedOn13:28:55 (QP5 v5.185.11230.41888 )*/
- SELECTS. SID,
- S. USERNAME,
- U.NAME,
- Q. SQL _TEXT,
- Q. HASH_VALUE,
- T. UBABLK
- FROMV $TRANSACTIONT,
- V $ rollstat r,
- V $ rollname u,
- V $ session s,
- V $ SQL Q
- WHERES. TADDR = T. ADDR
- ANDT. XIDUSN = R. USN
- ANDR. USN = U. USN
- ANDQ. HASH_VALUE =
- DECODE (S. SQL _HASH_VALUE,
- NULL, S. PREV_HASH_VALUE,
- S. SQL _HASH_VALUE)
- ORDER BYS. USERNAME;