6.4 Recovering a Database Using Incomplete Recovery
6.4.1 Create table and backup database
RMAN> backup database plus archivelog delete input;
6.4.2 Incomplete database recovery using SCN
-> Table before Recovery :
ID INFO
———- ——————————————————————–
1 Initial_insert: 1124020 – Seq#: 5 – Date: 20-FEB 08:50:46
2 New Insert SCN: 1124226 – Seq#: 8 – Date: 20-FEB 08:53:29
3 New Insert SCN: 1124251 – Seq#: 9 – Date: 20-FEB 08:54:14
4 New Insert SCN: 1124321 – Seq#: 10 – Date: 20-FEB 08:55:57
5 New Insert SCN: 1124690 – Seq#: 11 – Date: 20-FEB 09:04:19
6 New Insert SCN: 1124758 – Seq#: 12 – Date: 20-FEB 09:06:10
7 New Insert SCN: 1124806 – Seq#: 13 – Date: 20-FEB 09:08:00
RMAN> startup force mount ;
RMAN> restore database untill SCN 1124691;
RMAN> recover database until SCN 1124691;
RMAN> alter database open resetlogs;
-> Table after Recovery :
ID INFO
———- ——————————————————————–
1 Initial_insert: 1124020 – Seq#: 5 – Date: 20-FEB 08:50:46
2 New Insert SCN: 1124226 – Seq#: 8 – Date: 20-FEB 08:53:29
3 New Insert SCN: 1124251 – Seq#: 9 – Date: 20-FEB 08:54:14
4 New Insert SCN: 1124321 – Seq#: 10 – Date: 20-FEB 08:55:57
Full output from used Recovery commands !
6.4.3 Incomplete database recovery using Date clause and RMAN script
-> Table before Recovery :
ID INFO
———- ——————————————————————–
1 Initial_insert: 1124020 – Seq#: 5 – Date: 20-FEB 08:50:46
21 New Insert SCN: 1125704 – Seq#: 2 – Date: 20-FEB 09:41:29
22 New Insert SCN: 1125783 – Seq#: 3 – Date: 20-FEB 09:44:30
23 New Insert SCN: 1125861 – Seq#: 4 – Date: 20-FEB 09:47:44
RMAN> startup force mount ;
-> Check our backup first
RMAN> RUN
{
set until time “to_date(’20-FEB 09:45:00′,’dd-mon hh24:mi:ss’)”;
RESTORE DATABASE PREVIEW;
}
-> Restore and reocver
RMAN> RUN
{
set until time “to_date(’20-FEB 09:45:00′,’dd-mon hh24:mi:ss’)”;
RESTORE DATABASE ;
recover database;
alter database open resetlogs;
}
-> Table after Recovery :
Connected.
ID INFO
———- ——————————————————————–
1 Initial_insert: 1124020 – Seq#: 5 – Date: 20-FEB 08:50:46
21 New Insert SCN: 1125704 – Seq#: 2 – Date: 20-FEB 09:41:29
22 New Insert SCN: 1125783 – Seq#: 3 – Date: 20-FEB 09:44:30
Full output from used Recovery commands !
6.4.4 Lessons learned in this session
– Point in time backups must be consistent (== must restore all datafiles )
– database need to be openened using RESETLOGS option for incomplete recovery