重庆思庄Oracle、Redhat认证学习论坛

标题: 使用rman进行压缩备份数据库 [打印本页]

作者: jiawang    时间: 2018-1-16 17:41
标题: 使用rman进行压缩备份数据库
Oracle10g以后允许rman和BACKUP命令伴随使用AS COMPRESSED BACKUPSET字句,对备份集进行压缩。
这个压缩备份在恢复时无需解压缩,这一特性在以下条件下可能大为有益:
1.你的备份存储空间有限
2.通过网络备份而带宽有限
3.直接备份至磁带、CD,DVD介质而压缩不可用


非压缩备份全库:
[oracle@dbserver ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jan 16 11:31:24 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: SZTECH1 (DBID=3253410194)
RMAN> backup database;
Starting backup at 16-JAN-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=261 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/sztech1/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/sztech1/sysaux01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/sztech1/undo02.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/sztech1/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/sztech1/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/sztech1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 16-JAN-18
channel ORA_DISK_1: finished piece 1 at 16-JAN-18
piece handle=/u01/app/oracle/fast_recovery_area/SZTECH1/backupset/2018_01_16/o1_mf_nnndf_TAG20180116T113144_f5twk322_.bkp tag=TAG20180116T113144 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:55
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 16-JAN-18
channel ORA_DISK_1: finished piece 1 at 16-JAN-18
piece handle=/u01/app/oracle/fast_recovery_area/SZTECH1/backupset/2018_01_16/o1_mf_ncsnf_TAG20180116T113144_f5twnprw_.bkp tag=TAG20180116T113144 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-JAN-18
RMAN>
花费时间: 00:01:55+ 00:00:01=1分56秒=116S

压缩备份全库:
[oracle@dbserver ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jan 16 11:32:19 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: SZTECH1 (DBID=3253410194)
RMAN> backup as compressed backupset database;
Starting backup at 16-JAN-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=257 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/sztech1/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/sztech1/sysaux01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/sztech1/undo02.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/sztech1/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/sztech1/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/sztech1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 16-JAN-18
channel ORA_DISK_1: finished piece 1 at 16-JAN-18
piece handle=/u01/app/oracle/fast_recovery_area/SZTECH1/backupset/2018_01_16/o1_mf_nnndf_TAG20180116T113404_f5twofmm_.bkp tag=TAG20180116T113404 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:05:15
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 16-JAN-18
channel ORA_DISK_1: finished piece 1 at 16-JAN-18
piece handle=/u01/app/oracle/fast_recovery_area/SZTECH1/backupset/2018_01_16/o1_mf_ncsnf_TAG20180116T113404_f5twzb70_.bkp tag=TAG20180116T113404 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-JAN-18
RMAN>

消耗时间:00:05:15+00:00:01=5分16秒=316S

压缩比率:
[oracle@dbserver 2018_01_16]$ ll -h
total 1.5G
-rw-r-----. 1 oracle oinstall 9.4M Jan 16 11:33 o1_mf_ncsnf_TAG20180116T113144_f5twnprw_.bkp
-rw-r-----. 1 oracle oinstall 1.1M Jan 16 11:39 o1_mf_ncsnf_TAG20180116T113404_f5twzb70_.bkp
-rw-r-----. 1 oracle oinstall 1.2G Jan 16 11:33 o1_mf_nnndf_TAG20180116T113144_f5twk322_.bkp
-rw-r-----. 1 oracle oinstall 305M Jan 16 11:39 o1_mf_nnndf_TAG20180116T113404_f5twofmm_.bkp

非压缩备份大小:1200+9.4=1209.4M
压缩备份大小:305+1.1=306.1M
非压缩备份较压缩备份大小:1209.4M/306.1M =3.95倍


综述:使用压缩备份数据库占空间少,相对来说比较时间。







欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2