使用RMAN,基于SCN的恢复

Startup mount;

Restore database until scn 2257708;

Recover database until scn 2257708;

Alter database open resetlogs;

RMAN> backup database include current controlfile plus archivelog;

Starting backup at 31-AUG-14

current log archived

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=172 devtype=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: sid=171 devtype=DISK

channel ORA_DISK_1: starting archive log backupset

channel ORA_DISK_1: specifying archive log(s) in backup set

input archive log thread=1 sequence=41 recid=102 stamp=857029576

input archive log thread=1 sequence=42 recid=120 stamp=857030255

channel ORA_DISK_1: starting piece 1 at 31-AUG-14

channel ORA_DISK_2: starting archive log backupset

channel ORA_DISK_2: specifying archive log(s) in backup set

input archive log thread=1 sequence=1 recid=121 stamp=857030556

input archive log thread=1 sequence=2 recid=122 stamp=857030662

input archive log thread=1 sequence=3 recid=140 stamp=857031098

channel ORA_DISK_2: starting piece 1 at 31-AUG-14

channel ORA_DISK_1: finished piece 1 at 31-AUG-14

piece handle=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/backupset/2014_08_31/o1_mf_annnn_TAG20140831T081423_b04t70so_.bkp tag=TAG20140831T081423 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

channel ORA_DISK_2: finished piece 1 at 31-AUG-14

piece handle=/bak/rmanbak/backup_3nphagiv_1_1 tag=TAG20140831T081423 comment=NONE

channel ORA_DISK_2: backup set complete, elapsed time: 00:00:02

channel ORA_DISK_1: starting archive log backupset

channel ORA_DISK_1: specifying archive log(s) in backup set

input archive log thread=1 sequence=1 recid=141 stamp=857031261

channel ORA_DISK_1: starting piece 1 at 31-AUG-14

channel ORA_DISK_1: finished piece 1 at 31-AUG-14

piece handle=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/backupset/2014_08_31/o1_mf_annnn_TAG20140831T081423_b04t72yz_.bkp tag=TAG20140831T081423 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 31-AUG-14


Starting backup at 31-AUG-14

using channel ORA_DISK_1

using channel ORA_DISK_2

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00001 name=/dat/DBData/oradata/NACEC/system01.dbf

input datafile fno=00012 name=/dat/DBData/oradata/NACEC/myTableSpace2.dbf

input datafile fno=00005 name=/dat/DBData/oradata/NACEC/test_undo.dbf

input datafile fno=00010 name=/dat/DBData/oradata/NACEC/liusm.dbf

input datafile fno=00015 name=/dat/DBData/oradata/NACEC/users03.dbf

input datafile fno=00004 name=/dat/DBData/oradata/NACEC/users01.dbf

input datafile fno=00014 name=/dat/DBSoftware/oracle/product/10.2.0/db_1/dbs/users02.dbf

channel ORA_DISK_1: starting piece 1 at 31-AUG-14

channel ORA_DISK_2: starting full datafile backupset

channel ORA_DISK_2: specifying datafile(s) in backupset

input datafile fno=00002 name=/dat/DBData/oradata/NACEC/undotbs01.dbf

input datafile fno=00003 name=/dat/DBData/oradata/NACEC/sysaux01.dbf

input datafile fno=00006 name=/dat/DBData/oradata/NACEC/tempundotbs.dbf

input datafile fno=00007 name=/dat/DBData/oradata/NACEC/ECOAL/test.dbf

input datafile fno=00011 name=/dat/DBData/oradata/NACEC/myTableSpace1.dbf

input datafile fno=00013 name=/dat/DBData/oradata/NACEC/myTableSpace3.dbf

input datafile fno=00008 name=/dat/DBData/oradata/NACEC/ECOAL/test1.dbf

input datafile fno=00009 name=/dat/DBData/oradata/NACEC/catalog.dbf

channel ORA_DISK_2: starting piece 1 at 31-AUG-14

channel ORA_DISK_1: finished piece 1 at 31-AUG-14

piece handle=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/backupset/2014_08_31/o1_mf_nnndf_TAG20140831T081428_b04t74hv_.bkp tag=TAG20140831T081428 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:06

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00016 name=/dat/DBData/oradata/NACEC/rowchain.dbf

channel ORA_DISK_1: starting piece 1 at 31-AUG-14

channel ORA_DISK_1: finished piece 1 at 31-AUG-14

piece handle=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/backupset/2014_08_31/o1_mf_nnndf_TAG20140831T081428_b04t9732_.bkp tag=TAG20140831T081428 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

including current control file in backupset

channel ORA_DISK_1: starting piece 1 at 31-AUG-14

channel ORA_DISK_2: finished piece 1 at 31-AUG-14

piece handle=/bak/rmanbak/backup_3qphagj4_1_1 tag=TAG20140831T081428 comment=NONE

channel ORA_DISK_2: backup set complete, elapsed time: 00:01:18

channel ORA_DISK_1: finished piece 1 at 31-AUG-14

piece handle=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/backupset/2014_08_31/o1_mf_ncnnf_TAG20140831T081428_b04t9lsf_.bkp tag=TAG20140831T081428 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:06

Finished backup at 31-AUG-14


Starting backup at 31-AUG-14

current log archived

using channel ORA_DISK_1

using channel ORA_DISK_2

channel ORA_DISK_1: starting archive log backupset

channel ORA_DISK_1: specifying archive log(s) in backup set

input archive log thread=1 sequence=2 recid=142 stamp=857031348

channel ORA_DISK_1: starting piece 1 at 31-AUG-14

channel ORA_DISK_1: finished piece 1 at 31-AUG-14

piece handle=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/backupset/2014_08_31/o1_mf_annnn_TAG20140831T081548_b04t9o63_.bkp tag=TAG20140831T081548 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 31-AUG-14


Starting Control File and SPFILE Autobackup at 31-AUG-14

piece handle=/bak/contf/ecoalchina_c-364029283-20140831-04 comment=NONE

Finished Control File and SPFILE Autobackup at 31-AUG-14



SQL> set time on

08:16:12 SQL> select current_scn from v$database;


CURRENT_SCN

-----------

    2257708


08:16:31 SQL> alter system checkpoint;


System altered.



08:16:55 SQL> conn test/test;

Connected.

08:17:02 SQL> select * from test;

select * from test

              *

ERROR at line 1:

ORA-00942: table or view does not exist



08:17:09 SQL> create table test (id number,name varchar2(20));


Table created.


08:17:53 SQL> insert into test values (1,'liushiming');


1 row created.


08:18:10 SQL> commit;


Commit complete.


08:18:13 SQL> select * from test;


        ID NAME

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

         1 liushiming


08:18:33 SQL> conn / as sysdba

Connected.

08:18:39 SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

08:19:12 SQL> startup mount;

ORACLE instance started.


Total System Global Area  419430400 bytes

Fixed Size                  1267812 bytes

Variable Size             301991836 bytes

Database Buffers          109051904 bytes

Redo Buffers                7118848 bytes

Database mounted.


RMAN> restore database until scn 2257708;


Starting restore at 31-AUG-14

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=185 devtype=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: sid=184 devtype=DISK


skipping datafile 14; already restored to file /dat/DBSoftware/oracle/product/10.2.0/db_1/dbs/users02.dbf

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /dat/DBData/oradata/NACEC/system01.dbf

restoring datafile 00004 to /dat/DBData/oradata/NACEC/users01.dbf

restoring datafile 00005 to /dat/DBData/oradata/NACEC/test_undo.dbf

restoring datafile 00010 to /dat/DBData/oradata/NACEC/liusm.dbf

restoring datafile 00012 to /dat/DBData/oradata/NACEC/myTableSpace2.dbf

restoring datafile 00015 to /dat/DBData/oradata/NACEC/users03.dbf

channel ORA_DISK_1: reading from backup piece /dat/DBSoftware/oracle/flash_recovery_area/NACEC/backupset/2014_08_31/o1_mf_nnndf_TAG20140831T081428_b04t74hv_.bkp

channel ORA_DISK_2: starting datafile backupset restore

channel ORA_DISK_2: specifying datafile(s) to restore from backup set

restoring datafile 00016 to /dat/DBData/oradata/NACEC/rowchain.dbf

channel ORA_DISK_2: reading from backup piece /dat/DBSoftware/oracle/flash_recovery_area/NACEC/backupset/2014_08_31/o1_mf_nnndf_TAG20140831T081428_b04t9732_.bkp

channel ORA_DISK_2: restored backup piece 1

piece handle=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/backupset/2014_08_31/o1_mf_nnndf_TAG20140831T081428_b04t9732_.bkp tag=TAG20140831T081428

channel ORA_DISK_2: restore complete, elapsed time: 00:00:02

channel ORA_DISK_2: starting datafile backupset restore

channel ORA_DISK_2: specifying datafile(s) to restore from backup set

restoring datafile 00002 to /dat/DBData/oradata/NACEC/undotbs01.dbf

restoring datafile 00003 to /dat/DBData/oradata/NACEC/sysaux01.dbf

restoring datafile 00006 to /dat/DBData/oradata/NACEC/tempundotbs.dbf

restoring datafile 00007 to /dat/DBData/oradata/NACEC/ECOAL/test.dbf

restoring datafile 00008 to /dat/DBData/oradata/NACEC/ECOAL/test1.dbf

restoring datafile 00009 to /dat/DBData/oradata/NACEC/catalog.dbf

restoring datafile 00011 to /dat/DBData/oradata/NACEC/myTableSpace1.dbf

restoring datafile 00013 to /dat/DBData/oradata/NACEC/myTableSpace3.dbf

channel ORA_DISK_2: reading from backup piece /bak/rmanbak/backup_3qphagj4_1_1

channel ORA_DISK_1: restored backup piece 1

piece handle=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/backupset/2014_08_31/o1_mf_nnndf_TAG20140831T081428_b04t74hv_.bkp tag=TAG20140831T081428

channel ORA_DISK_1: restore complete, elapsed time: 00:01:27

channel ORA_DISK_2: restored backup piece 1

piece handle=/bak/rmanbak/backup_3qphagj4_1_1 tag=TAG20140831T081428

channel ORA_DISK_2: restore complete, elapsed time: 00:01:25

Finished restore at 31-AUG-14


RMAN> recover database until scn 2257708;


Starting recover at 31-AUG-14

using channel ORA_DISK_1

using channel ORA_DISK_2


starting media recovery


archive log thread 1 sequence 42 is already on disk as file /dat/DBSoftware/oracle/flash_recovery_area/NACEC/archivelog/2014_08_31/o1_mf_1_42_b04s7hc0_.arc

archive log thread 1 sequence 1 is already on disk as file /dat/DBSoftware/oracle/flash_recovery_area/NACEC/archivelog/2014_08_31/o1_mf_1_1_b04sjwr2_.arc

archive log thread 1 sequence 2 is already on disk as file /dat/DBSoftware/oracle/flash_recovery_area/NACEC/archivelog/2014_08_31/o1_mf_1_2_b04sn651_.arc

archive log thread 1 sequence 3 is already on disk as file /dat/DBSoftware/oracle/flash_recovery_area/NACEC/archivelog/2014_08_31/o1_mf_1_3_b04t1tg0_.arc

archive log thread 1 sequence 1 is already on disk as file /dat/DBSoftware/oracle/flash_recovery_area/NACEC/archivelog/2014_08_31/o1_mf_1_1_b04t6xjq_.arc

archive log thread 1 sequence 2 is already on disk as file /dat/DBSoftware/oracle/flash_recovery_area/NACEC/archivelog/2014_08_31/o1_mf_1_2_b04t9myt_.arc

archive log filename=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/archivelog/2014_08_31/o1_mf_1_1_b04sjwr2_.arc thread=1 sequence=1

archive log filename=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/archivelog/2014_08_31/o1_mf_1_2_b04sn651_.arc thread=1 sequence=2

archive log filename=/dat/DBSoftware/oracle/flash_recovery_area/NACEC/archivelog/2014_08_31/o1_mf_1_3_b04t1tg0_.arc thread=1 sequence=3

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

Finished recover at 31-AUG-14


08:19:26 SQL> alter database open resetlogs;


Database altered.


08:22:18 SQL> conn test/test;

Connected.

08:22:25 SQL> select * from test;

select * from test

              *

ERROR at line 1:

ORA-00942: table or view does not exist


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

转载于:http://blog.itpub.net/31448824/viewspace-2137521/

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值