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

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3980|回复: 0
打印 上一主题 下一主题

[Oracle] 使用rman进行压缩备份数据库

[复制链接]
跳转到指定楼层
楼主
发表于 2018-1-16 17:41:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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倍


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


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-28 12:44 , Processed in 0.093780 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表