Beruflich Dokumente
Kultur Dokumente
Handlin
g
Rollback
Segment
Corrupti
ons in
Oracle7.
3 to 8.1.7
Doc ID:
Note:106
638.1
Type:
BULLE
TIN
Last
Revision
Date:
23-NOV-
2007
Status:
PUBLIS
HED
This articles is
best read in an HTML enabled browser / email client.
Click here to "Skip the Introduction".
IMPORTANT: If you have already forced the database open using unsupported methods (eg:
_allow_resetlogs_corruption or _corrupted_rollback_segments) then this note is of limited use
to you as you MUST then rebuild the database. See Note 41399.1 for that scenario.
Introduction
Advanced Notes
What are _OFFLINE_ROLLBACK_SEGMENTS
What are _CORRUPTED_ROLLBACK_SEGMENTS
Differences between these Parameters
List of Useful Events
List of Common ORA-600's
The errors below each have their own section towards the END of this
article. If you have one of these errors go to the relevant section
first.
• Startup Errors:
o ORA-1578 on Startup
o ORA-1545 during Startup
• Errors after Startup:
o DBA_ROLLBACK_SEGS entry of status "NEEDS RECOVERY"
o DBA_ROLLBACK_SEGS entry of status "PARTLY AVAILABLE"
o ORA-1545 during DROP ROLLBACK SEGMENT <rbsname>
o ORA-1546: tablespace contains active rollback segment '<rbsname>'
o Error 376 encountered while recovering transaction (A, B) on object YYYY.
o Error 600 encountered while recovering transaction (A, B) on object YYYY.
o Error XXXX encountered while recovering transaction (A, B). (no object
YYYY listed)
o ORA-1578 on a Rollback Segment Header
o ORA-1578 on a Rollback Segment Block
o ORA-1578 on a REQUIRED Rollback Segment Block
NOTE: If below query are run other then sys user please specify the schema
name for respective dictionary tables .
Actions:
1. Oracle needs access to the rollback segment header in order to
know if a rollback segment contains active transactions or not.
What we can do next depends on the FILESTATUS and STATUS$ entries
returned from the following query:
Oracle8:
SELECT u.us#, u.name RBSNAME,
u.status$,
r.status ROLLSTAT,
f.status FILESTATUS,
f.name FILENAME
FROM undo$ u, v$datafile f , V$rollstat r
WHERE f.rfile#=u.file#
AND f.ts#=u.ts#
AND r.usn(+)=u.us#
AND u.name='<rbsname>'
;
Oracle7:
SELECT u.us#, u.name RBSNAME,
u.status$,
r.status ROLLSTAT,
f.status FILESTATUS,
f.name FILENAME
FROM undo$ u, v$datafile f , V$rollstat r
WHERE f.file#=u.file#
AND r.usn(+)=u.us#
AND u.name='<rbsname>'
;
Query Columns:
~~~~~~~~~~~~~~
US# Is the Undo Segment number (known as USN, US# or
SEGMENT_ID)
RBSNAME Is the rollback segment name
STATUS$ Is the numeric status of the rollback segment in UNDO$
This is visible in decoded text form in DBA_ROLLBACK_SEGS
ROLLSTAT Is the status in V$ROLLSTAT - this is for information
only
and shows if a currently ONLINE rollback segment is
PENDING OFFLINE or if it is FULL
FILESTATUS Is the status of the FILE containing the rollback segment
header.
FILENAME Is the NAME of the file containing the rollback segment
header.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rollback Segment Datafile needs recovery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If FILESTATUS is "RECOVER" or "OFFLINE" then the rollback
segment header is not accessible and the next action depends
on the value of UNDO$.STATUS$:
Recover the datafile to the current point in time and online it.
This is only possible if the database is in ARCHIVELOG mode.
eg:
Restore it at OS level from a good backup,
RECOVER DATAFILE 'name_of_file';
ALTER DATABASE DATAFILE 'name_of_file' ONLINE;
Once the file is online then the RBS header should now be visible.
Go back to "Recovering Rollback Segments" to check on the status
of the rollback segment.
STATUS$ = 4 (invalid)
STATUS$=4 is an invalid status.
a. Recover the datafile to the current point in time and online it.
This is only possible if the database is in ARCHIVELOG mode.
eg: Save the current copy of the file
Restore a good backup of the file
RECOVER DATAFILE '<name>'
ALTER DATABASE DATAFILE '<name>' ONLINE;
If the file cannot be recovered or brought online you will have
to revert to an old point-in-time or rebuild - see "Last
Options".
b. Once the file is online then the RBS header should be visible.
However, you cannot assume that everything is now fine as it
is possible that there is a corruption in the file you have
just put online.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RBS Header Accessible
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If the rollback segment header is accessible we need to find out if
the rollback segment still needs to be recovered and if so why.
The next action depends on the value of UNDO$.STATUS$:
STATUS$ = 4 (invalid)
STATUS$=4 is an invalid status.
a. Check the alert log and SMON trace file for errors
showing why the rollback segment has not been recovered.
eg: The alert log should show messages of the form:
b. If it is not clear what the error is from the alert log then issue
the command:
Note: Altering the rollback segment online will only show an error
if
the rollback segment is not currently shown as online in UNDO$
(ie: if status$!=3) and there is still a problem.
eg1:
If a file required for the rollback is OFFLINE then Oracle
writes
messages to the alert log:
ORACLE Instance V734 (pid = 8) -
Error 376 encountered while recovering transaction (4,8)
on object 1379.
Errors in file /.../udump/v734_ora_6661.trc:
ORA-00376: file 9 cannot be read at this time
ORA-01110: data file 9: '/tmp/RPcor2.dbf'
ORA-1608 signalled during: alter rollback segment rprbs
online...
eg2:
If the rollback segment header is CORRUPT then Oracle writes an
ORA-1578 to the alert log and signals an error to the user
session:
eg3:
If the rollback segment header is fine and all transactions can
be
rolled out then onlining the rollback segment will succeed.
eg4:
If the "ALTER ROLLBACK SEGMENT rprbs ONLINE;" returns
ORA-1608 but there is no additional error in the alert log then
check if you have an _OFFLINE_ROLLBACK_SEGMENTS parameter set:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Checking for active transactions on a rollback segment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To check for any active transactions on a rollback segment:
If this returns rows then these transactions must commit or roll back
before the rollback segment can be considered fully recovered.
Note: If the select returns no rows do not immediately assume that the
rollback segment is clear of any transactions - if Oracle cannot
see the rollback segment header then the above select will show no
rows. If you are not sure if the rollback segment header is
accessible then perform these steps:
PREPARED / DEAD
~~~~~~~~~~~~~~~
A failed distributed transaction which needs to either commit or
roll back. This note does not go into detail of how to correctly
resolve failed distributed transactions but if this rollback segment
is causing problems and needs this transaction removed one can
FORCE COMMIT or FORCE ROLLBACK the transaction.
The steps here are safety checks to perform prior to dropping a rollback
segment. Please check all steps:
If the rollback segment you want to drop is listed here, or this list
is longer than about 60 characters check the parameter in the init.ora
file. It is VITAL that any rollback segment to be DROPPED is NOT listed
in an _OFFLINE_ROLLBACK_SEGMENTS parameter. See "What are
_OFFLINE_ROLLBACK_SEGMENTS")
If the rollback segment is listed in this parameter:
Shutdown the database
Remove the rollback segment from the _OFFLINE_ROLLBACK_SEGMENTS list
Startup
Go to "Recovering Rollback Segments" and check out the rollback
segment
If the DROP returns and ORA-1545 OR the STATUS above is NOT "OFFLINE"
then go back to "Recovering Rollback Segments" to check out this
rollback segment.
"Last Options"
This section outlines the absolute final options available for recovering
a database. If you have come here then one or more of the following
have happened:
Last chance:
Please note if you have lost all copies of a datafile but DO still have
the ARCHIVE logs from when the file was first created it is still
possible
to recover the file.
Eg:
ALTER DATABASE CREATE DATAFILE '....' [as '...'] ;
RECOVER DATAFILE '....'
ALTER DATABASE DATAFILE '....' ONLINE;
If you are in this scenario try to recover the datafile using these
steps before proceeding below.
If you have reached this line there are no options left to keep the
CURRENT version of the database up and running in a fully supported
manner.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
~~~~~~~~~~~~~~
Startup Errors
~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
ORA-1578 on Startup
~~~~~~~~~~~~~~~~~~
An ORA-1578 on startup is usually bad news and relates to either a
corrupt
rollback segment header, or a corrupt block being referenced during
bootstraping of the instance.
eg:
Database mounted.
ORA-01578: ORACLE data block corrupted (file # 11, block # 2)
ORA-01110: data file 1198: '/tmp/RPrbcor.dbf'
SVRMGR>
Actions:
1. Shutdown the instance (or you may get ORA-704/ORA-604/ORA-955 when you
next try to open the database)
eg: SHUTDOWN ABORT
If you are using PUBLIC rollback segments then also set the init.ora
parameter TRANSACTIONS to a small number (about 20) and
TRANSACTIONS_PER_ROLLBACK_SEGMENT to the same number . Additionally
try to find one rollback segment which is known to be good and set
this in the ROLLBACK_SEGMENTS parameter. This is done to try to stop
Oracle needing to online any PUBLIC rollback segment when the database
opens. If there are no rollback segments you know to be good you can
try this step several times using different named rollback segments.
eg: TRANSACTIONS=20
TRANSACTIONS_PER_ROLLBACK_SEGMENT=20
ROLLBACK_SEGMENTS=(OK_RBS)
5. If the above has not allowed you to open the database then the next
step is to attempt to offline the problem file:
eg:
SHUTDOWN ABORT
STARTUP MOUNT
ALTER DATABASE DATAFILE 'name_of_file' OFFLINE;
ALTER DATABASE OPEN;
6. If the database opens check which object has the ORA-1578 error.
WARNING: On Oracle8 you need the file number from the accompanying
ORA-1110 error.
For any other object see Note 28814.1 on how to handle block
corruptions.
~~~~~~~~~~~~
NOARCHIVELOG
~~~~~~~~~~~~
If an attempt to OFFLINE the problem file raises "ORA-01145: offline
immediate disallowed unless media recovery enabled" then the database is
not running in ARCHIVELOG mode. This SEVERELY limits the recovery
options.
The fact you have an ORA-1578 during startup means we need to see the
corrupt file / block. It is most likely a corrupt rollback segment
block - it may be possible to check this using the following steps.
1. SHUTDOWN ABORT
3. Edit the INIT.ORA file and comment out the ROLLBACK_SEGMENTS clause
7. Once the database is open you can query DBA_EXTENTS to check the exact
object:
WARNING: On Oracle8 you need the file number from the accompanying
ORA-1110 error.
~~~~~~~~~~~~~~~~~~~~~~~
ORA-1545 during Startup
~~~~~~~~~~~~~~~~~~~~~~~
This means that the named rollback segment is listed in the
ROLLBACK_SEGMENTS init.ora parameter and that this rollback segment
is not available. This is usually because the datafile containing the
rollback segment header is offline.
eg: Database mounted
ORA-01545: rollback segment '<rbsname>' specified not available
If you are running Oracle Parallel Server (OPS) then ORA-1545 can also be
signaled if another instance currently has the named rollback segment in
use.
Actions:
1. Make a note of the rollback segment name in the error
2. Check for any offline files that may contain this rollback segment.
eg: SELECT name FROM v$datafile
WHERE status not in ('ONLINE','SYSTEM');
5. Restore, online and recover any file you suspect may contain the
missing rollback segment (as determined in step 2 above).
This is only possible if you are in ARCHIVELOG mode.
eg: Save any current copy of the file
Restore a good backup copy of the file
ALTER DATABASE DATAFILE 'name_of_file' ONLINE;
RECOVER DATABASE
7. Assuming the database now starts up the you need to check if the
rollback segment needs recovering.
Go to "Recovering Rollback Segments"
~~~~~~~~~~~~
Other Errors
~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DBA_ROLLBACK_SEGS entry of status "NEEDS RECOVERY"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The DBA_ROLLBACK_SEGS view shows a rollback segment as "NEEDS RECOVERY"
if Oracle cannot see the rollback segment header or if there is a problem
encountered when attempting to roll out a transaction (eg: a tablespace
or
datafile required to roll out a transaction is OFFLINE).
Actions:
1. Make a note of the SEGMENT_NAME for the DBA_ROLLBACK_SEGS row
which has STATUS set to "NEEDS RECOVERY"
eg:
SELECT segment_id, segment_name
FROM dba_rollback_segs
WHERE status='NEEDS RECOVERY';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DBA_ROLLBACK_SEGS entry of status "PARTLY AVAILABLE"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The DBA_ROLLBACK_SEGS view shows a rollback segment as "PARTLY AVAILABLE"
if it is otherwise OFFLINE and either:
In case 'a' SMON will continue to roll out any active transactions in the
rollback segment and finally mark it as 'OFFLINE'. If an error is
encountered preventing a transaction from rolling out the status is
changed
to "NEEDS RECOVERY".
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ORA-1545 during DROP ROLLBACK SEGMENT <rbsname>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ORA-1545 may be signalled during a "DROP ROLLBACK SEGMENT" if the
rollback segment is currently online.
eg: SVRMGR> drop rollback segment rprbs;
drop rollback segment rprbs
*
ORA-01545: rollback segment '<rbsname>' specified not available
Actions:
1. Check the status of the rollback segment in DBA_ROLLBACK_SEGS.
eg: SELECT segment_id, status FROM dba_rollback_segs
WHERE segment_name = '<rbsname>';
Note the SEGMENT_ID and STATUS for the steps below.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ORA-1546: tablespace contains active rollback segment '<rbsname>'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The named tablespace contains an active rollback segment as named
in the error.
Actions:
1. Offline the named rollback segment:
eg: ALTER ROLLBACK SEGMENT <rbsname> OFFLINE;
~~~~~~~~~~~~~~
Error 376 encountered while recovering transaction (A, B) on object YYYY.
~~~~~~~~~~~~~~
(A, B) shows the rollback segment id and slot number (USN , SLOT)
YYYY shows the object id (NOT the data object id)
~~~~~~~~~~~~~~
Error 600 encountered while recovering transaction (A, B) on object YYYY.
~~~~~~~~~~~~~~
(A, B) shows the rollback segment id and slot number (USN , SLOT)
YYYY shows the object id (NOT the data object id)
The fact that an object is listed in the error implies the ORA-600
is most likely related to the target block of the undo, and not the
undo block itself. If the ORA-600 is a block checking related
error then there is a strong chance that block level recovery will
re-try the operation and mark the block as corrupt thus resulting in
the transaction being recovered (as we skip over corrupt blocks as
described in "Discarding Undo in Note 105871.1"). If the block does
not get marked as corrupt then the ORA-600 will prevent the transaction
rollback from completing.
Identifying the file requires you to look at the trace for the ORA-600
and hope that it indicates the problem block. How to do this depends
on the ORA-600 - see any reference note relating to the exact ORA-600
you are seeing.
~~~~~~~~~~~~~~
Error XXXX encountered while recovering transaction (A, B).
~~~~~~~~~~~~~~
Note this error has no "on object ...." clause in the error.
This is reported to the alert log when error XXXX is encountered on
a rollback segment block.
If the error is 376 then a file containing part of the rollback segment
is offline. Online the named file - there should be an addition error
similar to this in the alert log:
ORA-00376: file 23 cannot be read at this time
ORA-01110: data file 8: '/tmp/RPrbs2.dbf'
~~~~~~~~~~~~~~
ORA-1578 on a Rollback Segment Header
~~~~~~~~~~~~~~
If there is an ORA-1578 on the rollback segment header Oracle cannot
know if there are any active transactions in that rollback segment.
What to do depends on whether we really do need the rollback segment
header. This scenario is the same as ORA-1578 on a rollback segment
block except that if segment header is needed there are more possible
side effects from the corruption.
If you are in ARCHIVELOG mode with a good backup then the best option
is to offline, restore and then recover the file and bring it back
online.
This is only possible if the database is in ARCHIVELOG mode.
eg: ALTER DATABASE DATAFILE 'name_of_file' OFFLINE;
Save the current copy of the file
Restore it at OS level from a good backup,
RECOVER DATAFILE 'name_of_file';
ALTER DATABASE DATAFILE 'name_of_file' ONLINE;
If the recovery has produced a good file then the rollback segment can
be recovered. Go to "Recovering Rollback Segments"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ORA-1578 on a Rollback Segment Block
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If an ORA-1578 occurs on a rollback segment block there are 2 main
scenarios:
a. The corruption is in an undo chain that needs to be rolled back
(ie: the block is needed)
or
b. The corruption is in an undo block which is only being used
for consistent read and is not needed to roll out a transaction.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ORA-1578 on a REQUIRED Rollback Segment Block
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For this scenario you typically will have an error of the form:
in the alert log. Note the lack of "on object ..." in this message.
Basically this shows that a block in a rollback segment which is
required to roll out a transaction has been corrupted:
2. Offline, restore and then recover the file and bring it back online.
This is only possible if the database is in ARCHIVELOG mode.
If the recovery has produced a good file then the rollback segment
can be recovered.
Go to "Recovering Rollback Segments"
*********************************************************************
ORACLE will not support a database that has had a rollback segment
dropped while it was listed in _OFFLINE_ROLLBACK_SEGMENTS.
*********************************************************************
*********************************************************************
ORACLE will not support a database that has used the
_CORRUPTED_ROLLBACK_SEGMENTS parameter.
*********************************************************************
Differences between these parameters