среда, 11 ноября 2009 г.

Monitor the progress of the transaction recovery: Oracle


V$FAST_START_TRANSACTIONS
V$FAST_START_SERVERS
V$SESSION_LONGOPS


SELECT USED_UREC
FROM V$TRANSACTION;


To estimate when the monitored rollback process will finish

SELECT TIME_REMAINING, SOFAR / TOTALWORK * 100 PCT
FROM V$SESSION_LONGOPS
WHERE SID = :sid
AND OPNAME = 'Transaction Rollback' ;


set linesize 100
alter session set NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';
select usn,
state,
undoblockstotal "Total",
undoblocksdone "Done",
undoblockstotal-undoblocksdone "ToDo",
decode(cputime,0,'unknown',sysdate+(((undoblockstotal- undoblocksdone)/
(undoblocksdone / cputime)) / 86400)) "Estimated time to complete"
from v$fast_start_transactions;


select ktuxeusn, to_char(sysdate,'DD-MON-YYYY HH24:MI:SS') "Time",
ktuxesiz,
ktuxesta
from x$ktuxe
where ktuxecfl = 'DEAD';


SELECT T.USN
, R.NAME
, USERNAME
, SERIAL#
, TERMINAL
, PROGRAM
, T.STATE
, ROUND (UNDOBLOCKSDONE / UNDOBLOCKSTOTAL * 100, 1 ) PCT_DONE
, T.UNDOBLOCKSDONE
, T.UNDOBLOCKSTOTAL
, T.SLT
, T.SEQ
, T.PID
, T.CPUTIME
, T.PARENTUSN
, T.PARENTSLT
, T.PARENTSEQ
from v$fast_start_transactions T
, v$TRANSACTION R
, v$process p
WHERE T.PARENTUSN = R.XIDUSN
and T.PARENTSLT = R.XIDSLOT
and T.PARENTSEQ = R.XIDSQN
and t.pid = p.pid