[20171031]rman備份壓縮模式.txt

lfree發表於2017-10-31

[20171031]rman備份壓縮模式.txt

--//測試rman備份壓縮模式,那種效果好,我記憶裡選擇medium在備份時間和備份檔案大小綜合考慮最佳.
--//還是透過指令碼測試:

1.環境:
SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.測試指令碼.
--//test_comp.sh
#! /bin/bash
T1=$(date +%s)
rman target / << EOF
CONFIGURE COMPRESSION ALGORITHM '$1';
backup as compressed backupset database format '/home/oracle/backup/$1_%U';
EOF
T2=$(date +%s)
DELTA=$(( $T2 – $T1 ))
echo "RMAN Backup Duration Time:" $DELTA

--//test_nocomp.sh
#! /bin/bash
T1=$(date +%s)
rman target / << EOF
backup as backupset database format '/home/oracle/backup/$1_%U';
EOF
T2=$(date +%s)
DELTA=$(( $T2 - $T1 ))
echo "RMAN Backup Duration Time:" $DELTA
--//注:這個測試沒有做.

3.執行過程略.

RMAN> show  COMPRESSION ALGORITHM ;
RMAN configuration parameters for database with db_unique_name BOOK are:
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
--//這個是預設設定.

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored

--//執行的引數如下:BASIC  LOW   MEDIUM HIGH 
./test_comp.sh BASIC  -> RMAN Backup Duration Time: 48
./test_comp.sh LOW    -> RMAN Backup Duration Time: 10
./test_comp.sh MEDIUM -> RMAN Backup Duration Time: 28
./test_comp.sh HIGH   -> RMAN Backup Duration Time: 149

$ ls -l /home/oracle/backup/*_1_1  */
-rw-r----- 1 oracle oinstall 339460096 2017-10-31 16:12:54 /home/oracle/backup/BASIC_gpsidear_1_1
-rw-r----- 1 oracle oinstall 278052864 2017-10-31 16:19:15 /home/oracle/backup/HIGH_gvsidejp_1_1
-rw-r----- 1 oracle oinstall 438411264 2017-10-31 16:15:17 /home/oracle/backup/LOW_grsidegf_1_1
-rw-r----- 1 oracle oinstall 361406464 2017-10-31 16:16:16 /home/oracle/backup/MEDIUM_gtsidehu_1_1

--//畫一個表格:
壓縮模式  執行時間 備份大小
BASIC     48       339460096
LOW       10       438411264
MEDIUM    28       361406464
HIGH      149      278052864

--//其中細節自己體會吧.另外注意實際上也跟資料庫的儲存的內容來決定的,比如你儲存大量jpg圖片,這些圖片已經壓縮,
--//我估計basic最佳.

--//連結dbspecialists.com/rman-compression-algorithms-in-11gr2/

As of version 11.2.0.2, there are 4 compression algorithms available: BASIC, LOW, MEDIUM and HIGH.  The 11g Backup &
Recovery Guide describes these options as follows:

    BASIC – default compression algorithm
    HIGH – Best suited for backups over slower networks where the limiting factor is network speed
    MEDIUM -Recommended for most environments. Good combination of compression ratios and speed
    LOW – Least impact on backup throughput and suited for environments where CPU resources are the limiting factor.

Unfortunately, unless you have purchased the Advanced Compression Option, your only choice is BASIC.  Regardless, I did
some testing to see the difference in compression ratio as well as the time it takes to backup.  The test script that I
used is pretty simple.  It specifies the compression algorithm and then does a full backup of the database and
archivelogs.  As a final test, I did a non-compressed rman backup and then used gzip to compress it.  While I wouldn't
recommend you do backups in this way, I think it is interesting for comparison purposes.


4.還原:
RMAN> CONFIGURE COMPRESSION ALGORITHM clear ;
old RMAN configuration parameters:
CONFIGURE COMPRESSION ALGORITHM 'HIGH' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;
RMAN configuration parameters are successfully reset to default value

RMAN> show COMPRESSION ALGORITHM;
RMAN configuration parameters for database with db_unique_name BOOK are:
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

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

相關文章