分享
 
 
 

使用RMAN进行基于时间点的不完全恢复

王朝other·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

上周一个朋友的数据库发生误删除操作,请我帮忙进行恢复。

由于备份比较充分,所以只需要通过RMAN进行一个基于时间点(这个时间点需要根据故障时间进行判定选取)。

首先启动实例:

[Oracle@stat ~]$ eXPort ORACLE_SID=order

[oracle@stat ~]$ rman target /

Recovery Manager: Release 10.2.0.2.0 - ProdUCtion on Thu Sep 14 22:43:50 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database (not started)

RMAN> set DBID=1341966532

executing command: SET DBID

RMAN> startup nomount;

Oracle instance started

Total System Global Area 2483027968 bytes

Fixed Size 1262344 bytes

Variable Size 654314744 bytes

Database Buffers 1811939328 bytes

Redo Buffers 15511552 bytes

恢复数据文件并加载(mount)数据库:

RMAN> restore controlfile from autobackup;

Starting restore at 14-SEP-06

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=541 devtype=DISK

channel ORA_DISK_1: looking for autobackup on day: 20060914

channel ORA_DISK_1: autobackup found: c-1341966532-20060914-02

channel ORA_DISK_1: control file restore from autobackup complete

output filename=/oradata/controlfile/o1_mf_28spy45z_.ctl

output filename=/oradata/controlfile/o2_mf_28spy45z_.ctl

Finished restore at 14-SEP-06

RMAN> alter database mount;

database mounted

released channel: ORA_DISK_1

Restore数据库:

RMAN> restore database;

Starting restore at 14-SEP-06

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=541 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 /oradata/datafile/o1_mf_system_28spy7kl_.dbf

restoring datafile 00002 to /oradata/datafile/o1_mf_undotbs1_28spykdh_.dbf

restoring datafile 00003 to /oradata/datafile/o1_mf_sysaux_28spyo9s_.dbf

restoring datafile 00004 to /oradata/datafile/o1_mf_users_28spyvm8_.dbf

restoring datafile 00005 to /oradata/datafile/o1_mf_vascms_2c444bhj_.dbf

restoring datafile 00006 to /oradata/datafile/o1_mf_wapgame_2c44gz55_.dbf

restoring datafile 00007 to /oradata/datafile/o1_mf_vascms_2c4kn0b2_.dbf

channel ORA_DISK_1: reading from backup piece /data3/ordrbak/full_ORDER_20060913_169

channel ORA_DISK_1: restored backup piece 1

piece handle=/data3/ordrbak/orderfullback_ORDER_20060913_169 tag=order

channel ORA_DISK_1: restore complete, elapsed time: 00:03:06

Finished restore at 14-SEP-06

进行基于时间点的恢复:

RMAN> recover database until time '2006-09-14 19:00:00'

2> ;

Starting recover at 14-SEP-06

using channel ORA_DISK_1

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

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

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

RMAN-03002: failure of recover command at 09/14/2006 22:49:54

ORA-01861: literal does not match format string

RMAN> exit

Recovery Manager complete.

这个错误是由于时间日期格式设置的问题。

设置正确的时间格式,进行基于时间点的不完全恢复:

[oracle@stat ~]$ export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'

[oracle@stat ~]$ rman target /

Recovery Manager: Release 10.2.0.2.0 - Production on Thu Sep 14 22:50:22 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: order (DBID=1341966532, not open)

RMAN> recover database until time '2006-09-14 19:00:00'

2> ;

Starting recover at 2006-09-14 22:50:26

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=544 devtype=DISK

starting media recovery

archive log thread 1 sequence 303 is already on disk as file

/oradata/archive/1_303_592917188.dbf

archive log thread 1 sequence 304 is already on disk as file

/oradata/archive/1_304_592917188.dbf

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=299

channel ORA_DISK_1: reading from backup piece /data3/ordrbak/arch_order_20060913_171

channel ORA_DISK_1: restored backup piece 1

piece handle=/data3/ordrbak/orderarch_order_20060913_171 tag=order

channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

archive log filename=/oradata/archive/1_299_592917188.dbf thread=1 sequence=299

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=300

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=301

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=302

channel ORA_DISK_1: reading from backup piece /data3/ordrbak/arch_order_20060914_173

channel ORA_DISK_1: restored backup piece 1

piece handle=/data3/ordrbak/orderarch_order_20060914_173 tag=TAG20060914T033004

channel ORA_DISK_1: restore complete, elapsed time: 00:00:08

archive log filename=/oradata/archive/1_300_592917188.dbf thread=1 sequence=300

archive log filename=/oradata/archive/1_301_592917188.dbf thread=1 sequence=301

archive log filename=/oradata/archive/1_302_592917188.dbf thread=1 sequence=302

archive log filename=/oradata/archive/1_303_592917188.dbf thread=1 sequence=303

archive log filename=/oradata/archive/1_304_592917188.dbf thread=1 sequence=304

media recovery complete, elapsed time: 00:00:57

Finished recover at 2006-09-14 22:51:39

Resetlogs打开数据库:

RMAN> alter database open resetlogs;

database opened

RMAN>

此时可以检查数据的正确性,假如无误就可以通过exp导出数据,再imp进生产数据库,完成恢复。

在有了充分的备份的前提下,这样的恢复是非常轻易的。

这个故事再次告诉我们:备份重于一切。

-The End-

原文地址:http://www.eygle.com/archives/2006/09/rman_until_time_recovery.Html

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有