Skip to content
Home » Oracle » How to Resolve ORA-45909: restore, recover or block media recovery may be in progress

How to Resolve ORA-45909: restore, recover or block media recovery may be in progress

ORA-45909

Tried to restore a data file by RMAN, it failed with ORA-45909, ORA-19890 and ORA-19573.

RMAN> restore datafile 13;
...
ORA-19870: error while restoring backup piece /u01/app/oracle/fast_recovery_area/ORA19C1/AA736F65D66215CCE053992AA8C08959/backupset/2023_05_04/o1_mf_nnndf_TAG20230504T022648_l56n1r6l_.bkp
ORA-19573: cannot obtain exclusive enqueue for datafile 13
ORA-19890: data file already in use
ORA-45909: restore, recover or block media recovery may be in progress

ORA-45909 means that the data file you want to restore is in use. The data file could be online, restoring, recovering or applying redo logs by another process, so there's no way to overwrite it

Solutions

To solve it, we explain solutions respectively.

  1. Datafile is Online
  2. Datafile is Restoring or Recovering
  3. Datafile is Applying Redo Logs

Datafile is Online

If the datafile is online, you may offline it in order to restore it.

ALTER DATABASE DATAFILE OFFLINE

We can take a single data file offline.

SQL> alter database datafile 13 offline;

Database altered.

That's right, you can restore data files when the database is at open state as long as you offline the targets. Later on, you may need to recover the data file to the most recent state.

ALTER TABLESPACE OFFLINE

Taking the whole tablespace offline is safer.

SQL> alter tablespace example offline;

Tablespace altered.

Restart Database to MOUNT

For global fixing, you should restart the database to MOUNT state.

Datafile is Restoring or Recovering

If it is the case, you may find the blocking operation then cancel it, then issue your command again. Most likely, another process is recovering data files.

Datafile is Applying Redo Logs

This is very normal for a standby database, moreover, it's Managed Recovery Process (MRP) working on it, so please make sure that you still want to restore it. If the answer is positive, please stop data guard before restoring data files.

Leave a Reply

Your email address will not be published. Required fields are marked *