SlideShare a Scribd company logo
1 of 2
Download to read offline
Blocking Transactions                                                           Administration Tips




Blocking Transactions

A blocking transaction is any transaction that is left uncommitted or un-rolled back by a
User for a period of time sufficient to prevent the normal re-use of rollback segment
extents.

Ordinarily, a rollback segment will place rollback generated by successive transactions in
its extents in sequential order. That is, it will fill up the first extent with a variety of
transactions’ rollback, then the second, then the third, and so on. When all extents have
been filled in this way, it returns to the first one and simply proceeds to overwrite the
older rollback information with new data. However, a rollback segment is never permitted
to overwrite the contents of a particular extent if, in any part of that extent, there is
rollback belonging to an active transaction (one that is either uncommitted or un-rolled
back). This rule is there for what are hopefully obvious reasons!

When prevented or blocked from re-using earlier extents in this way, the rollback segment
is forced instead to acquire additional new extents. New transactions may therefore
continue to house their rollback data in the new extents. But frequent extent acquisition
is usually a bad thing for performance (less so in locally managed tablespace, it is true),
and in any case it is not exactly good practice to start losing large chunks of disk space to
an ever-growing rollback segment just because a User can’t be bothered to finish their
transaction properly.

In fact, rollback segments will continue to acquire extents forever if the blocking
transaction is not committed or rolled back –or at least, they will try to continue acquiring
extents until either MAXEXTENTS is reached, or they physically run out of space in the
tablespace. At that point, the transaction needing the extra rollback space will simply fail.

Therefore the existence of long-standing active transactions which prevent the re-use of
existing extents, and thereby induce heavy extent acquisition, is a problem which needs to
be monitored and –where appropriate- dealt with.

To detect transactions which have failed to commit or rollback, and which are thus at risk
of blocking the normal operation of a rollback segment, issue the following query from
within SQL Plus (the first two lines are column formatting options which are not recognised
in other applications, such as Server Manager):

COL USERNAME FORMAT          A15
COL NAME FORMAT A15
SELECT S.USERNAME, S.SID, S.SERIAL#, T.START_TIME, N.NAME
FROM V$SESSION S, V$TRANSACTION T, V$ROLLSTAT R, V$ROLLNAME N
WHERE S.SADDR=T.SES_ADDR
AND R.USN=N.USN
AND TO_DATE(T.START_TIME,’MM/DD/YY HH24:MI:SS’)<(SYSDATE-(1/24));

Copyright © Howard Rogers 2001            10/17/2001                                     Page 1 of 2
Blocking Transactions                                                           Administration Tips




That produces a report looking something like this:

USERNAME           SID   SERIAL#         START_TIME      NAME
------------- ---------- ---------- ----------------- ---------------
SCOTT               8       12      16/10/01 10:00:42   _SYSSMU2$

… and this shows us that Scott has a transaction still active in the rollback segment called
‘_SYSSMU2$’, and that it’s been active since 10 o’clock on the 16th October 2001. Because
of the last line in the query, the report will only show transactions which are still active,
having started more than an hour ago. If you wished to monitor with a finer or lesser
degree of granularity, you could edit the last line.

For example, “<(SYSDATE-(0.5/24));” would give you transactions that started over
half an hour ago. And “<(SYSDATE-(2/24));” would give you those that began more than
2 hours ago.

Incidentally, note that the START_TIME column from v$transaction, which is being used for
this particular test, is stored as a VARCHAR2 data type, not as a DATE field. That means
that the formatting string I’ve shown above is fixed. It does not depend on your database
language, nor on whatever NLS parameters and variables may be set in your environment.
The above query should work, unchanged, just as well as on a Japanese database as on a
Russian one.

Crucially, the report shows you the User involved, and their SID and SERIAL# (the two
numbers which uniquely identify any session in Oracle). The polite approach at this point
is to contact the listed User(s) and ask them to do something with their transactions. The
rather more brutal (and some might say “typically DBA”) thing to do would be to issue the
following command:

ALTER SYSTEM KILL SESSION        ‘8,12’;

… you supply whatever the earlier report identifies as the relevant SID and SERIAL#
numbers in the closing quotes there. This causes that User’s session to be immediately
terminated, whatever they are doing, and as a result, their transaction gets automatically
rolled back –thereby ceasing to be a blocking transaction, of course –and permits the
rollback segment to resume its normal, cyclical re-use of old extents.

Be careful though: the report identifies transactions which started a certain period of time
ago. A huge batch update that happens to chug along doing its stuff for several hours is
just as likely to appear on the report as a short one that’s been accidentally left
uncommitted for hours. But you really ought to distinguish between big transactions that
just happen to take a long time to complete, and old transactions which are sitting there
uncommitted simply because the User’s gone off to do something more exciting instead.
It’s really only the latter sort of transaction that merits being killed off.

Copyright © Howard Rogers 2001             10/17/2001                                    Page 2 of 2

More Related Content

Similar to Rollbackblocking

UNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing ConceptsUNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing ConceptsRaj vardhan
 
transaction management, concept & State
transaction management, concept & Statetransaction management, concept & State
transaction management, concept & StateSurya Swaroop
 
Intro to tsql unit 12
Intro to tsql   unit 12Intro to tsql   unit 12
Intro to tsql unit 12Syed Asrarali
 
22220161• General Purpose Simulation System (IBM - 1.docx
22220161• General Purpose Simulation System (IBM - 1.docx22220161• General Purpose Simulation System (IBM - 1.docx
22220161• General Purpose Simulation System (IBM - 1.docxtamicawaysmith
 
Transaction slide
Transaction slideTransaction slide
Transaction slideshawon roy
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management Systemsweetysweety8
 
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...DrCViji
 
Oracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking featuresOracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking featuresAlireza Kamrani
 
Data power Performance Tuning
Data power Performance TuningData power Performance Tuning
Data power Performance TuningKINGSHUK MAJUMDER
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing ConceptNishant Munjal
 
DBMS Presentation.pptx
DBMS Presentation.pptxDBMS Presentation.pptx
DBMS Presentation.pptxPravinBhargav1
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbmsNancy Gulati
 
Oracle : Monitoring and Diagnostics without OEM
Oracle : Monitoring and Diagnostics without OEMOracle : Monitoring and Diagnostics without OEM
Oracle : Monitoring and Diagnostics without OEMHemant K Chitale
 

Similar to Rollbackblocking (20)

Autonomous transaction
Autonomous transactionAutonomous transaction
Autonomous transaction
 
DBMS UNIT 4
DBMS UNIT 4DBMS UNIT 4
DBMS UNIT 4
 
UNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing ConceptsUNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing Concepts
 
transaction management, concept & State
transaction management, concept & Statetransaction management, concept & State
transaction management, concept & State
 
Intro to tsql unit 12
Intro to tsql   unit 12Intro to tsql   unit 12
Intro to tsql unit 12
 
22220161• General Purpose Simulation System (IBM - 1.docx
22220161• General Purpose Simulation System (IBM - 1.docx22220161• General Purpose Simulation System (IBM - 1.docx
22220161• General Purpose Simulation System (IBM - 1.docx
 
Transaction slide
Transaction slideTransaction slide
Transaction slide
 
Sistem manajemen basis data 8
Sistem manajemen basis data   8Sistem manajemen basis data   8
Sistem manajemen basis data 8
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
dokumen.tips_silberschatz-korth-and-sudarshan1-transactions-transaction-conce...
 
Oracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking featuresOracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking features
 
Data power Performance Tuning
Data power Performance TuningData power Performance Tuning
Data power Performance Tuning
 
Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
 
chp13.pdf
chp13.pdfchp13.pdf
chp13.pdf
 
DBMS Presentation.pptx
DBMS Presentation.pptxDBMS Presentation.pptx
DBMS Presentation.pptx
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbms
 
Tybsc cs dbms2 notes
Tybsc cs dbms2 notesTybsc cs dbms2 notes
Tybsc cs dbms2 notes
 
Supporting Transactions
Supporting TransactionsSupporting Transactions
Supporting Transactions
 
Oracle : Monitoring and Diagnostics without OEM
Oracle : Monitoring and Diagnostics without OEMOracle : Monitoring and Diagnostics without OEM
Oracle : Monitoring and Diagnostics without OEM
 
Ho20
Ho20Ho20
Ho20
 

More from oracle documents (20)

Applyinga blockcentricapproachtotuning
Applyinga blockcentricapproachtotuningApplyinga blockcentricapproachtotuning
Applyinga blockcentricapproachtotuning
 
Windowsosauthent
WindowsosauthentWindowsosauthent
Windowsosauthent
 
Whatistnsnames
WhatistnsnamesWhatistnsnames
Whatistnsnames
 
Whatisadatabaselink
WhatisadatabaselinkWhatisadatabaselink
Whatisadatabaselink
 
Varraysandnestedtables
VarraysandnestedtablesVarraysandnestedtables
Varraysandnestedtables
 
Userpasswrd
UserpasswrdUserpasswrd
Userpasswrd
 
Undo internals paper
Undo internals paperUndo internals paper
Undo internals paper
 
Tablespacelmt
TablespacelmtTablespacelmt
Tablespacelmt
 
Sql scripting sorcerypresentation
Sql scripting sorcerypresentationSql scripting sorcerypresentation
Sql scripting sorcerypresentation
 
Sql scripting sorcerypaper
Sql scripting sorcerypaperSql scripting sorcerypaper
Sql scripting sorcerypaper
 
Sql for dbaspresentation
Sql for dbaspresentationSql for dbaspresentation
Sql for dbaspresentation
 
Rollbacklmt
RollbacklmtRollbacklmt
Rollbacklmt
 
Rollback1555s
Rollback1555sRollback1555s
Rollback1555s
 
Redosize
RedosizeRedosize
Redosize
 
Real liferecoverypresentation
Real liferecoverypresentationReal liferecoverypresentation
Real liferecoverypresentation
 
Real liferecoverypaper
Real liferecoverypaperReal liferecoverypaper
Real liferecoverypaper
 
Perfstats
PerfstatsPerfstats
Perfstats
 
Oracledates
OracledatesOracledates
Oracledates
 
Ora12154
Ora12154Ora12154
Ora12154
 
Nologging
NologgingNologging
Nologging
 

Rollbackblocking

  • 1. Blocking Transactions Administration Tips Blocking Transactions A blocking transaction is any transaction that is left uncommitted or un-rolled back by a User for a period of time sufficient to prevent the normal re-use of rollback segment extents. Ordinarily, a rollback segment will place rollback generated by successive transactions in its extents in sequential order. That is, it will fill up the first extent with a variety of transactions’ rollback, then the second, then the third, and so on. When all extents have been filled in this way, it returns to the first one and simply proceeds to overwrite the older rollback information with new data. However, a rollback segment is never permitted to overwrite the contents of a particular extent if, in any part of that extent, there is rollback belonging to an active transaction (one that is either uncommitted or un-rolled back). This rule is there for what are hopefully obvious reasons! When prevented or blocked from re-using earlier extents in this way, the rollback segment is forced instead to acquire additional new extents. New transactions may therefore continue to house their rollback data in the new extents. But frequent extent acquisition is usually a bad thing for performance (less so in locally managed tablespace, it is true), and in any case it is not exactly good practice to start losing large chunks of disk space to an ever-growing rollback segment just because a User can’t be bothered to finish their transaction properly. In fact, rollback segments will continue to acquire extents forever if the blocking transaction is not committed or rolled back –or at least, they will try to continue acquiring extents until either MAXEXTENTS is reached, or they physically run out of space in the tablespace. At that point, the transaction needing the extra rollback space will simply fail. Therefore the existence of long-standing active transactions which prevent the re-use of existing extents, and thereby induce heavy extent acquisition, is a problem which needs to be monitored and –where appropriate- dealt with. To detect transactions which have failed to commit or rollback, and which are thus at risk of blocking the normal operation of a rollback segment, issue the following query from within SQL Plus (the first two lines are column formatting options which are not recognised in other applications, such as Server Manager): COL USERNAME FORMAT A15 COL NAME FORMAT A15 SELECT S.USERNAME, S.SID, S.SERIAL#, T.START_TIME, N.NAME FROM V$SESSION S, V$TRANSACTION T, V$ROLLSTAT R, V$ROLLNAME N WHERE S.SADDR=T.SES_ADDR AND R.USN=N.USN AND TO_DATE(T.START_TIME,’MM/DD/YY HH24:MI:SS’)<(SYSDATE-(1/24)); Copyright © Howard Rogers 2001 10/17/2001 Page 1 of 2
  • 2. Blocking Transactions Administration Tips That produces a report looking something like this: USERNAME SID SERIAL# START_TIME NAME ------------- ---------- ---------- ----------------- --------------- SCOTT 8 12 16/10/01 10:00:42 _SYSSMU2$ … and this shows us that Scott has a transaction still active in the rollback segment called ‘_SYSSMU2$’, and that it’s been active since 10 o’clock on the 16th October 2001. Because of the last line in the query, the report will only show transactions which are still active, having started more than an hour ago. If you wished to monitor with a finer or lesser degree of granularity, you could edit the last line. For example, “<(SYSDATE-(0.5/24));” would give you transactions that started over half an hour ago. And “<(SYSDATE-(2/24));” would give you those that began more than 2 hours ago. Incidentally, note that the START_TIME column from v$transaction, which is being used for this particular test, is stored as a VARCHAR2 data type, not as a DATE field. That means that the formatting string I’ve shown above is fixed. It does not depend on your database language, nor on whatever NLS parameters and variables may be set in your environment. The above query should work, unchanged, just as well as on a Japanese database as on a Russian one. Crucially, the report shows you the User involved, and their SID and SERIAL# (the two numbers which uniquely identify any session in Oracle). The polite approach at this point is to contact the listed User(s) and ask them to do something with their transactions. The rather more brutal (and some might say “typically DBA”) thing to do would be to issue the following command: ALTER SYSTEM KILL SESSION ‘8,12’; … you supply whatever the earlier report identifies as the relevant SID and SERIAL# numbers in the closing quotes there. This causes that User’s session to be immediately terminated, whatever they are doing, and as a result, their transaction gets automatically rolled back –thereby ceasing to be a blocking transaction, of course –and permits the rollback segment to resume its normal, cyclical re-use of old extents. Be careful though: the report identifies transactions which started a certain period of time ago. A huge batch update that happens to chug along doing its stuff for several hours is just as likely to appear on the report as a short one that’s been accidentally left uncommitted for hours. But you really ought to distinguish between big transactions that just happen to take a long time to complete, and old transactions which are sitting there uncommitted simply because the User’s gone off to do something more exciting instead. It’s really only the latter sort of transaction that merits being killed off. Copyright © Howard Rogers 2001 10/17/2001 Page 2 of 2