11g 資料庫rman壓縮備份壓縮率測試

YallonKing發表於2012-09-13
/* 11g 資料庫rman壓縮備份壓縮率測試*/
此測試不從時間維度比較,只從儲存空間維度進行簡要比較。
--作業系統環境
[oracle@11grac1 ~]$ uname -a
Linux 11grac1 2.6.32-300.10.1.el5uek #1 SMP Wed Feb 22 17:22:40 EST 2012 i686 i686 i386 GNU/Linux
--資料庫環境
SQL> set pagesize 200
SQL> col BANNER for a60
SQL> select * from gv$version where rownum<11;

   INST_ID BANNER
---------- ------------------------------------------------------------
         1 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
           Production

         1 PL/SQL Release 11.2.0.1.0 - Production
         1 CORE 11.2.0.1.0      Production
         1 TNS for Linux: Version 11.2.0.1.0 - Production
         1 NLSRTL Version 11.2.0.1.0 - Production
         2 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
           Production

         2 PL/SQL Release 11.2.0.1.0 - Production
         2 CORE 11.2.0.1.0      Production
         2 TNS for Linux: Version 11.2.0.1.0 - Production
         2 NLSRTL Version 11.2.0.1.0 - Production


--資料庫歸檔情況
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     2
Next log sequence to archive   3
Current log sequence           3
SQL> show parameter cluster_database;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cluster_database                     boolean     TRUE
cluster_database_instances           integer     2

--資料庫當前大小
SQL> select sum(bytes)/1024/1024 m from dba_data_files;

         M
----------
      1195


--rman引數配置
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name RACDB are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_racdb1.f'; # default



--執行壓縮備份指令碼(只備份資料庫)

RMAN> run {
2> allocate channel c1 type disk maxpiecesize=512m;
3> allocate channel c2 type disk maxpiecesize=512m;
4> backup as compressed backupset database format '/u01/app/backup/db_full_%U_%p_%T_%s.bak' tag 'dbl0';
5> backup current controlfile format '/u01/app/backup/contorlfile_%T_%U_%s.ctlbak';
release channel c1;
6> 7> release channel c2;
8> }

released channel: ORA_DISK_1
released channel: ORA_DISK_2
allocated channel: c1
channel c1: SID=32 instance=racdb1 device type=DISK

allocated channel: c2
channel c2: SID=57 instance=racdb1 device type=DISK

Starting backup at 13-SEP-12
channel c1: starting compressed full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/racdb/system01.dbf
input datafile file number=00004 name=+DATA/racdb/users01.dbf
channel c1: starting piece 1 at 13-SEP-12
channel c2: starting compressed full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=+DATA/racdb/sysaux01.dbf
input datafile file number=00003 name=+DATA/racdb/undotbs01.dbf
input datafile file number=00005 name=+DATA/racdb/undotbs02.dbf
channel c2: starting piece 1 at 13-SEP-12
channel c2: finished piece 1 at 13-SEP-12
piece handle=/u01/app/backup/db_full_08nl4lf6_1_1_1_20120913_8.bak tag=DBL0 comment=NONE
channel c2: backup set complete, elapsed time: 00:03:26
channel c1: finished piece 1 at 13-SEP-12
piece handle=/u01/app/backup/db_full_07nl4lf6_1_1_1_20120913_7.bak tag=DBL0 comment=NONE
channel c1: backup set complete, elapsed time: 00:04:27
Finished backup at 13-SEP-12

Starting backup at 13-SEP-12
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 13-SEP-12
channel c1: finished piece 1 at 13-SEP-12
piece handle=/u01/app/backup/contorlfile_20120913_09nl4lnq_1_1_9.ctlbak tag=TAG20120913T224930 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:03
Finished backup at 13-SEP-12

Starting Control File and SPFILE Autobackup at 13-SEP-12
piece handle=+DATA/racdb/autobackup/2012_09_13/s_793925381.271.793925387 comment=NONE
Finished Control File and SPFILE Autobackup at 13-SEP-12

released channel: c1

released channel: c2

--檢視備份大小
[oracle@11grac1 backup]$ pwd
/u01/app/backup
[oracle@11grac1 backup]$ ls
contorlfile_20120913_09nl4lnq_1_1_9.ctlbak  db_full_08nl4lf6_1_1_1_20120913_8.bak
db_full_07nl4lf6_1_1_1_20120913_7.bak
[oracle@11grac1 backup]$ du -sh
269M    .

--執行非壓縮備份指令碼(只備份資料庫)

RMAN> run {
2> allocate channel c1 type disk maxpiecesize=512m;
3> allocate channel c2 type disk maxpiecesize=512m;
4> backup as backupset database format '/u01/app/backup/db_full_%U_%p_%T_%s.bak' tag 'dbl0';
5> backup current controlfile format '/u01/app/backup/contorlfile_%T_%U_%s.ctlbak';
6> release channel c1;
7> release channel c2;
}8>

released channel: ORA_DISK_1
released channel: ORA_DISK_2
allocated channel: c1
channel c1: SID=32 instance=racdb1 device type=DISK

allocated channel: c2
channel c2: SID=57 instance=racdb1 device type=DISK

Starting backup at 13-SEP-12
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/racdb/system01.dbf
input datafile file number=00004 name=+DATA/racdb/users01.dbf
channel c1: starting piece 1 at 13-SEP-12
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=+DATA/racdb/sysaux01.dbf
input datafile file number=00003 name=+DATA/racdb/undotbs01.dbf
input datafile file number=00005 name=+DATA/racdb/undotbs02.dbf
channel c2: starting piece 1 at 13-SEP-12
channel c1: finished piece 1 at 13-SEP-12
piece handle=/u01/app/backup/db_full_0bnl4lsf_1_1_1_20120913_11.bak tag=DBL0 comment=NONE
channel c1: starting piece 2 at 13-SEP-12
channel c1: finished piece 2 at 13-SEP-12
piece handle=/u01/app/backup/db_full_0bnl4lsf_2_1_2_20120913_11.bak tag=DBL0 comment=NONE
channel c1: backup set complete, elapsed time: 00:02:42
channel c2: finished piece 1 at 13-SEP-12
piece handle=/u01/app/backup/db_full_0cnl4lsg_1_1_1_20120913_12.bak tag=DBL0 comment=NONE
channel c2: backup set complete, elapsed time: 00:02:51
Finished backup at 13-SEP-12

Starting backup at 13-SEP-12
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 13-SEP-12
channel c1: finished piece 1 at 13-SEP-12
piece handle=/u01/app/backup/contorlfile_20120913_0dnl4m21_1_1_13.ctlbak tag=TAG20120913T225456 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:03
Finished backup at 13-SEP-12

Starting Control File and SPFILE Autobackup at 13-SEP-12
piece handle=+DATA/racdb/autobackup/2012_09_13/s_793925708.270.793925713 comment=NONE
Finished Control File and SPFILE Autobackup at 13-SEP-12

released channel: c1

released channel: c2


--檢視備份大小
[oracle@11grac1 backup]$ rm -rf *
[oracle@11grac1 backup]$ du -sh
969M    .

--11g壓縮備份效率比較
是否壓縮備份        壓縮備份(單位M)        非壓縮備份(單位M)            比率
庫大小                    1195                                  1195                                         1
備份檔案大小        269                                    969                                           3.6
比率                        0.23                                   0.81                                          3.52

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

相關文章