Subject:            ROLLBACK SEGMENT NEEDS RECOVERY
Author:             YLIEN
Last Revision Date: 17 June      1995



                   Rollback Segment Needs Recovery

OVERVIEW
--------
        This bulletin discusses why a rollback segment is the status of
"needs recovery", what the status means, and how to resolve it.

INTRODUCTION
------------
        Rollback segments can be monitored through the data dictionary view,
dba_rollback_segs. There is a status column that describes what state the
rollback segment is currently in. Normal states are either online or offline.
Occasionally, the status of "needs recovery" will appear.

        When a rollback segment is in this state, bringing the rollback segment
offline or online either through the alter rollback segment command or
removing it from the rollback_segments parameter in the init.ora usually has no
effect.

UNDERSTANDING
-------------
        A rollback segment falls into this status of needs recovery whenever
Oracle tries to roll back an uncommitted transaction in its transaction
table and fails.

Here are some examples of why a transaction may need to rollback:
  1-A user may do a dml transaction and decides to issue rollback
  2-A shutdown abort occurs and the database needs to do an instance recovery
    in which case, Oracle has to roll back all uncommitted transactions.

        When a rollback of a transaction occurs, undo must be applied to the
data block the modified row/s are in.  If for whatever reason, that data
block is unavailable, the undo cannot be applied. The result is a 'corrupted'
rollback segment with the status of needs recovery.

What could be some reasons a datablock is unaccessible for undo?
  1-If a tablespace or a datafile is offline or missing.
  2-If the object the datablock belongs to is corrupted.
  3-If the datablock that is corrupt is actually in the rollback segment
    itself rather than the object.

HOW TO RESOLVE IT
-----------------
1-MAKE sure that all tablespaces are online and all datafiles are
  online. This can be checked through v$datafile, under the
  status column.  For tablespaces associated with the datafiles,
  look in dba_tablespaces.

If that still does not resolve the problem then

2-PUT the following in the init.ora-
  event = "10015 trace name context forever, level 10"

        Setting this event will generate a trace file that will reveal the
        necessary information about the transaction Oracle is trying to roll
        back and most importantly, what object Oracle is trying to apply
        the undo to.

3-SHUTDOWN the database (if normal does not work, immediate, if that does
  not work, abort) and bring it back up.

        Note: An ora-1545 may be encountered, or other errors. If the database
              cannot startup, contact customer support at this point.

4-CHECK in the directory that is specified by the user_dump_dest parameter
  (in the init.ora or show parameter command) for a trace file that was
  generated at startup time.

5-IN the trace file, there should be a message similiar to-
  error recovery tx(#,#) object #.

        TX(#,#) refers to transaction information.
        The object # is the same as the object_id in sys.dba_objects.

6-USE the following query to find out what object Oracle is trying to
  perform recovery on.

        select owner, object_name, object_type, status
        from dba_objects where object_id = <object #>;

7-THIS object must be dropped so the undo can be released. An export or relying
  on a backup may be necessary to restore the object after the corrupted
  rollback segment goes away.

8-AFTER dropping the object, put the rollback segment back in the init.ora
  parameter rollback_segments, removed the event, and shutdown and startup
  the database.

In most cases, the above steps will resolve the problematic rollback segment.
If this still does not resolve the problem, it may be likely that the
 corruption is in the actual rollback segment.
At this point, if the problem has not been resolved, please contact
 customer support.