RMAN系列-基于scn恢复

本文展示了使用RMAN进行Oracle数据库的备份与恢复操作的具体过程,包括全备与增量备份、数据文件与控制文件的备份、归档日志的备份及数据库恢复到指定SCN的操作。
RMAN> list backup;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    581.66M    DISK        00:00:32     16-JAN-11      
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T092444
        Piece Name: /oracle/orabak/databak/20110116_02m28b6s.dbf
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 484150     16-JAN-11 /oracle/oradata/orcl/system01.dbf
  2       Full 484150     16-JAN-11 /oracle/oradata/orcl/undotbs01.dbf
  3       Full 484150     16-JAN-11 /oracle/oradata/orcl/sysaux01.dbf
  4       Full 484150     16-JAN-11 /oracle/oradata/orcl/users01.dbf
  5       Full 484150     16-JAN-11 /oracle/oradata/orcl/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4       Full    6.80M      DISK        00:00:01     16-JAN-11      
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T092522
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-00
  Control File Included: Ckp SCN: 484217       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    6.80M      DISK        00:00:01     16-JAN-11      
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T092643
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-01
  Control File Included: Ckp SCN: 484288       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6       Full    88.00K     DISK        00:00:00     16-JAN-11      
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T092719
        Piece Name: /oracle/flash_recovery_area/ORCL/backupset/2011_01_16/o1_mf_nnndf_TAG20110116T092719_6m4lcq82_.bkp
  List of Datafiles in backup set 6
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  6       Full 484316     16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7       Full    6.80M      DISK        00:00:00     16-JAN-11      
        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T092720
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-02
  Control File Included: Ckp SCN: 484321       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8       Full    88.00K     DISK        00:00:00     16-JAN-11      
        BP Key: 8   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T092810
        Piece Name: /oracle/orabak/databak/20110116_08m28bdb.dbf
  List of Datafiles in backup set 8
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  6       Full 484356     16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9       Full    6.80M      DISK        00:00:00     16-JAN-11      
        BP Key: 9   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T092812
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-03
  Control File Included: Ckp SCN: 484360       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10      Full    6.80M      DISK        00:00:00     16-JAN-11      
        BP Key: 10   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T093130
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-04
  Control File Included: Ckp SCN: 484545       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11      Full    6.80M      DISK        00:00:01     16-JAN-11      
        BP Key: 11   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T093145
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-05
  Control File Included: Ckp SCN: 484564       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12      Full    6.80M      DISK        00:00:01     16-JAN-11      
        BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T093400
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-06
  Control File Included: Ckp SCN: 484635       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    6.80M      DISK        00:00:00     16-JAN-11      
        BP Key: 13   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T093934
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-07
  Control File Included: Ckp SCN: 485199       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
14      Full    6.77M      DISK        00:00:02     16-JAN-11      
        BP Key: 14   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T100750
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-09
  Control File Included: Ckp SCN: 484437       Ckp time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
17      Full    581.71M    DISK        00:00:29     16-JAN-11      
        BP Key: 17   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T101114
        Piece Name: /oracle/orabak/databak/20110116_0jm28du2.dbf
  List of Datafiles in backup set 17
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 484591     16-JAN-11 /oracle/oradata/orcl/system01.dbf
  2       Full 484591     16-JAN-11 /oracle/oradata/orcl/undotbs01.dbf
  3       Full 484591     16-JAN-11 /oracle/oradata/orcl/sysaux01.dbf
  4       Full 484591     16-JAN-11 /oracle/oradata/orcl/users01.dbf
  5       Full 484591     16-JAN-11 /oracle/oradata/orcl/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
19      Full    6.77M      DISK        00:00:00     16-JAN-11      
        BP Key: 19   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T101152
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-0a
  Control File Included: Ckp SCN: 484611       Ckp time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
20      Full    6.77M      DISK        00:00:00     16-JAN-11      
        BP Key: 20   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T101321
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-0b
  Control File Included: Ckp SCN: 484688       Ckp time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
21      Full    6.80M      DISK        00:00:00     16-JAN-11      
        BP Key: 21   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T103611
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-0c
  Control File Included: Ckp SCN: 486939       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
22      Full    6.80M      DISK        00:00:01     16-JAN-11      
        BP Key: 22   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T104438
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-0d
  Control File Included: Ckp SCN: 487410       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
26      78.50K     DISK        00:00:01     16-JAN-11      
        BP Key: 26   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T104511
        Piece Name: /oracle/orabak/logbak/20110116_0sm28ftt.arc

  List of Archived Logs in backup set 26
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    1       487220     16-JAN-11 487455     16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
27      Full    584.91M    DISK        00:00:29     16-JAN-11      
        BP Key: 27   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T104519
        Piece Name: /oracle/orabak/databak/20110116_0tm28fu0.dbf
  List of Datafiles in backup set 27
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 487463     16-JAN-11 /oracle/oradata/orcl/system01.dbf
  2       Full 487463     16-JAN-11 /oracle/oradata/orcl/undotbs01.dbf
  3       Full 487463     16-JAN-11 /oracle/oradata/orcl/sysaux01.dbf
  4       Full 487463     16-JAN-11 /oracle/oradata/orcl/users01.dbf
  5       Full 487463     16-JAN-11 /oracle/oradata/orcl/example01.dbf
  6       Full 487463     16-JAN-11 /oracle/oradata/orcl/jason01.dbf

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
28      6.50K      DISK        00:00:01     16-JAN-11      
        BP Key: 28   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T104555
        Piece Name: /oracle/orabak/logbak/20110116_0um28fv3.arc

  List of Archived Logs in backup set 28
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    2       487455     16-JAN-11 487483     16-JAN-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
29      Full    6.80M      DISK        00:00:01     16-JAN-11      
        BP Key: 29   Status: AVAILABLE  Compressed: NO  Tag: TAG20110116T104557
        Piece Name: /oracle/orabak/ctlbak/c-1268348214-20110116-0e
  Control File Included: Ckp SCN: 487489       Ckp time: 16-JAN-11
  SPFILE Included: Modification time: 16-JAN-11

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     285212672 bytes

Fixed Size                     1218968 bytes
Variable Size                 88082024 bytes
Database Buffers             188743680 bytes
Redo Buffers                   7168000 bytes

RMAN> restore database until scn 487489;

Starting restore at 16-JAN-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 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 /oracle/oradata/orcl/system01.dbf
restoring datafile 00002 to /oracle/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /oracle/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /oracle/oradata/orcl/users01.dbf
restoring datafile 00005 to /oracle/oradata/orcl/example01.dbf
restoring datafile 00006 to /oracle/oradata/orcl/jason01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/orabak/databak/20110116_0tm28fu0.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/orabak/databak/20110116_0tm28fu0.dbf tag=TAG20110116T104519
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 16-JAN-11

RMAN> recover database until scn 487489;

Starting recover at 16-JAN-11
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:04

Finished recover at 16-JAN-11

RMAN> alter database open resetlogs;

database opened

RMAN>

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

转载于:http://blog.itpub.net/22741583/viewspace-683921/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值