ITPub博客

首页 > 数据库 > Oracle > Recovery Manager(RMAN)(四) 增量备份级别测试!

Recovery Manager(RMAN)(四) 增量备份级别测试!

原创 Oracle 作者:lvqf 时间:2011-04-08 05:31:30 0 删除 编辑

RMAN备份方式分为:完全备份、增量备份(差异备份和累计备份)

差异备份(differential):只备份 离最近一次增量备份后 所有改变的块。(增量备份默认方式)

累计备份(cumulative):基于最近一次0级增量备份后,所有改变的块。

完全备份与0 级备份不同之处就在于完全备份永远不会包含在增量备份策略中。

以下实验环境:32-bit WindowsORACLE 10.2.0.1.0,归档模式

例子1

验证:没有0级备份下,多次0级以上同等级的累计备份其本质都是0 级备份(从备份集大小可以看出),使用最新一次备份用于恢复

[@more@]

RMAN> list backupset;

RMAN> backup as compressed backupset incremental level=1 cumulative database;

---另一个窗口中--

SQL> insert into test.t1 values(8);

1 row created.

SQL> commit;

Commit complete.

SQL> ALTER SYSTEM SWITCH LOGFILE;

System altered.

-----

RMAN> backup as compressed backupset incremental level=1 cumulative database;

-----

RMAN> list backup;

List of Backup Sets

===================

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

70 Incr 1 128.57M DISK 00:00:54 08-APR-11

BP Key: 70 Status: AVAILABLE Compressed: YES Tag: TAG20110408T051858

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET2011_04_08O1_MF_NNND1_TAG20110408T051858_6SWBL3N0_.BKP

List of Datafiles in backup set 70

File LV Type Ckp SCN Ckp Time Name

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

1 1 Incr 835220 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF

2 1 Incr 835220 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF

3 1 Incr 835220 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSAUX01.DBF

4 1 Incr 835220 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF

5 1 Incr 835220 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP101.DBF

6 1 Incr 835220 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP02.DBF

7 1 Incr 835220 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS02.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

71 Incr 1 1.06M DISK 00:00:04 08-APR-11

BP Key: 71 Status: AVAILABLE Compressed: YES Tag: TAG20110408T051858

Piece Name:D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET2011_04_08O1_MF_NCSN1_TAG20110408T051858_6SWBMX00_.BKP

Control File Included: Ckp SCN: 835238 Ckp time: 08-APR-11

SPFILE Included: Modification time: 08-APR-11

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

72 Incr 1 128.57M DISK 00:00:56 08-APR-11

BP Key: 72 Status: AVAILABLE Compressed: YES Tag: TAG20110408T052313

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET2011_04_08O1_MF_NNND1_TAG20110408T052313_6SWBT1TV_.BKP

List of Datafiles in backup set 72

File LV Type Ckp SCN Ckp Time Name

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

1 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF

2 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF

3 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSAUX01.DBF

4 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF

5 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP101.DBF

6 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP02.DBF

7 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS02.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

73 Incr 1 1.06M DISK 00:00:03 08-APR-11

BP Key: 73 Status: AVAILABLE Compressed: YES Tag: TAG20110408T052313

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET

2011_04_08O1_MF_NCSN1_TAG20110408T052313_6SWBW5C7_.BKP

Control File Included: Ckp SCN: 835338 Ckp time: 08-APR-11

SPFILE Included: Modification time: 08-APR-11

-----预览恢复-----

RMAN> restore preview database;

Starting restore at 08-APR-11

using channel ORA_DISK_1

List of Backup Sets

===================

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

72 Incr 1 128.57M DISK 00:00:56 08-APR-11

BP Key: 72 Status: AVAILABLE Compressed: YES Tag: TAG20110408T052313

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET

2011_04_08O1_MF_NNND1_TAG20110408T052313_6SWBT1TV_.BKP

List of Datafiles in backup set 72

File LV Type Ckp SCN Ckp Time Name

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

1 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF

2 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF

3 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSAUX01.DBF

4 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF

5 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP101.DBF

6 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP02.DBF

7 1 Incr 835316 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS02.DBF

archive logs generated after SCN 835316 not found in repository

Media recovery start SCN is 835316

Recovery must be done beyond SCN 835316 to clear data files fuzziness

Finished restore at 08-APR-11

---验证完毕-----

例子2

验证:依次进行2,3,3级累计备份,则2级备份本质是0 级备份,3级则为真正累计备份,恢复时使用2级和最新一次3级累计备份

RMAN> list backupset;

RMAN> backup as compressed backupset incremental level=2 cumulative database;

---另一个窗口中--

SQL> insert into test.t1 values(8);

1 row created.

SQL> commit;

Commit complete.

SQL> ALTER SYSTEM SWITCH LOGFILE;

System altered.

-----

RMAN> backup as compressed backupset incremental level=3 cumulative database;

---另一个窗口中--

SQL> insert into test.t1 values(8);

1 row created.

SQL> commit;

Commit complete.

SQL> select count(*) from test.t1;

COUNT(*)

----------

20

SQL> ALTER SYSTEM SWITCH LOGFILE;

System altered.

-------

RMAN> backup as compressed backupset incremental level=3 cumulative database;

RMAN> list backup;

List of Backup Sets

===================

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

64 Incr 2 128.41M DISK 00:00:56 08-APR-11

BP Key: 64 Status: AVAILABLE Compressed: YES Tag: TAG20110408T050720

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET

2011_04_08O1_MF_NNND2_TAG20110408T050720_6SW9W9GN_.BKP

List of Datafiles in backup set 64

File LV Type Ckp SCN Ckp Time Name

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

1 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF

2 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF

3 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSAUX01.DBF

4 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF

5 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP101.DBF

6 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP02.DBF

7 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS02.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

65 Incr 2 1.06M DISK 00:00:04 08-APR-11

BP Key: 65 Status: AVAILABLE Compressed: YES Tag: TAG20110408T050720

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET

2011_04_08O1_MF_NCSN2_TAG20110408T050720_6SW9YDXS_.BKP

Control File Included: Ckp SCN: 834369 Ckp time: 08-APR-11

SPFILE Included: Modification time: 08-APR-11

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

66 Incr 3 1.09M DISK 00:00:33 08-APR-11

BP Key: 66 Status: AVAILABLE Compressed: YES Tag: TAG20110408T050919

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET

2011_04_08O1_MF_NNND3_TAG20110408T050919_6SWB00LK_.BKP

List of Datafiles in backup set 66

File LV Type Ckp SCN Ckp Time Name

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

1 3 Incr 834398 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF

2 3 Incr 834398 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF

3 3 Incr 834398 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSAUX01.DBF

4 3 Incr 834398 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF

5 3 Incr 834398 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP101.DBF

6 3 Incr 834398 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP02.DBF

7 3 Incr 834398 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS02.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

67 Incr 3 1.06M DISK 00:00:03 08-APR-11

BP Key: 67 Status: AVAILABLE Compressed: YES Tag: TAG20110408T050919

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET

2011_04_08O1_MF_NCSN3_TAG20110408T050919_6SWB156C_.BKP

Control File Included: Ckp SCN: 834409 Ckp time: 08-APR-11

SPFILE Included: Modification time: 08-APR-11

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

68 Incr 3 1.09M DISK 00:00:32 08-APR-11

BP Key: 68 Status: AVAILABLE Compressed: YES Tag: TAG20110408T051127

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET

2011_04_08O1_MF_NNND3_TAG20110408T051127_6SWB3ZQG_.BKP

List of Datafiles in backup set 68

File LV Type Ckp SCN Ckp Time Name

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

1 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF

2 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF

3 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSAUX01.DBF

4 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF

5 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP101.DBF

6 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP02.DBF

7 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS02.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

69 Incr 3 1.06M DISK 00:00:04 08-APR-11

BP Key: 69 Status: AVAILABLE Compressed: YES Tag: TAG20110408T051127

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET

2011_04_08O1_MF_NCSN3_TAG20110408T051127_6SWB552X_.BKP

Control File Included: Ckp SCN: 834466 Ckp time: 08-APR-11

SPFILE Included: Modification time: 08-APR-11

----预览恢复,发现分别用到2级和最新的一次3级备份----

RMAN> restore preview database;

Starting restore at 08-APR-11

using channel ORA_DISK_1

List of Backup Sets

===================

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

64 Incr 2 128.41M DISK 00:00:56 08-APR-11

BP Key: 64 Status: AVAILABLE Compressed: YES Tag: TAG20110408T050720

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET

2011_04_08O1_MF_NNND2_TAG20110408T050720_6SW9W9GN_.BKP

List of Datafiles in backup set 64

File LV Type Ckp SCN Ckp Time Name

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

1 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF

2 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF

3 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSAUX01.DBF

4 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF

5 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP101.DBF

6 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP02.DBF

7 2 Incr 834275 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS02.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

68 Incr 3 1.09M DISK 00:00:32 08-APR-11

BP Key: 68 Status: AVAILABLE Compressed: YES Tag: TAG20110408T051127

Piece Name: D:ORACLEPRODUCT10.2.0FLASH_RECOVERY_AREATESTBACKUPSET

2011_04_08O1_MF_NNND3_TAG20110408T051127_6SWB3ZQG_.BKP

List of Datafiles in backup set 68

File LV Type Ckp SCN Ckp Time Name

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

1 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF

2 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DBF

3 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTSYSAUX01.DBF

4 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUSERS01.DBF

5 3 Incr 834454 08-APR-11

D:ORACLEPRODUCT10.2.0ORADATATESTTEMP101.DBF

6 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTTEMP02.DBF

7 3 Incr 834454 08-APR-11 D:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS02.DBF

archive logs generated after SCN 834454 not found in repository

Media recovery start SCN is 834454

Recovery must be done beyond SCN 834454 to clear data files fuzziness

Finished restore at 08-APR-11

---验证完毕---

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

上一篇: ROLLUP和CUBE 用法
请登录后发表评论 登录
全部评论

注册时间:2011-03-10

  • 博文量
    13
  • 访问量
    26596