Oracle10g備份集壓縮新特性(Backupset Compression)

perfychi發表於2012-08-28

Oracle10g允許你和BACKUP命令伴隨使用AS COMPRESSED BACKUPSET字句,對備份集進行壓縮。
這個壓縮備份在恢復時無需解壓縮,這一特性在以下條件下可能大為有益:
1.你的備份儲存空間有限
2.透過網路備份而頻寬有限
3.直接備份至磁帶、CD,DVD介質而壓縮不可用

 

體會:壓縮備份集空間佔用的少,但是壓縮過程佔用cpu多。好像恢復時也不需要解壓縮。

你可以選擇在備份命令裡顯示指定壓縮選項:
BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;
--僅對1,5檔案壓縮備份
BACKUP AS COMPRESSED BACKUPSET DATAFILE 1,5;

也可以配置RMAN指定壓縮選項:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;

但是壓縮備份會消耗更多的資源以及時間。
我們看一下以下測試:

1.壓縮備份

RMAN> backup full filesperset 11 database ; Starting backup at 29-MAR-05 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=161 devtype=DISK channel ORA_DISK_1: starting compressed full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00009 name=/data1/oradata/systemfile/bigtbs.dbf input datafile fno=00001 name=/opt/oracle/oradata/eygle/system01.dbf input datafile fno=00006 name=/opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_test_03xv34ny_.dbf input datafile fno=00002 name=/opt/oracle/oradata/eygle/undotbs01.dbf input datafile fno=00003 name=/opt/oracle/oradata/eygle/sysaux01.dbf input datafile fno=00004 name=/opt/oracle/oradata/eygle/users01.dbf input datafile fno=00007 name=/opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_itpub_03xv5g66_.dbf input datafile fno=00010 name=/opt/oracle/oradata/eygle/dfmbrc.dbf input datafile fno=00008 name=/opt/oracle/oradata/eygle/trans01.dbf input datafile fno=00005 name=/data1/oradata/systemfile/eygle01.dbf channel ORA_DISK_1: starting piece 1 at 29-MAR-05 channel ORA_DISK_1: finished piece 1 at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/backupset/ 2005_03_29/o1_mf_nnndf_TAG20050329T062814_14k1813y_.bkp comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:08:35 channel ORA_DISK_1: starting compressed full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00011 name=/opt/oracle/oradata/eygle/t2k01.dbf channel ORA_DISK_1: starting piece 1 at 29-MAR-05 channel ORA_DISK_1: finished piece 1 at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/backupset/2005_03_29/ o1_mf_nnndf_TAG20050329T062814_14k1r4fh_.bkp comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 Finished backup at 29-MAR-05 Starting Control File and SPFILE Autobackup at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/autobackup/ 2005_03_29/o1_mf_s_554193419_14k1rdyr_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 29-MAR-05

注意壓縮備耗時:00:08:35 + 00:00:07 = 8:42 = 522s

2.非壓縮備份

RMAN> configure device type disk backup type to compressed backupset; old RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1; new RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1; new RMAN configuration parameters are successfully stored released channel: ORA_DISK_1 RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO backupset; old RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1; new RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET PARALLELISM 1; new RMAN configuration parameters are successfully stored RMAN> backup full filesperset 11 database ; Starting backup at 29-MAR-05 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=161 devtype=DISK channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00009 name=/data1/oradata/systemfile/bigtbs.dbf input datafile fno=00001 name=/opt/oracle/oradata/eygle/system01.dbf input datafile fno=00006 name=/opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_test_03xv34ny_.dbf input datafile fno=00002 name=/opt/oracle/oradata/eygle/undotbs01.dbf input datafile fno=00003 name=/opt/oracle/oradata/eygle/sysaux01.dbf input datafile fno=00004 name=/opt/oracle/oradata/eygle/users01.dbf input datafile fno=00007 name=/opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_itpub_03xv5g66_.dbf input datafile fno=00010 name=/opt/oracle/oradata/eygle/dfmbrc.dbf input datafile fno=00008 name=/opt/oracle/oradata/eygle/trans01.dbf input datafile fno=00005 name=/data1/oradata/systemfile/eygle01.dbf channel ORA_DISK_1: starting piece 1 at 29-MAR-05 channel ORA_DISK_1: finished piece 1 at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/backupset/2005_03_29/ o1_mf_nnndf_TAG20050329T065513_14k2tmx7_.bkp comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:55 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00011 name=/opt/oracle/oradata/eygle/t2k01.dbf channel ORA_DISK_1: starting piece 1 at 29-MAR-05 channel ORA_DISK_1: finished piece 1 at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/backupset/2005_03_29/ o1_mf_nnndf_TAG20050329T065513_14k2y7go_.bkp comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 Finished backup at 29-MAR-05 Starting Control File and SPFILE Autobackup at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/autobackup/2005_03_29/ o1_mf_s_554194638_14k2yhwz_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 29-MAR-05 RMAN>

非壓縮備份耗時: 00:01:55 + 00:00:07 = 2:02 = 122s
壓縮備份使用的時間是非壓縮方式的: 522 / 122 = 4.28 倍.

3.壓縮比率

$ ls -l total 2585568 -rw-r----- 1 oracle dba 190103552 Mar 29 06:36 o1_mf_nnndf_TAG20050329T062814_14k1813y_.bkp -rw-r----- 1 oracle dba 1093632 Mar 29 06:36 o1_mf_nnndf_TAG20050329T062814_14k1r4fh_.bkp -rw-r----- 1 oracle dba 1130618880 Mar 29 06:57 o1_mf_nnndf_TAG20050329T065513_14k2tmx7_.bkp -rw-r----- 1 oracle dba 1302528 Mar 29 06:57 o1_mf_nnndf_TAG20050329T065513_14k2y7go_.bkp

壓縮備份大小: 190103552 + 1093632 = 182.33984375 M
非壓縮備份集: 1130618880 + 1302528 = 1079.484375 M

非壓縮較壓縮大小: 1079.484375/182.33984375 = 5.9 倍
壓縮方式大大節省了空間。

4.CPU消耗
壓縮備份時CPU消耗:

PID USERNAME THR PR NCE SIZE RES STATE TIME FLTS CPU COMMAND 15252 oracle 11 10 0 430M 353M cpu01 1:38 0 26.35% oracle

大約在26%左右。
而非壓縮模式下CPU消耗:

PID USERNAME THR PR NCE SIZE RES STATE TIME FLTS CPU COMMAND 15252 oracle 11 52 0 445M 364M sleep 9:07 57 16.43% oracle

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27042095/viewspace-742024/,如需轉載,請註明出處,否則將追究法律責任。

相關文章