How do we flashback a database to a guaranteed restore point (GRP) that has 2 tablespaces with flashback off after a RESETLOGS was done?
Flashback fails with the errors below. It fails on the datafiles for the two tablespaces with flashback off.
RMAN-03002: failure of flashback command at 09/27/2013 15:14:24
ORA-38753: Cannot flashback data file 2229; no flashback log data.
ORA-01110: data file 2229: '+
We need to restore the datafiles for the two tablespaces from a backup, offline those same files, flashback to GRP, online the files again then recover to the GRP SCN.
Note: Because RESETLOGS was done we'll also have to reset the incarnation. Otherwise that step can be skipped.
1. Restore the datafiles for those two tablespaces from a backup.
Note: The restored files are dated Sept 26th while all other datafiles are current (Sept 28th). The GRP is Sept 27th.
STATUS CHECKPOINT_CHANGE# FUZ CHECKPOINT_TIME COUNT(*)
------- ---------------------- --- ----------------------------- -----------
OFFLINE 104379205366 NO 26-SEP-2013 21:17:26 1
OFFLINE 104379205549 NO 26-SEP-2013 21:19:06 1
OFFLINE 104379205557 NO 26-SEP-2013 21:19:14 1
OFFLINE 104379205610 NO 26-SEP-2013 21:19:57 1
OFFLINE 104379206069 NO 26-SEP-2013 21:21:29 1
OFFLINE 104379206276 NO 26-SEP-2013 21:22:23 1
OFFLINE 104379206428 NO 26-SEP-2013 21:23:10 1
OFFLINE 104379206445 NO 26-SEP-2013 21:23:21 2
OFFLINE 104379206480 NO 26-SEP-2013 21:23:41 2
OFFLINE 104379206520 NO 26-SEP-2013 21:24:16 1
ONLINE 104398694790 YES 28-SEP-2013 08:42:03 2221
11 rows selected.
Database is currently in MOUNT.
2. After the restore make sure those restored files are OFFLINE before the flashback is done or it will fail with the same errors.
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
3. Flashback to the guaranteed restore point (GRP).
SQL> FLASHBACK DATABASE TO RESTORE POINT '
Starting flashback at 13-09-28 10:20
...
starting media recovery archived log for thread 1 with sequence 843 is already on disk as file +
media recovery complete, elapsed time: 00:00:15
Finished flashback at 13-09-28 10:27
4. Online all the datafiles for the two tablespaces.
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
ALTER DATABASE DATAFILE '+
5. Because the database was opened with resetlogs we have to reset the incarnation to before resetlogs was done.
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1
2 2
3 3
RMAN> reset database to incarnation 2;
database reset to incarnation 2
6. Do RECOVER UNTIL CHANGE using the SCN of the GRP +1. The UNTIL recovers to right before the SCN specified.
SQL> select name,scn,time,database_incarnation#,guarantee_flashback_database,storage_size from v$restore_point;
NAME SCN TIME DATABASE_INCARNATION# GUARANTEE_FLASHBACK_DATABASE STORAGE_SIZE
-------------------- ------------------- -------------------------------------- --- ----------------
1 row selected.
SQL> RECOVER DATABASE UNTIL CHANGE 104390296852;
ORA-00279: change 104379205366 generated at 09/26/2013 21:17:26 needed for thread 1 ORA-00289:
suggestion : +
change 104379205366 for thread 1 is in sequence #788 Specify log: {=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00279: change 104379207088 generated at 09/26/2013 21:27:03 needed for thread 1 ORA-00289:
suggestion : +
change 104379207088 for thread 1 is in sequence #789 ORA-00278: log file '+
....
ORA-00279: change 104390280294 generated at 09/27/2013 11:55:45 needed for thread 1 ORA-00289:
suggestion : +
change 104390280294 for thread 1 is in sequence #843 ORA-00278: log file '+
Media recovery complete.
SYS> alter database open resetlogs;
Database altered.
7. To enable the flashback on tablespaces:
SQL> alter tablespace