How can I find out which rollback segment a transaction is using? I want to specify a rollback segment when executing a PL/SQL statement and to check that it is using the specified rollback segment.
The following query will show you the information you want:
SELECT r.name rollback_seg_name, l.sid oracle_pid, p.spid system_pid, nvl(p.username,'NO TRANSACTION') username, p.terminal FROM v$lock l, v$process p, v$rollname r WHERE l.sid = p.pid(+) AND trunc(l.id1(+)/65536) = r.usn AND l.type(+) = 'TX' AND l.lmode(+) = 6 ORDER BY r.name ;Use 'SET TRANSACTION USE ROLLBACK SEGMENT rbx' to point the transaction to the desired rollback segment. Start the transaction and then run the script. You should see it show up in the rollback segment you specify.
For More Information
- What do you think about this answer? E-mail the editors at editor@searchDatabase.com with your feedback.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.