一、實驗,如下: --Control fil e三個地方為: 1.1 System checkpoint SCN ===========> (SYSTEM CHECKPOINT SCN in control file) SQL> select checkpoint_change# from v$database;
CHECKPOINT_CHANGE# ------------------ 3779864
1.2 Datafile checkpoint SCN ===============> (DATAFILE CHECKPOINT SCN in control file) SQL> set lines 200 SQL> col name for a60 SQL> select name,checkpoint_change# from v$datafile;
restore datafile后,可以mount database然后去檢查controlfile and datafile header的SCN
select 'controlfile' "SCN location",name,checkpoint_change# from v$datafile where name like '%users01%' union select 'file header',name,checkpoint_change# from v$datafile_header where name like '%users01%';
3.2 RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE; ===> OPEN DATABASE RESETLOG
如果只是某TABLE被DROP掉,沒有破壞數(shù)據(jù)庫整體數(shù)據(jù)結(jié)構(gòu),還可以用NCOMPLETE RECOVERY解決 如果是某個TABLESPACE OR DATAFILE被DROP掉,因為檔案結(jié)構(gòu)已經(jīng)破壞,目前的CONTROL FILE內(nèi)已經(jīng)沒有 該DATAFILE的信息,就算你只RESTORE DATAFILE然后進行INCOMPLETE RECOVERY也無法救回被DROP的DATA FILE。
只好RESOTRE 之前備份的CONTROL FILE(里頭被DROP DATAFILE Metadata此時還存在),不過RESTOREC CONTROL FILE后 此時Oracle會發(fā)現(xiàn)CONTROL FILE內(nèi)的SYSTEM SCN會小于目前的DATAFILE HEADER SCN,也不等于目前儲存于LOG FILE內(nèi)的SCN, 此時就必須使用RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE到DROP DATAFILE OR DROP TABLESPACE之前的SCN。