[20171031]rman备份压缩模式.txt

[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

上一篇:【下一代核心技术DevOps】:(一)容器服务的Rancher选型


下一篇:【下一代核心技术DevOps】:(五)微服务CI与Rancher持续集成