How undo Space Allocation Works  

Posted by Mawahid


In two different scenarios two different mechanisms is used to allocate undo space.

 
A)Whenever a new transaction needs undo space:
-------------------------------------------------


1)First , oracle tries to find a undo segment which has no active transaction and allocate the extent within the undo segment.

2)If no such undo segment found then oracle tries to make online of and off-line undo segment and use it.

3)If no such off-line undo segment found then create a new undo segment and use it.

4)If there is no sufficient space to create a new undo segment then it try to reuse an expired extent from the existing undo segment.


B)Whenever a running transaction needs more undo space:
------------------------------------------------------------

 
1)If current extent has more free blocks? If it has then allocate the next free block within the extent.

2)If current extent does not have free blocks then check the next extent within the segment. If the next extent is expired then wrap the next extent and allocate the first block of the next extent.

3)If the next extent is not expired then get space from UNDO tablespace.If a free extent is available then allocate it to the undo segment and return the first block in the new extent.

4)If there is no free space available then take space from offline undo segment. Deallocate the extent from the offline undo segment and add it to the current undo segment. Return the first free block of the extent.

5)If there is no offline undo segment then deallocate the extent from the online undo segment and add it to the current undo segment. Return the first free block of the extent.

6)If it fails then extend the datafile of the undo tablespace.If the file can be extended then add an extent to the current undo segment then return the block.

7)If the extend datafile fails then try to reuse extents from its own undo segments. If it is not busy then warp into the next extent.

8)If reuse extents from its own undo segment fails i.e they contain uncommitted transaction then take unexpired extents from it's own offline undo segments.

9)If it fails then take unexpired extents from it's own online undo segments.

10)If all above fails then ORA-30036 (unable to extend segment by %s in undo tablespace '%s' ) arises.

This entry was posted on Tuesday, January 11, 2011 at 7:41 AM . You can follow any responses to this entry through the comments feed .

0 comments

Post a Comment