Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

SQL Scripts & Samples

Posted May 21, 2004

Which DML's are running? How much Rollback?

By DatabaseJournal.com Staff



>>Script Language and Platform: Oracle
Each transaction will be put in the v$transaction table. This query will give you which rollback segment they are using and how much. It will also show how much temp space they are using. If the column STATUS shows up "ACT" the statement is currently running, if it shows up "INA" then the statment has stopped and it has not committed or rolled back.

Author: Shawn Ellinger



column userid format 9999 Heading SID
column st format a14 heading "Start Time"
column ts format a8 heading " Tran| Status" 
column ss format a3 Just Right heading "Sess|Stat" 
column rbs format a10 just left
column blocks format 999999
column used_urec format 999999 heading "Undo|Records"
column used_ublk format 999999 heading "Undo|Blocks"
column extents format 999 heading "RBS|EXT"
column pct format 999
column sze format 999 heading "TEMP|(M)"

set numw 8
set feedback on

select s.sid userid, 
substr(t.start_time,1,14) st, 
substr(s.status,1,3) ss,
t.log_io,
t.phy_io,
t.used_urec,
t.used_ublk,
rb.segment_name RBS,
rs.EXTENTS,
trunc(blocks*8192/1024/1024) sze
from v$sort_usage su, 
v$rollstat rs, 
sys.dba_rollback_segs rb, 
v$session s, 
v$transaction t
where t.ses_addr = s.saddr
and t.xidusn = rb.segment_id
and t.xidusn = rs.usn
and s.SADDR=su.session_addr(+)
order by to_date(t.start_time, 'MM/DD/RR HH24:MI:SS')
/

Disclaimer: We hope that the information on these script pages is valuable to you. Your use of the information contained in these pages, however, is at your sole risk. All information on these pages is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, or fitness for a particular purpose... Disclaimer Continued


Back to Database Journal Home



SQL Scripts & Samples Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




Latest Forum Threads
SQL Scripts & Samples Forum
Topic By Replies Updated
sql help!! add 1 August 22nd, 11:58 AM
How To Combine These 2 Queries into 1 Query ? tarek_land 1 June 7th, 08:37 AM
solving query svibuk 1 February 3rd, 06:08 AM
converting from a character string to uniqueidentifier saturnius 4 January 4th, 05:56 AM