recover database of [reprint] oracle backup and recovery of four statements difference recover oracle database backup and recovery of the difference of four statements

recover database backup recovery of the oracle four statements difference

 

HTTPS: // www.cnblogs.com/andy6/p/5925433.html 

need to learn about.

 

1  recover database using backup controlfile
2  recover database until cancel
3  recover database using backup controlfile until cancel;
4  recover database until cancel using backup controlfile;

This paper describes the following four restore meaning the difference between the way:
 
1. recover database using backup controlfile

 If the current control file is lost, cold backup when the control file recovery, used to tell the Oracle , in the scn Do not controlfile as the end of recovery;
 
2. recover database until cancel
 
If you lose your current / active redo when manually specify the endpoint.
 
3. recover database using backup controlfile until cancel;
 
 If you lose your current controlfile and current / active redo all is lost, it will go automatically apply archived logs, you can achieve maximum recovery;
 
4. recover database until cancel using backup controlfile;
 
 If you lose your current controlfile and current / active redo all lost to redo the old scn to restore the finish. Because there is no application archive log, all data will be lost. 
To understand using backup controlfile recover database, first understanding recover database, that is, without using backup controlfile the case.
In ordinary recover database or recover tablespace, when recover datafile, Oracle will record the current SCN controlfile subject, use the redo log and archive log redo entry, restore the datafile block related to "current controlfile record of the SCN "
And in some cases, Oracle need to restore data to the controlfile than the current record SCN also depends on the position (for example, control file is a backup controlfile, or trace create the controlfile is based.) This time, we need by using backup controlfile. recovery will not be affected by the "current controlfile recorded SCN" restrictions. This time limit will come from your statement (until time, until scn), or available archive log (until cancel) ...

The results are as follows:
If the control file is missing, restore a backup control file, you must use the using backup controlfile option. And until cancel is not fully recovered, ie current / active redo lost or missing files from an archive database after the restore is terminated.

Conclusion:
1, applies to restore old control files, and archive log and cuurrent / active redo all is not lost case. If all archived logs and online log intact, you can not lose data. Database similar Recover
2, current is not lost control file (control file does not need to restore old), then there are log file or current / active log have lost the case, it is terminated. The maximum possible data recovery
3,4: I am in the oracle 10.2.0.4 environmental testing effect is the same, ie to restore old control files, after restoring the control file backup that moment, the system will prompt the application control file backup archive log, if not then stop. The largest possible recovery of data.

 

The results can be drawn, if the old database backup, archive log and online log to save all intact under the circumstances, the use recover database or recover database using backup controlfile. No loss of data
at the backup data file restore if there is, archive logs, or online journals (active, current) situation is lost, you can restore to the previous log file missing

 

just do not fully recover until cancel
require alter database open resetlogs
after the database is open need to understand to do a full backup

 

Online log files are missing:

If normal database, then an error at startup:

SQL> alter database open;
alter database open
*
第 1 行出现错误:
ORA-00313: 无法打开日志组 1 (用于线程 1) 的成员
ORA-00312: 联机日志 1 线程 1:
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG'


SQL> alter database open resetlogs;
alter database open resetlogs
*
第 1 行出现错误:
ORA-01139: RESETLOGS 选项仅在不完全数据库恢复后有效


SQL> recover database until cancel;
完成介质恢复。
SQL> alter database open resetlogs;

数据库已更改。

 

https://www.cnblogs.com/andy6/p/5925433.html

需要学习一下. 

 

1  recover database using backup controlfile
2  recover database until cancel
3  recover database using backup controlfile until cancel;
4  recover database until cancel using backup controlfile;

本文主要介绍以下四种 恢复方式的含义与区别:
 
1. recover database using backup controlfile

 如果丢失当前控制文件,用冷 备份的控制文件恢复的时候,用来告诉 oracle,不要以controlfile中的scn作为恢复的终点;
 
2. recover database until cancel
 
如果丢失current/active redo的时候,手动指定终点。
 
3. recover database using backup controlfile until cancel;
 
 如果丢失当前controlfile并且current/active redo都丢失,会先去自动应用归档日志,可以实现最大的恢复;
 
4. recover database until cancel using backup controlfile;
 
 如果丢失当前controlfile并且current/active redo都丢失,以旧的redo中的scn为恢复终点。因为没有应用归档日志,所有会丢失数据。 
要理解recover database using backup controlfile,先理解 recover database,也就是说,不加using backup controlfile的情况。
在普通的recover database 或者 recover tablespace, recover datafile时, Oracle会以当前controlfile所纪录的SCN为准,利用archive log和 redo log的redo entry, 把相关的datafile 的 block恢复到“当前controlfile所纪录的SCN”
而某些情况下,Oracle需要把数据恢复到比当前controlfile所纪录的SCN还要靠后的位置(比如说,control file是backup controlfile , 或者 controlfile是根据trace create的。),这时候,就需要用using backup controlfile.   恢复就不会受“当前controlfile所记录的SCN”的限制。这时候的限制就来自于你的语句(until time , until scn),或者可用的archive log(until cancel) ...

结果如下:
如果控制文件丢失,restore备份的控制文件后,则必须使用using backup controlfile选项。而until cancel则是不完全恢复,即current/active redo丢失,或者从restore数据库后某个归档文件缺失,则终止。

结论:
1、适用于restore旧的控制文件,且归档日志和cuurrent/active redo都没有丢失情况。如果一切归档日志和在线日志完好,可以不丢失数据。类似于recover database
2、当前控制文件未丢失(不需要restore旧的控制文件),此时有归档日志或者current/active log有丢失情况下,则终止。最大可能恢复数据
3、4:我在oracle 10.2.0.4环境下测试效果是相同的,即适用于restore旧的控制文件,在恢复到控制文件备份那刻后,系统会提示应用控制文件备份后的归档日志,如果没有则停止。也是最大可能的恢复数据。

 

可以得出结果,如果有旧的数据库备份,在归档日志和在线日志全部保存完好的情况下,使用recover database或recover database using backup controlfile。则不丢失数据
如果存在备份数据文件restore后,归档日志或者在线日志(active、current)丢失情况下,则可以恢复到丢失的前一个归档日志

 

until cancel就是不完全恢复
需要alter database open resetlogs
数据库打开后需要理解做一个全库备份

 

在线日志文件丢失:

如果正常关闭数据库,然后启动时报错:

SQL> alter database open;
alter database open
*
第 1 行出现错误:
ORA-00313: 无法打开日志组 1 (用于线程 1) 的成员
ORA-00312: 联机日志 1 线程 1:
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG'


SQL> alter database open resetlogs;
alter database open resetlogs
*
第 1 行出现错误:
ORA-01139: RESETLOGS 选项仅在不完全数据库恢复后有效


SQL> recover database until cancel;
完成介质恢复。
SQL> alter database open resetlogs;

数据库已更改。

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/10967994.html