ITPub博客

首页 > 数据库 > Oracle > 一次基于rman的不完全恢复

一次基于rman的不完全恢复

原创 Oracle 作者:何懿44 时间:2014-02-19 17:41:53 0 删除 编辑

事件背景:

zt导入其他客户的数据至本地数据库导致数据丢失,此数据库开启了归档模式,最后一次rman备份是2014218日的22:00,导数据是2014219日的上午11点。

 

1、检验备份有效性,确认2014218日晚22:00备份有效

 

RMAN> crosscheck backupset;

 

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=548 device type=DISK

crosschecked backup piece: found to be 'EXPIRED'

backup piece handle=/u01/app/oracle/databack/db_7np0slv3_1_1 RECID=247 STAMP=839800803

crosschecked backup piece: found to be 'EXPIRED'

backup piece handle=/u01/app/oracle/databack/db_7op0slvi_1_1 RECID=248 STAMP=839800819

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/u01/app/oracle/databack/db_7qp0uamj_1_1 RECID=250 STAMP=839854803

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/u01/app/oracle/databack/db_7rp0uan2_1_1 RECID=251 STAMP=839854819

crosschecked backup piece: found to be 'EXPIRED'

backup piece handle=/u01/app/oracle/databack/ctl_7sp0uan5_1_1 RECID=252 STAMP=839854822

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/u01/app/oracle/databack/db_7tp0vab3_1_1 RECID=253 STAMP=839887203

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/u01/app/oracle/databack/db_7up0vabi_1_1 RECID=254 STAMP=839887219

Crosschecked 7 objects

 

2、检查当前的时间点

RMAN> list incarnation;

 

 

List of Database Incarnations

DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time

------- ------- -------- ---------------- --- ---------- ----------

1       1       LIS      2735595131       PARENT  1          2011-09-17 09:46:04

2       2       LIS      2735595131       PARENT  995548     2013-12-06 13:25:17

3       3       LIS      2735595131       CURRENT 7634714    2014-02-19 13:42:48

 

 

3、进行基于时间点恢复

报错提示:当前的控制文件scn已经于我的rman 备份的scn不一致了,原因是hjf之前已经恢复过了一次。

RMAN> run{

2> allocate channel t1 device type disk;

3> set until time "to_date('2014-02-19 09:00:00','yyyy-mm-dd hh24:mi:ss')";

4> restore database;

5> recover database;}

 

using target database control file instead of recovery catalog

allocated channel: t1

channel t1: SID=898 device type=DISK

 

executing command: SET until clause

 

Starting restore at 2014-02-19 14:57:08

released channel: t1

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of restore command at 02/19/2014 14:57:08

RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time

 

4、基于第三步原因,所以需要先恢复控制文件,首先找到数据库的dbid

[oracle@lisserver databack]$ rman target/

 

Recovery Manager: Release 11.2.0.3.0 - Production on Wed Feb 19 15:04:02 2014

 

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: LIS (DBID=2735595131)

 

5、恢复控制文件

 

RMAN> set dbid 1317469297

 

正在执行命令: SET DBID

 

RMAN> startup nomount

 

Oracle 实例已启动

 

系统全局区域总计     293601280 字节

 

Fixed Size                     1290208 字节

Variable Size                100663328 字节

Database Buffers             184549376 字节

Redo Buffers                   7098368 字节

 

RMAN> set controlfile autobackup format for device type disk to '/u01/app/oracle/databack/%F';

 

正在执行命令: SET CONTROLFILE AUTOBACKUP FORMAT

 

RMAN> restore controlfile from '/u01/app/oracle/databack/控制文件的备份名字';

 

启动 restore 于 19-3月 -13

使用通道 ORA_DISK_1

 

通道 ORA_DISK_1: 正在复原控制文件

通道 ORA_DISK_1: 恢复完成, 用时: 00:00:05

输出文件名=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL01.CTL

输出文件名=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL02.CTL

输出文件名=D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\CONTROL03.CTL

完成 restore 于 19-3月 -13

 

 

6、将数据库开启到mount状态,再次执行不完全恢复

RMAN> sql 'alter database mount';

 

RMAN> run{

2> allocate channel t1 device type disk;

3> set until time "to_date('2014-02-19 09:00:00','yyyy-mm-dd hh24:mi:ss')";

4> restore database;

5> recover database;}

 

 

7、恢复成功后,执行open

 sql 'alter database open resetlogs';

 

经过现场人员zt确认,数据已经恢复成功。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28781509/viewspace-1084062/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2014-02-19

  • 博文量
    1
  • 访问量
    24899