关于alter database open resetlog…
来源:互联网 发布:淘宝快速备案注销 编辑:程序博客网 时间:2024/05/22 13:25
取自ITpub上的案例,如下
不完全恢复只能做一次吗?
采用rman的默认设置,对数据库进行了backupdatabase备份。进行了一些操作后,然后直接关闭启动到mount状态
RMAN> run{
2> set until time "to_date('2010-10-1623: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 backupset
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
piecehandle=/oracle/flash_recovery_area/DENVER/backupset/2010_10_16/o1_mf_nnndf_TAG20101016T230845_6cmhzz8t_.bkptag=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=1sequence=10
media recovery complete, elapsed time: 00:00:01
Finished recover at 17-OCT-10
RMAN> alter database open resetlogs;
database opened
发现刚才恢复的时间23:14:42有点早,于是想改为恢复时间点为23:17:26,于是再次关闭数据库,mount状态下,但是出错了
RMAN> run {
2> set until time "to_date('2010-10-1623: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 recoverycatalog
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 RESETLOGStime
时间再前点恢复也不行:
RMAN> run {
2> set until time "to_date('2010-10-1623: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 recoverycatalog
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 RESETLOGStime
这是为什么?那些归档都还在,难道我的rman做过一次不完全恢复后,就不能再不完全恢复了,跟没有换备份控制文件有关系吗?里面做了什么
RMAN> list incarnation;
using target database control file instead of recoverycatalog
List of Database Incarnations
DB Key Inc Key DBName DB ID STATUS ResetSCN Reset Time
------- ------- -------- ---------------- --- --------------------
1 1 DENVER 4021391415 PARENT 1 22-OCT-05
2 2 DENVER 4021391415 PARENT 525876 16-OCT-10
3 3 DENVER 4021391415 CURRENT620239 17-OCT-10
RMAN> run{
2> set until time "to_date('2010-10-1623: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 backupset
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
piecehandle=/oracle/flash_recovery_area/DENVER/backupset/2010_10_16/o1_mf_nnndf_TAG20101016T230845_6cmhzz8t_.bkptag=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=1sequence=10
media recovery complete, elapsed time: 00:00:01
Finished recover at 17-OCT-10
RMAN> alter database open resetlogs;
database opened
发现刚才恢复的时间23:14:42有点早,于是想改为恢复时间点为23:17:26,于是再次关闭数据库,mount状态下,但是出错了
RMAN> run {
2> set until time "to_date('2010-10-1623: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 recoverycatalog
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 RESETLOGStime
时间再前点恢复也不行:
RMAN> run {
2> set until time "to_date('2010-10-1623: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 recoverycatalog
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 RESETLOGStime
这是为什么?那些归档都还在,难道我的rman做过一次不完全恢复后,就不能再不完全恢复了,跟没有换备份控制文件有关系吗?里面做了什么
RMAN> list incarnation;
using target database control file instead of recoverycatalog
List of Database Incarnations
DB Key
------- ------- -------- ---------------- --- --------------------
1
2
3
问题解决:
先要弄清楚alter database openresetlogs是什么意思,为什么要用resetlogs打开数据库,这个命令发出后oracle都做了什么?
alter database openresetlogs是要打开数据时,重置重做日志,即将重做日志的sequence置零,为什么要重置重做日志呢?
不完全恢复后,原来的online redolog里面包含的是未做恢复前的数据,而这些数据对于恢复后的数据库不再有效,所以数据库会要求在Open之前O先对online redolog的sequence置零。
Resetlogs命令表示一个数据库逻辑生存期的结束和另一个数据库逻辑生存期的开始,每次使用Resetlogs命令的时候,SCN不会被重置,不过oracle会重置日志序列号,而且会重置联机重做日志内容
Oracle把这个数据库逻辑生存期称为incarnation
每次使用resetlogs打开数据库,就会使incarnation +1,也就是产生一个新的incarnation;
如果想要恢复到之前incarnation的scn/time,就需要先恢复到之前的incarnation;
对于上面的案例,具体就是先要
Reset database to incarnation 2;
再做不完全恢复试试
关于Incarnation的理解以下面的案例为主(取自http://www.itpub.net/viewthread.php?tid=1144145&highlight=incarnation)
不同意见的朋友请留言~
0 0
- 关于alter database open resetlog…
- 关于alter system switch lo…
- 实验1 :关于FLASHBACK DATABASE …
- alter database begin&n…
- alter system archive current log…
- Oracle Database …
- alter tablespace temp&…
- Manage Database Projects With Vi…
- Microsoft JET Database Engine 错…
- 关于RMAN恢复中的switch database …
- alter system switch logfile与alt…
- FileZilla - an open source mini …
- Mysql alter procedure name
- 关于PL/SQL与Oracle Database 12c …
- Oracle Database Server…
- ORA-16433 The database…
- RMAN-20004: target database name…
- OSSC(Aliyun Open Stora…
- SQL_Trace的使用
- tkprof用法
- Linux下修改PATH路径
- 微信小程序学习笔记
- Crontab用法
- 关于alter database open resetlog…
- 从keras看VGG16结构图
- 80行Python实现-HOG梯度特征提取
- ORA-01081: cannot start already-…
- 在sqlplus中看redo log大小,和文…
- linux中新增磁盘分区、格式化以及…
- 触发写Redo Log的条件
- 什么是RBA
- e.slice is not a function