Chapter12 User-Managed Complete Recovery
1、在oracle的recovery中,分两种:complete recover and incomplete recovery
2、在NOARCHIVELOG MODE情况下,是没有完全恢复的.
在非归档模式下,有一个文件损坏,要restore必须重新拷贝全部文件;
非归档模式,一般使用在测试环境或者开发环境;对于实际的生产环境下的数据业务库,100%的需要使用归档模式.
3、非归档模式下数据库恢复原理图解
假如the most recent backup,是在144(scn)处,当数据发生损坏在146处时,又假如redo log file文件中的数据没有被覆盖时(redo log file是一个被oracle循环写的文件),那么这个时候就可以restore 144的备份文件,再加上redo log file中的文件,即可将数据库恢复,数据损失最小,接近于0损失;否则在scn为346处,发生的数据损坏,redo log file中的数据早就被覆盖掉了,那么进行数据恢复时,只能restore 144的备份文件了,144之后至346处的数据将全部丢失;
4、Complete Recovery
- Make sure that datafiles for restore are offline.
- Restore only lost or damaged datafiles.
- Do not restore the control file,redo log files,password files,or parameter files.
- Recover the datafiles.
5、Complete Recovery in ARCHIVELOG Mode
- Advantages
- Only need to restore lost files
- Recovers all data to the time of failure
- Recovery time is the time it takes to restore lost files and apply all archived log files
- Disadvantages
- Must have all archived log files since the backup from which you are restoring
6、Determine Files Need Recovery
- View V$RECOVER_FILE to determine which datafiles need recovery.通过查询这个动态性能试图,可以知道哪个数据文件需要恢复.
-
SQL> select * from v$recover_file; no rows selected
v$recover_file中没有数据,说明数据库时正常工作的,没有文件损坏,不需要恢复.
-
- View V$ARCHIVED_LOG for a list of all archived redo log files for the database.
- View V$RECOVERY_LOG for a list of all archived redo log files required for recovery.当有需要恢复的redo log files时,v$recovery_log才会有记录.