alter database open resetlogs
問題解決:
先要弄清楚alter database open resetlogs是什么意思,為什么要用resetlogs打開數(shù)據(jù)庫,這個(gè)命令發(fā)出后oracle都做了什么?
alter database open resetlogs是要打開數(shù)據(jù)時(shí),重置重做日志,即將重做日志的sequence置零,為什么要重置重做日志呢?
不完全恢復(fù)后,原來的online redo log里面包含的是未做恢復(fù)前的數(shù)據(jù),而這些數(shù)據(jù)對(duì)于恢復(fù)后的數(shù)據(jù)庫不再有效,所以數(shù)據(jù)庫會(huì)要求在Open之前先對(duì)online redo log的sequence置零。
Resetlogs命令表示一個(gè)數(shù)據(jù)庫邏輯生存期的結(jié)束和另一個(gè)數(shù)據(jù)庫邏輯生存期的開始,每次使用Resetlogs命令的時(shí)候,SCN不會(huì)被重置,不過oracle會(huì)重置日志序列號(hào),而且會(huì)重置聯(lián)機(jī)重做日志內(nèi)容。
Oracle把這個(gè)數(shù)據(jù)庫邏輯生存期稱為incarnation
每次使用resetlogs打開數(shù)據(jù)庫,就會(huì)使incarnation + 1,也就是產(chǎn)生一個(gè)新的incarnation;
如果想要恢復(fù)到之前incarnation的scn/time,就需要先恢復(fù)到之前的incarnation;
對(duì)于上面的案例,具體就是先要
Reset database to incarnation 2;
再做不完全恢復(fù)試試
--------------------------我執(zhí)行一次rman之后,再次執(zhí)行這個(gè)腳本--------------
?
?
?
http://hi.baidu.com/heuet032606/item/4553f3c1d8f8b22c47d5c07c
http://blog.csdn.net/leishifei/article/details/6430057
關(guān)于alter database open resetlogs及incarnation的一點(diǎn)理解
不完全恢復(fù)只能做一次嗎?
采用rman的默認(rèn)設(shè)置,對(duì)數(shù)據(jù)庫進(jìn)行了backup database備份,進(jìn)行了一些操作后,然后直接關(guān)閉啟動(dòng)到mount狀態(tài)
RMAN> run{
2> set until time "to_date('2010-10-16 23:14:42','yyyy-mm-dd hh24:mi:ss')";
3> restore database;
4> recover database;
5> }
executing command: SET until clause
Starting restore at 17-OCT-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/oradata/denver/system01.dbf
restoring datafile 00002 to /oracle/oradata/denver/undotbs01.dbf
restoring datafile 00003 to /oracle/oradata/denver/sysaux01.dbf
restoring datafile 00004 to /oracle/oradata/denver/users01.dbf
restoring datafile 00005 to /oracle/oradata/denver/example01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/flash_recovery_area/DENVER/backupset/2010_10_16/o1_mf_nnndf_TAG20101016T230845_6cmhzz8t_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/flash_recovery_area/DENVER/backupset/2010_10_16/o1_mf_nnndf_TAG20101016T230845_6cmhzz8t_.bkp tag=TAG20101016T230845
channel ORA_DISK_1: restore complete, elapsed time: 00:01:26
Finished restore at 17-OCT-10
Starting recover at 17-OCT-10
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 10 is already on disk as file /oracle/archivelog/1_10_732510268.dbf
archive log filename=/oracle/archivelog/1_10_732510268.dbf thread=1 sequence=10
media recovery complete, elapsed time: 00:00:01
Finished recover at 17-OCT-10
RMAN> alter database open resetlogs;
database opened
發(fā)現(xiàn)剛才恢復(fù)的時(shí)間23:14:42有點(diǎn)早,于是想改為恢復(fù)時(shí)間點(diǎn)為23:17:26,于是再次關(guān)閉數(shù)據(jù)庫,mount狀態(tài)下,但是出錯(cuò)了
RMAN> run {
2> set until time "to_date('2010-10-16 23:17:26','yyyy-mm-dd hh24:mi:ss')";
3> restore database;
4> recover database;
5> }
executing command: SET until clause
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of set command at 10/17/2010 00:45:40
RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time
時(shí)間再前點(diǎn)恢復(fù)也不行:
RMAN> run {
2> set until time "to_date('2010-10-16 23:14:40','yyyy-mm-dd hh24:mi:ss')";
3> restore database;
4> recover database;
5> }
executing command: SET until clause
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of set command at 10/17/2010 01:17:03
RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time
這是為什么?那些歸檔都還在,難道我的rman做過一次不完全恢復(fù)后,就不能再不完全恢復(fù)了,跟有沒有換備份控制文件有關(guān)系嗎?里面做了什么呢?
RMAN> list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key? Inc Key DB Name? DB ID????????? ? STATUS? Reset SCN? Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1???? ? 1???? ? DENVER ? 4021391415???? ? PARENT? 1??????? ? 22-OCT-05
2???? ? 2???? ? DENVER ? 4021391415???? ? PARENT? 525876?? ? 16-OCT-10
3???? ? 3???? ? DENVER ? 4021391415???? ? CURRENT 620239?? ? 17-OCT-10
問題解決:
先要弄清楚alter database open resetlogs是什么意思,為什么要用resetlogs打開數(shù)據(jù)庫,這個(gè)命令發(fā)出后oracle都做了什么?
alter database open resetlogs是要打開數(shù)據(jù)時(shí),重置重做日志,即將重做日志的sequence置零,為什么要重置重做日志呢?
不完全恢復(fù)后,原來的online redo log里面包含的是未做恢復(fù)前的數(shù)據(jù),而這些數(shù)據(jù)對(duì)于恢復(fù)后的數(shù)據(jù)庫不再有效,所以數(shù)據(jù)庫會(huì)要求在Open之前先對(duì)online redo log的sequence置零。
Resetlogs命令表示一個(gè)數(shù)據(jù)庫邏輯生存期的結(jié)束和另一個(gè)數(shù)據(jù)庫邏輯生存期的開始,每次使用Resetlogs命令的時(shí)候,SCN不會(huì)被重置,不過oracle會(huì)重置日志序列號(hào),而且會(huì)重置聯(lián)機(jī)重做日志內(nèi)容。
Oracle把這個(gè)數(shù)據(jù)庫邏輯生存期稱為incarnation
每次使用resetlogs打開數(shù)據(jù)庫,就會(huì)使incarnation + 1,也就是產(chǎn)生一個(gè)新的incarnation;
如果想要恢復(fù)到之前incarnation的scn/time,就需要先恢復(fù)到之前的incarnation;
對(duì)于上面的案例,具體就是先要
Reset database to incarnation 2;
再做不完全恢復(fù)試試
總結(jié)
以上是生活随笔為你收集整理的alter database open resetlogs的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: RMAN 的备份保留策略
- 下一篇: delete expired backu