RMAN Restore/Recover a database UNTIL TIME
Below are the steps for Restoring/ Recovering an Oracle database until a specific time in the past:
1) Set the environment:
on Windows:
set ORACLE_SID=DB10
echo %ORACLE_SID%
on AIX/Linux:
export $ORACLE_SID=DB10
echo $ORACLE_SID
2) Connect to rman:
rman target / nocatalog
3) Start the database in "mount" state:
startup mount;
4) Run the following :
Restore:
restore database UNTIL TIME "to_date('08/07/2020 06:15:00 pm','mm/dd/yyyy hh:mi:ss am')";
Recover:
recover database UNTIL TIME "to_date('08/07/2020 06:15:00 pm','mm/dd/yyyy hh:mi:ss am')";
alter database open resetlogs;
OR
run
{
set UNTIL TIME "to_date('08/07/2020 06:15:00 pm','mm/dd/yyyy hh:mi:ss am')";
restore database;
recover database;
alter database open resetlogs;
}
Note:
We cannot restore/recover the database in "open" state, below error you faced while doing it.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/07/2020 18:50:14
ORA-19870: error while restoring backup piece C:\XE_INSTALL\BACKUP\FULL08V79FL2
ORA-19573: cannot obtain exclusive enqueue for datafile 2
No comments:
Post a Comment