根据metalink脚本学习undo(四)

来源:互联网 发布:500男士手表知乎 编辑:程序博客网 时间:2024/06/07 18:44

下面这个脚本是显示哪些活动事务占用undo空间

set lines 200set pages 999clear colset termout offset trimout onset trimspool onREMREM  Current transactionsREMREM  Will show only last transaction by a userREMREM  May need to use 786472.1 for better picture REM  of activityconnect / as sysdbaalter session set nls_date_format='dd-Mon-yyyy hh24:mi';col username format a10 wrapped heading "User"col name format a22 wrapped heading "Undo Segment Name"col xidusn heading "Undo|Seg #"col xidslot heading "Undo|Slot #"col xidsqn heading "Undo|Seq #"col ubafil heading "File #"col ubablk heading "Block #"col start_time format a10 word_wrapped heading "Started"col status format a8 heading "Status"col blk format 999,999,999 heading "KBytes"col used_urec heading "Rows"col username format a10col OSUSER format a10col MACHINE format a10col SQL_ID format a10col SQL_TEXT format a30spool undoactivity.outpromptprompt  ############## RUNTIME ############## promptcol rdate head "Run Time"select sysdate rdate from dual;promptprompt  ############## Current Uncommitted Transactions ############## promptselect start_time,  --事务起始时间       username,    --用户名       s.MACHINE,   --机器名称       s.OSUSER,    --登录名       r.name,      --回滚段名称       ubafil,      --Undo block address (UBA) filenum       ubablk,      --UBA block number       t.status,    --回话状态       (used_ublk * p.value) / 1024 blk, --使用的回滚段空间       used_urec,   --使用的undo 记录 ,       s1.SQL_ID,    --sql_id       s1.SQL_TEXT   --sql文本  from v$transaction t, v$rollname r, v$session s, v$parameter p,v$sql s1 where xidusn = usn   and s.saddr = t.ses_addr   and p.name = 'db_block_size'    and s.SADDR=s1.ADDRESS(+) order by 1;set termout onset trimout offset trimspool offclear col




0 0
原创粉丝点击