Beruflich Dokumente
Kultur Dokumente
and recover
This is a recovery scenario in which a datafile in a rollback segment
tablespace has been lost or damaged to a point that Oracle cannot recognize it
anymore. Trying to startup the database will result in ORA-1157, ORA-1110, and
possibly an operating system level error such as ORA-7360. Trying to shut down
the database in normal or immediate mode will result in ORA-1116, ORA-1110,
and possibly an operating system level error such as ORA-7368.
Solution
=========
The approach to be followed depends on the specific scenario in which
the loss of the rollback datafile is detected:
I. THE DATABASE IS DOWN
If you are ABSOLUTELY POSITIVE that the database was cleanly shutdown,
i.e., it was closed with either shutdown NORMAL or IMMEDIATE, then
the simplest solution is to offline drop the missing datafile, open the
database in restricted mode, and then drop and recreate the undo
tablespace to which the file belonged. DO NOT follow this procedure
if the database was shut down ABORT or if it crashed.
The steps are:
1. Make sure the database was last cleanly shut down.
Check the alert.log file for this instance. Go to the bottom of
the file and make sure the last time you shut the database down
you got the messages:
Shutting down instance (immediate)
OR
alter database close normal
Completed: alter database close normal
This will list all your online redolog files and their respective
sequence and first change numbers.
5. If the database is in NOARCHIVELOG mode, issue the query:
SQL> SELECT FILE#, CHANGE# FROM V$RECOVER_FILE;
If the CHANGE# is GREATER than the minimum FIRST_CHANGE# of your
logs, the datafile can be recovered. Just keep in mind that all the
logs to be applied will be online logs, and move on to step 6.
If the CHANGE# is LESSER than the minimum FIRST_CHANGE# of your logs,
the file cannot be recovered. Your options at this point include
restoring a full backup if one is available or forcing the database
to open in an inconsistent state to get a full export out of it.
For further details and to assist you in your decision, please contact
Oracle Support Services.
6. Recover the datafile:
SQL> RECOVER DATAFILE <full_path_file_name>
7. Confirm each of the logs that you are prompted for until you receive
the message Media recovery complete. If you are prompted for a
non-existing archived log, Oracle probably needs one or more of the
online logs to proceed with the recovery. Compare the sequence number
referenced in the ORA-280 message with the sequence numbers of your online
logs. Then enter the full path name of one of the members of the redo group
whose sequence number matches the one you are being asked for. Keep entering
online logs as requested until you receive the message Media recovery
complete.
8. Open the database:
SQL> ALTER DATABASE OPEN;
II. THE DATABASE IS UP
If you have detected the loss of the rollback datafile and the database
is still up and running, DO NOT SHUT IT DOWN. In most cases, it is
simpler to solve this problem with the database up than with it down.
Two approaches are possible in this scenario:
A) The first approach involves creating a new UNDO (or rollback segment)
tablespace, altering the system to use the new and dropping the old.
B) The other approach involves offlining the lost datafile, restoring it from
backup, and then applying media recovery to it to make it consistent
with the rest of the database. This method can only be used if
the database is in ARCHIVELOG mode.
In general, approach IIA is simpler to try first, however, depending on
activity and undo usage, the drop of the older tablespace may result
in error regarding active transactions. There are a few things to try to
get the older tablespace to drop, but if all fail, approach IIB may be required.
APPROACH II.A: RECREATING THE ROLLBACK TABLESPACE
This approach can be used regardless of the archival mode of the database.
The steps are:
For undo tablespaces:
1. Create new tablespace to house rollback segments. For spacing and extent
sizing, see information in dba_tablespaces for old rollback segment tablespace.
SQL> CREATE TABLESPACE ..
2. Create rollback segments in this tablespace
SQL> CREATE ROLLBACK SEGMENT..
NOTE, although automatic undo and undo tablespace is used by the database,
the following procedure is the same. The only difference is that the segment
names are assigned by Oracle.
1. Check for any rollback segments online.
SQL> SELECT SEGMENT_NAME, STATUS FROM DBA_ROLLBACK_SEGS
WHERE TABLESPACE_NAME = <OLD TABLESPACE_NAME>;
If any of the rollbacks you tried to offline still has an ONLINE status,
this is usually an indication that this segment contains active transactions.
2. Check for active transactions with the following query: