环境:
OS:Red Hat Linux As 5
DB:10.2.0.4
9i之前做了不完全恢复使用resetlogs打开数据库后,必须做完全备份,是不能多次做不完全备份使用resetlogs打开数据库的.但到了10g,引入了incarnation后,做了不完全恢复使用resetlogs打开数据库后,若想再次做不完全恢复,可以设置数据库的incarnation,再次使用resetlogs打开数据库.
1.列出当前的备份集(20120602日做的备份)
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- ----------------- ------- ------- ---------- ---
16 B F A DISK 20120602 11:50:32 1 1 NO TAG20120602T114931
17 B F A DISK 20120602 11:50:39 1 1 NO TAG20120602T114931
18 B F A DISK 20120602 11:50:42 1 1 NO TAG20120602T115041
19 B A A DISK 20120602 11:50:45 1 1 NO TAG20120602T115044
2.列出当前的incarnation
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 ORACL 1823011607 PARENT 1 20050630 19:09:40
2 2 ORACL 1823011607 CURRENT 446075 20120310 06:07:22
3.20120605日 20:18:05在数据库创建表并写入数据
create table tb_log
(
id number,
createtime date default sysdate
);
declare
begin
for i in 1 .. 100000 loop
insert into tb_log(id) values(i);
end loop;
end;
4.做不完全恢复,恢复到时间点'2012-06-05 21:05:00',并resetlogs打开数据库
run{
set until time "to_date('2012-06-05 21:05:00','YYYY-MM-DD HH24:MI:SS')";
restore database;
recover database;
}
alter database open resetlogs
5.查看当前的Incarnations
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 ORACL 1823011607 PARENT 1 20050630 19:09:40
2 2 ORACL 1823011607 PARENT 446075 20120310 06:07:22
3 3 ORACL 1823011607 CURRENT 1035203 20120605 21:11:15
6.当前数据的Incarnations是3,将其置为之前的2,再次做不完全恢复
shutdown immediate
startup mount
reset database to incarnation 2;
7.再次做不完全恢复
run{
set until time "to_date('2012-06-05 21:05:00','YYYY-MM-DD HH24:MI:SS')";
restore database;
recover database;
}
恢复的时候报如下错误:
media recovery failed
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/05/2012 21:18:10
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover if needed
start until time 'JUN 05 2012 21:05:00'
ORA-00283: recovery session canceled due to errors
ORA-38727: FLASHBACK DATABASE requires a current control file.
分析原因是我的数据库FLASHBACK设置了on,将其设置为off,问题解决.
RMAN> sql 'alter database flashback off';
8.这个时候查看数据的incarnation,发现3已经变成了ORPHAN.
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 ORACL 1823011607 PARENT 1 20050630 19:09:40
2 2 ORACL 1823011607 PARENT 446075 20120310 06:07:22
3 3 ORACL 1823011607 ORPHAN 1035203 20120605 21:11:15
4 4 ORACL 1823011607 CURRENT 1035379 20120605 21:24:13
-- The End --
阅读(436) | 评论(0) | 转发(0) |