2013年(350)
分类: Oracle
2013-04-27 09:43:44
RMAN中的BACKUP命令提供了一个AS COMPRESSED BACKUPSET的选项。如果在执行BACKUP命令时指定了该选项,集在创建过程中就会应用压缩算法,通过这种方式使用倒是挺简单,也不需要其它额外的操作。例如:
RMAN> backup as compressed backupset tablespace system;
Starting backup at 15-APR-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=F:\ORACLE\ORADATA\JSSBOOK\SYSTEM01.DBF
channel ORA_DISK_1: starting piece 1 at 15-APR-09
channel ORA_DISK_1: finished piece 1 at 15-APR-09
piece handle=F:\ORACLE\BACKUP\BAK_11KCIHRB_1_1 tag=TAG20090415T214059 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 15-APR-09
channel ORA_DISK_1: finished piece 1 at 15-APR-09
piece handle=F:\ORACLE\BACKUP\BAK_12KCIHRQ_1_1 tag=TAG20090415T214059 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 15-APR-09
接着对相同表空间创建一个不压缩的备份集:
RMAN> backup tablespace system;
Starting backup at 15-APR-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=F:\ORACLE\ORADATA\JSSBOOK\SYSTEM01.DBF
channel ORA_DISK_1: starting piece 1 at 15-APR-09
channel ORA_DISK_1: finished piece 1 at 15-APR-09
piece handle=F:\ORACLE\BACKUP\BAK_13KCIHS6_1_1 tag=TAG20090415T214126 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 15-APR-09
channel ORA_DISK_1: finished piece 1 at 15-APR-09
piece handle=F:\ORACLE\BACKUP\BAK_14KCIHSM_1_1 tag=TAG20090415T214126 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 15-APR-09
列出两个备份集,对比看看:
RMAN> list backup of tablespace system;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
29 Full 27.60M DISK 00:00:09 15-APR-09
BP Key: 96 Status: AVAILABLE Compressed: YES Tag: TAG20090415T214059
Piece Name: F:\ORACLE\BACKUP\BAK_11KCIHRB_1_1
List of Datafiles in backup set 29
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 798005 15-APR-09 F:\ORACLE\ORADATA\JSSBOOK\SYSTEM01.DBF
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
31 Full 129.20M DISK 00:00:13 15-APR-09
BP Key: 98 Status: AVAILABLE Compressed: NO Tag: TAG20090415T214126
Piece Name: F:\ORACLE\BACKUP\BAK_13KCIHS6_1_1
List of Datafiles in backup set 31
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 798020 15-APR-09 F:\ORACLE\ORADATA\JSSBOOK\SYSTEM01.DBF
从LIST BACKUP中的信息可以看出,压缩比还是比较理想。不过压缩备份集虽然能够节省一些存储空间,但肯定会降低备份的速度,这中间如何取舍就取决于你的实际需求了。