RMAN不完全恢复问题求助

[复制链接]
查看11 | 回复9 | 2008-9-2 11:54:44 | 显示全部楼层 |阅读模式
1.rman全备数据库,归档日志,设置自动备份控制文件及参数据文件
run {

allocate channel 'dev1' type disk ;

allocate channel 'dev2' type disk ;

allocate channel 'dev3' type disk ;

backup incremental level 0tag 'dbL0' format '/u03/rman_database/%T_dbfull_%u_%p_%c' database skip readonly;

backupcurrent controlfile format '/u03/rman_control/%T_control_%u';

sql 'alter system archive log current' ;

backup filesperset 3 archivelog allformat '/u03/rman_archivelog/%T_arch_%u_%p_%c';

release channel dev1;

release channel dev2;

release channel dev3;

}
备份过程:
.....
.....
put archive log thread=1 sequence=7 recid=96 stamp=664369971
channel dev3: starting piece 1 at 02-SEP-08
channel dev1: starting archive log backupset
channel dev1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=98 stamp=664370241
input archive log thread=1 sequence=2 recid=99 stamp=664370241
input archive log thread=1 sequence=3 recid=100 stamp=664370246
channel dev1: starting piece 1 at 02-SEP-08
channel dev1: finished piece 1 at 02-SEP-08
piece handle=/u03/rman_archivelog/20080902_arch_4ijpiv54_1_1 tag=TAG20080902T111848 comment=NONE
channel dev1: backup set complete, elapsed time: 00:00:02
channel dev2: finished piece 1 at 02-SEP-08
piece handle=/u03/rman_archivelog/20080902_arch_4gjpiv54_1_1 tag=TAG20080902T111848 comment=NONE
channel dev2: backup set complete, elapsed time: 00:00:02
channel dev3: finished piece 1 at 02-SEP-08
piece handle=/u03/rman_archivelog/20080902_arch_4hjpiv54_1_1 tag=TAG20080902T111848 comment=NONE
channel dev3: backup set complete, elapsed time: 00:00:02
channel dev1: starting archive log backupset
channel dev1: specifying archive log(s) in backup set
input archive log thread=1 sequence=4 recid=101 stamp=664370325
input archive log thread=1 sequence=5 recid=102 stamp=664370327
channel dev1: starting piece 1 at 02-SEP-08
channel dev1: finished piece 1 at 02-SEP-08
piece handle=/u03/rman_archivelog/20080902_arch_4jjpiv56_1_1 tag=TAG20080902T111848 comment=NONE
channel dev1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-SEP-08
Starting Control File and SPFILE Autobackup at 02-SEP-08
piece handle=/u03/rman_control/c-1216224761-20080902-09 comment=NONE
Finished Control File and SPFILE Autobackup at 02-SEP-08
released channel: dev1
released channel: dev2
released channel: dev3
RMAN>
2. 11:54:44 SQL>drop tablespace tms including contents and datafiles;

Tablespace dropped.

现在想对数据库进行不完全恢复到2008-09-02 11:54:44 这个时间点.
恢复思路:
3.由于控制文件发生变化,首先还原控制文件
RMAN> startup nomount;
Oracle instance started
Total System Global Area1694498816 bytes
Fixed Size
1219808 bytes
Variable Size
721421088 bytes
Database Buffers
956301312 bytes
Redo Buffers
15556608 bytes
RMAN> restore controlfile from autobackup;
Starting restore at 02-SEP-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
channel ORA_DISK_1: looking for autobackup on day: 20080902
channel ORA_DISK_1: autobackup found: /u03/rman_control/c-1216224761-20080902-0a
channel ORA_DISK_1: control file restore from autobackup complete
output filename=/u01/oracle/oradata/autodb/control01.ctl
output filename=/u01/oracle/oradata/autodb/control02.ctl
output filename=/u01/oracle/oradata/autodb/control03.ctl
Finished restore at 02-SEP-08
4.控制文件恢复成功,加载数据库,然后还原数据文件
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> restore database;
Starting restore at 02-SEP-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /u01/oracle/oradata/autodb/tms01.dbf
restoring datafile 00005 to /u01/oracle/oradata/autodb/undotbs01.dbf
channel ORA_DISK_1: reading from backup piece /u03/rman_database/20080902_dbfull_4sjpj11e_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/u03/rman_database/20080902_dbfull_4sjpj11e_1_1 tag=DBL0
channel ORA_DISK_1: restore complete, elapsed time: 00:00:16
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/oracle/oradata/autodb/system01.dbf
restoring datafile 00008 to /u01/oracle/oradata/autodb/test02.dbf
channel ORA_DISK_1: reading from backup piece /u03/rman_database/20080902_dbfull_4qjpj11e_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/u03/rman_database/20080902_dbfull_4qjpj11e_1_1 tag=DBL0
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /u01/oracle/oradata/autodb/sysaux01.dbf
restoring datafile 00004 to /u01/oracle/oradata/autodb/test01.dbf
channel ORA_DISK_1: reading from backup piece /u03/rman_database/20080902_dbfull_4rjpj11e_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/u03/rman_database/20080902_dbfull_4rjpj11e_1_1 tag=DBL0
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 09/02/2008 12:12:45
ORA-19653: cannot switch to older file incarnation
为什么会出现这样的情况,如何解决啊,困了好久了
时间我改过来了,删除表空间的时候,发贴子时忘了修改.
[ 本帖最后由 ah_cx 于 2008-9-2 12:36 编辑 ]
回复

使用道具 举报

千问 | 2008-9-2 11:54:44 | 显示全部楼层
11:20:15 SQL> drop tablespace tms including contents and datafiles;(11:20分删的表空间)
Tablespace dropped.
现在想对数据库进行不完全恢复到2008-09-02 11:54:44 这个时间点.(怎么还会恢复TMS呢?)
回复

使用道具 举报

千问 | 2008-9-2 11:54:44 | 显示全部楼层
RMAN> restore controlfile from autobackup;
不用这步试试
回复

使用道具 举报

千问 | 2008-9-2 11:54:44 | 显示全部楼层
原帖由 jieyancai 于 2008-9-2 12:31 发表
RMAN> restore controlfile from autobackup;
不用这步试试


不用这个的话,肯定不行吧,因为控制文件的结构已经物理改变了,当前的控制文件已不包话那个表空间了
回复

使用道具 举报

千问 | 2008-9-2 11:54:44 | 显示全部楼层
贴子要沉了,自己顶下了
回复

使用道具 举报

千问 | 2008-9-2 11:54:44 | 显示全部楼层
那你也不能用FROM AUTOBACKUP呀
因为你删除表空间后,RMAN会自动备份CONTROLFILE(估计你肯定配置了自动的控制文件备份),你恢复过来的CONTROLFILE还是你做过结构改动以后的那个,所以,即使你要RESTORE CONTROLFILE ,必须显示指定以前的老备份,或者手工创建
回复

使用道具 举报

千问 | 2008-9-2 11:54:44 | 显示全部楼层
同jieyancai
回复

使用道具 举报

千问 | 2008-9-2 11:54:44 | 显示全部楼层
原帖由 doctor1414c 于 2008-9-2 13:30 发表
那你也不能用FROM AUTOBACKUP呀
因为你删除表空间后,RMAN会自动备份CONTROLFILE(估计你肯定配置了自动的控制文件备份),你恢复过来的CONTROLFILE还是你做过结构改动以后的那个,所以,即使你要RESTORE CONTROLFILE ,必须显示指定以前的老备份,或者手工创建

对头,我是配置了自动备份控制文件的,这样的话是不是控制文件只要被修改了,RMAN就会自动备份.我在做个测试,谢谢楼上兄弟们.
回复

使用道具 举报

千问 | 2008-9-2 11:54:44 | 显示全部楼层
从老的备份中还原控制文件:
RMAN> restore controlfile from '/u03/rman_control/20080902_control_4tjpj12o';
Starting restore at 02-SEP-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output filename=/u01/oracle/oradata/autodb/control01.ctl
output filename=/u01/oracle/oradata/autodb/control02.ctl
output filename=/u01/oracle/oradata/autodb/control03.ctl
Finished restore at 02-SEP-08
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> restore database;
Starting restore at 02-SEP-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
skipping datafile 5; already restored to file /u01/oracle/oradata/autodb/undotbs01.dbf
skipping datafile 1; already restored to file /u01/oracle/oradata/autodb/system01.dbf
skipping datafile 8; already restored to file /u01/oracle/oradata/autodb/test02.dbf
skipping datafile 3; already restored to file /u01/oracle/oradata/autodb/sysaux01.dbf
skipping datafile 4; already restored to file /u01/oracle/oradata/autodb/test01.dbf
datafile 2 is already restored to file /u01/oracle/oradata/autodb/tms01.dbf
restore not done; all files readonly, offline, or already restored
Finished restore at 02-SEP-08
RMAN> recover database until time "to_date('2008-09-02 11:54:44','yyyy-mm-dd hh24:mi:ss')";
Starting recover at 02-SEP-08
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 6 is already on disk as file /u01/oracle/dbs/arch/1_6_664369971.dbf
archive log thread 1 sequence 1 is already on disk as file /u01/oracle/oradata/autodb/redo03.log
archive log thread 1 sequence 2 is already on disk as file /u01/oracle/oradata/autodb/redo01.log
archive log thread 1 sequence 3 is already on disk as file /u01/oracle/oradata/autodb/redo02.log
archive log filename=/u01/oracle/oradata/autodb/redo03.log thread=1 sequence=1
archive log filename=/u01/oracle/oradata/autodb/redo01.log thread=1 sequence=2
archive log filename=/u01/oracle/oradata/autodb/redo02.log thread=1 sequence=3
media recovery complete, elapsed time: 00:00:02
Finished recover at 02-SEP-08
RMAN> alter database open resetlogs;
database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
恢复完成,验证
SQL> select name from v$tablespace;
NAME
--------------------------------------------------
SYSTEM
TMS
SYSAUX
TEST
UNDOTBS1
TEMPTS1
至此,数据库恢复成功,很感谢楼上的几位兄弟
回复

使用道具 举报

千问 | 2008-9-2 11:54:44 | 显示全部楼层
老的备份中还原控制文件
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行