何时在 Oracle 中使用“使用备份控制文件”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35102952/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
When to use “using backup controlfile” in Oracle
提问by Gaurav Bhaskar
I know this is something not new to ask, however, I did not get the satisfactory answer where and where not to use "RECOVER DATABASE USING BACKUP CONTROLFILE" or "RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE".
我知道这不是什么新鲜事,但是,我没有得到满意的答案,在哪里和哪里不使用“使用备份控制文件恢复数据库”或“使用备份控制文件恢复数据库直到取消”。
It will really help if someone can explain with proper examples and scenarios.
如果有人可以用适当的例子和场景来解释,那真的很有帮助。
Thanks a bunch.
谢谢一堆。
回答by zoliton
The syntax is quite verbose: If the original/current controlfiles are not available you can resort to using a backup controlfile.
语法非常冗长:如果原始/当前控制文件不可用,您可以求助于使用备份控制文件。
The controlfile contains the layout und state of the database:
控制文件包含数据库的布局和状态:
- files comprising the database.
- current SCN, the system change number, incremented with each transaction.
- 构成数据库的文件。
- 当前 SCN,系统更改号,随着每个事务递增。
The datafiles also store the respective SCN. If the SCN in the controlfile is lower than the SCN in the datafile Oracle knows it is dealing with a backup controlfile.
数据文件还存储相应的 SCN。如果控制文件中的 SCN 低于数据文件中的 SCN,则 Oracle 知道它正在处理备份控制文件。
One scenario where this is used is creating a copy of a productive database for testing. To this purpose you can do the following:
使用此方法的一个场景是创建生产数据库的副本以进行测试。为此,您可以执行以下操作:
- Restore the controlfile from the backup on the test server. Now the file layout of the database is known (and can be adapted if necessary).
- Restore the data files.
- Start recovering the database (USING BACKUP CONTROLFILE).
- Recovery will consume archived redo logs you will have to provide. Stop by canceling the recovery after a redo log (e.g. the last available one) or by specifying a point in time (PIT recovery).
- Open the database with RESETLOGS option.
- 从测试服务器上的备份恢复控制文件。现在数据库的文件布局是已知的(并且可以在必要时进行调整)。
- 恢复数据文件。
- 开始恢复数据库(使用备份控制文件)。
- 恢复将消耗您必须提供的归档重做日志。通过在重做日志(例如最后一个可用日志)之后取消恢复或指定时间点(PIT 恢复)来停止。
- 使用 RESETLOGS 选项打开数据库。
Usually the the database is also renamed to avoid confusion.
通常数据库也被重命名以避免混淆。
Another scenario is a recovery due to a datafile restored from a backup. In that case the current controlfile is available and USING BACKUP CONTROLFILE is not needed.
另一种情况是由于从备份中恢复的数据文件而导致的恢复。在这种情况下,当前控制文件可用,不需要使用备份控制文件。
回答by Sish
1) When all controlfles are lost 2) When database backup is older than controlfile backup.
1) 当所有控制文件丢失时 2) 当数据库备份比控制文件备份更旧时。