Oracle 11g 本机 RMAN 恢复

login as: oracle
oracle@192.168.3.91's password:
Last login: Fri Aug 21 21:49:41 2015 from 192.168.3.40
[oracle@zhoux ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Aug 21 21:50:08 2015

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

connected to target database (not started)

RMAN> startup mount

Oracle instance started
database mounted

Total System Global Area    1269366784 bytes

Fixed Size                     2212976 bytes
Variable Size                805309328 bytes
Database Buffers             452984832 bytes
Redo Buffers                   8859648 bytes

RMAN> restore database until time '2015-08-21 16:31:40';

Starting restore at 2015-08-21 21:56:39
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/21/2015 21:56:40
RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time

RMAN> restore database until time '2015-08-21 16:25:40'
2> ;

Starting restore at 2015-08-21 21:57:06
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/21/2015 21:57:06
RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time

RMAN> list incarnation of  database "orcl";  (这里报错的期他操作导致的,原因我也没找到)


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORCL     1416058342       PARENT  1          2009-08-15 00:16:43
2       2       ORCL     1416058342       PARENT  945184     2015-08-20 23:46:49
3       3       ORCL     1416058342       CURRENT 1042806    2015-08-21 17:28:04

RMAN> reset database to incarnation 2;   (根据需要恢复的时间段,选择)

database reset to incarnation 2

RMAN> restore database until time '2015-08-21 16:25:40';

Starting restore at 2015-08-21 21:57:52
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /app/oracle/oradata/orcl/sysaux0
channel ORA_DISK_1: restoring datafile 00003 to /app/oracle/oradata/orcl/undotbs
channel ORA_DISK_1: restoring datafile 00004 to /app/oracle/oradata/orcl/users01
channel ORA_DISK_1: reading from backup piece /backup/databackup/db_ORCL_5_1_201
channel ORA_DISK_1: piece handle=/backup/databackup/db_ORCL_5_1_20150821 tag=TAG
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /app/oracle/oradata/orcl/system0
channel ORA_DISK_1: restoring datafile 00005 to /app/oracle/oradata/orcl/example
channel ORA_DISK_1: reading from backup piece /backup/databackup/db_ORCL_4_1_201
channel ORA_DISK_1: piece handle=/backup/databackup/db_ORCL_4_1_20150821 tag=TAG
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:36
Finished restore at 2015-08-21 22:01:03

RMAN> recover database until time '2015-08-21 16:27:49';

Starting recover at 2015-08-21 22:04:44
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 10 is already on disk as file /app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_10_bxczfhkr_.arc
archived log for thread 1 with sequence 11 is already on disk as file /app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_11_bxfvs5sp_.arc
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=7
channel ORA_DISK_1: reading from backup piece /backup/logbackup/log_ORCL_6_1_20150821
channel ORA_DISK_1: piece handle=/backup/logbackup/log_ORCL_6_1_20150821 tag=TAG20150821T000934
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_7_bxgczz0q_.arc thread=1 sequence=7
channel default: deleting archived log(s)
archived log file name=/app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_7_bxgczz0q_.arc RECID=13 STAMP=888357887
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=8
channel ORA_DISK_1: reading from backup piece /backup/logbackup/log_ORCL_8_1_20150821
channel ORA_DISK_1: piece handle=/backup/logbackup/log_ORCL_8_1_20150821 tag=TAG20150821T001748
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_8_bxgd01jx_.arc thread=1 sequence=8
channel default: deleting archived log(s)
archived log file name=/app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_8_bxgd01jx_.arc RECID=14 STAMP=888357889
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=9
channel ORA_DISK_1: reading from backup piece /backup/logbackup/log_ORCL_9_1_20150821
channel ORA_DISK_1: piece handle=/backup/logbackup/log_ORCL_9_1_20150821 tag=TAG20150821T001748
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_9_bxgd0318_.arc thread=1 sequence=9
channel default: deleting archived log(s)
archived log file name=/app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_9_bxgd0318_.arc RECID=15 STAMP=888357891
archived log file name=/app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_10_bxczfhkr_.arc thread=1 sequence=10
archived log file name=/app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_11_bxfvs5sp_.arc thread=1 sequence=11
media recovery complete, elapsed time: 00:00:03
Finished recover at 2015-08-21 22:04:54

SQL> alter database open read only;
  (这里注意,要在PL/SQL里执行read only 开启数据库,不可以用 resetlogs 否则,因为日志文件已重建,是无法再使用recover 命令的)
RMAN> recover database until time '2015-08-21 16:30:49';

Starting recover at 2015-08-21 22:07:25
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/21/2015 22:07:26
RMAN-20020: database incarnation not set

RMAN> shutdown immediate

database closed
database dismounted
Oracle instance shut down

RMAN> startup mount

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area    1269366784 bytes

Fixed Size                     2212976 bytes
Variable Size                805309328 bytes
Database Buffers             452984832 bytes
Redo Buffers                   8859648 bytes

RMAN> recover database until time '2015-08-21 16:30:49';

Starting recover at 2015-08-21 22:07:29
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK

starting media recovery

archived log for thread 1 with sequence 11 is already on disk as file /app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_11_bxfvs5sp_.arc
archived log file name=/app/oracle/flash_recovery_area/ORCL/archivelog/2015_08_21/o1_mf_1_11_bxfvs5sp_.arc thread=1 sequence=11
media recovery complete, elapsed time: 00:00:00
Finished recover at 2015-08-21 22:07:31


转载于:https://my.oschina.net/zhouxiang/blog/495652

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值