Ask the Expert

Specifying and checking the rollback segment in PL/SQL

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.

    Requires Free Membership to View

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.

This was first published in March 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: