首页 > 代码库 > Oracle 查看 使用 UNDO 段的事务脚本

Oracle 查看 使用 UNDO 段的事务脚本

查看oracle undo segment段的信息:

SELECT T1.USN,  
       T2.NAME,  
       T1.STATUS,  
       T1.LATCH,  
       T1.EXTENTS,  
       T1.WRAPS,  
       T1.EXTENDS  
  FROM V$ROLLSTAT T1, V$ROLLNAME T2  
 WHERE T1.USN = T2.USN; 

 

技术分享

 

检查事务使用undo segment的情况:

SELECT s.username,
       s.sid,
       pr.PID,
       s.OSUSER,
       s.MACHINE,
       s.PROGRAM,
       rs.segment_id,
       r.usn,
       rs.segment_name,      
       r.rssize/1024/1024,
       sq.sql_text
  FROM gv$transaction t, gv$session s, gv$rollstat r, dba_rollback_segs rs ,gv$sqltext  sq,gv$process pr
WHERE s.saddr = t.ses_addr
   AND t.xidusn = r.usn 
   AND rs.segment_id = t.xidusn
   AND s.sql_address=sq.address
   AND s.sql_hash_value = sq.hash_value
   AND s.PADDR=pr.ADDR
ORDER BY t.used_ublk DESC ,sq.PIECE;

技术分享

 

Oracle 查看 使用 UNDO 段的事务脚本