Saturday, May 17, 2008

ORA-19573: cannot obtain exclusive enqueue for datafile 1

Problem Description:
---------------------------

Whenever you try to restore a datafile or restore database it failed with following message,
SQL> !rman TARGET /

Recovery Manager: Release 10.2.0.1.0 - Production on Sat May 17 06:06:34 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: DBASE (DBID=1509380669)

RMAN> RUN{
2> SET UNTIL SCN 1364008;
3> RESTORE DATABASE;
4> RECOVER DATABASE;
5> }

.
.
.
ORA-19573: cannot obtain exclusive enqueue for datafile 1

Cause of The problem:
---------------------------

If you try to Restore database then your target database must be in mounted stage but not open. If the database is in open state then whenever you give restore then restore operation is attempting to overwrite the currently active version of the datafile and hence the error comes. Alternatively , whenever a datafile is online and you attempt to restore that datafile the error will come.

Solution of The problem:
------------------------------

Check the status of database or the datafile which you want to restore.
In case of database,

SQL> SELECT STATUS FROM V$INSTANCE;
STATUS
--------
OPEN

In case of Datafile,
SQL> select FILE# , STATUS from V$DATAFILE;

If you want to restore database then mount the database like,
SQL>SHUTDOWN IMMEDIATE;
SQL>STARTUP MOUNT;


If you want to restore a datafile make the datafile offline Like,
SQL>ALTER DATABASE DATAFILE 4 OFFLINE;
And then perform
RMAN>RESTORE DATAFILE 4;

5 comments:

  1. Thanx dear

    ReplyDelete
  2. Hi buddy...just small mistake in the second last statement...

    It should be OFFLINE and not ONLINE.

    SQL>ALTER DATABASE DATAFILE 4 OFFLINE;

    Cheers..!!

    ReplyDelete
  3. read properly... you are restoring the datafile and it should be offline.

    ReplyDelete