千家信息网

Oracle 学习之RMAN(五)镜像copy

发表于:2025-01-25 作者:千家信息网编辑
千家信息网最后更新 2025年01月25日,我们上一讲讲到了RMAN能提供全库备份、表空间备份、数据文件备份、归档日志备份、控制文件及参数文件的备份。RMAN备份出来的文件称之为备份集,RMAN在备份的过程中,只备份已经使用过的数据块。RMAN
千家信息网最后更新 2025年01月25日Oracle 学习之RMAN(五)镜像copy

我们上一讲讲到了RMAN能提供全库备份、表空间备份、数据文件备份、归档日志备份、控制文件及参数文件的备份。RMAN备份出来的文件称之为备份集,RMAN在备份的过程中,只备份已经使用过的数据块。RMAN将多个数据文件打包到一起,生成一个备份集。数据文件与备份集文件不再是一一对应的关系。关于备份集的概念,我们下一讲再详细介绍。本将我们说说RMAN的另一种备份方式--镜像copy。

镜像copy是单个数据文件、控制文件、归档日志的克隆。备份出来的备份文件与数据库文件一一对应。下图描述了备份集与镜像copy之间的区别

镜像copy可以使用RMAN的backup as copy命令生成,也可以使用操作系统命令生成。

使用backup as copy命令备份时,Oracle服务器会话验证数据文件中的数据块,并且会将此次备份操作记录到控制文件中。我们知道,如果使用操作系统命令进行热备,首先要在数据库中执行begin backup命令,执行该命令后,数据文件的头部将被冷冻,在备份期间,为了保证数据块的有效性,一旦数据块被修改,那么日志文件将记录下该数据块的原始镜像。如果使用RMAN的backup as copy命令进行备份,则无需执行begin backup。 因为rman在备份的过程中会检查数据块的一致性,直到数据块一致了,才将其copy到备份文件中。

镜像copy有如下特征:

  • 镜像copy只能写到磁盘上,当备份大文件时,将花费很长时间。但是数据还原的时间将大大减少。因为数据文件已经在磁盘上,无需从其他介质中还原数据文件。

  • 镜像copy中包含数据文件中的所有的块,无论该块是否被使用。


执行镜像copy

  • 备份数据库

RMAN> backup as copy database;Starting backup at 2015/07/08 11:53:55using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=39 device type=DISKchannel ORA_DISK_1: starting datafile copyinput datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbfoutput file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_system_bss7pnh3_.dbf tag=TAG20150708T115355 RECID=9 STAMP=884519670channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35channel ORA_DISK_1: starting datafile copyinput datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbfoutput file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_sysaux_bss7qqqg_.dbf tag=TAG20150708T115355 RECID=10 STAMP=884519692channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25channel ORA_DISK_1: starting datafile copyinput datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbfoutput file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_example_bss7rk3f_.dbf tag=TAG20150708T115355 RECID=11 STAMP=884519708channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15channel ORA_DISK_1: starting datafile copyinput datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbfoutput file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_undotbs1_bss7s07q_.dbf tag=TAG20150708T115355 RECID=12 STAMP=884519715channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07channel ORA_DISK_1: starting datafile copyinput datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbfoutput file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_idx_bss7s7gp_.dbf tag=TAG20150708T115355 RECID=13 STAMP=884519720channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01channel ORA_DISK_1: starting datafile copyinput datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbfoutput file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_users_bss7s8mb_.dbf tag=TAG20150708T115355 RECID=14 STAMP=884519720channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01Finished backup at 2015/07/08 11:55:21Starting Control File and SPFILE Autobackup at 2015/07/08 11:55:21piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884519721_bss7sbdk_.bkp comment=NONEFinished Control File and SPFILE Autobackup at 2015/07/08 11:55:22

备份了数据库中所有的数据文件(包括undo,其实undo也是数据文件)。但是backup database as copy时,并不会备份控制文件和spfile。最后一段备份控制文件与参数文件是因为我们配置了控制文件自动备份功能。

  • 备份表空间

RMAN> backup as copy tablespace EXAMPLE;Starting backup at 2015/07/08 12:26:58using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=1 device type=DISKchannel ORA_DISK_1: starting datafile copyinput datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbfoutput file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_example_bss9nmnv_.dbf tag=TAG20150708T122659 RECID=15 STAMP=884521632channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15Finished backup at 2015/07/08 12:27:14Starting Control File and SPFILE Autobackup at 2015/07/08 12:27:14piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884521634_bss9o37t_.bkp comment=NONEFinished Control File and SPFILE Autobackup at 2015/07/08 12:27:15
  • 备份数据文件

RMAN> backup as copy datafile '/u01/app/oracle/oradata/devdb/example01.dbf';Starting backup at 2015/07/08 12:28:59using channel ORA_DISK_1channel ORA_DISK_1: starting datafile copyinput datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbfoutput file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_example_bss9rcv9_.dbf tag=TAG20150708T122859 RECID=16 STAMP=884521750channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15Finished backup at 2015/07/08 12:29:14Starting Control File and SPFILE Autobackup at 2015/07/08 12:29:15piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884521755_bss9rv8v_.bkp comment=NONEFinished Control File and SPFILE Autobackup at 2015/07/08 12:29:16
  • 备份控制文件

RMAN> backup as copy current controlfile;Starting backup at 2015/07/08 12:33:34using channel ORA_DISK_1channel ORA_DISK_1: starting datafile copycopying current control fileoutput file name=/u01/app/oracle/fast_recovery_area/DEVDB/controlfile/o1_mf_TAG20150708T123334_bssb0yj4_.ctl tag=TAG20150708T123334 RECID=17 STAMP=884522014channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01Finished backup at 2015/07/08 12:33:35Starting Control File and SPFILE Autobackup at 2015/07/08 12:33:35piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884522015_bssb0zrf_.bkp comment=NONEFinished Control File and SPFILE Autobackup at 2015/07/08 12:33:36
  • 备份归档日志文件

RMAN> backup as copy archivelog all;Starting backup at 2015/07/08 12:34:54current log archivedusing channel ORA_DISK_1channel ORA_DISK_1: starting archived log copyinput archived log thread=1 sequence=16 RECID=7 STAMP=884486041output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_16_bssb3h9w_.arc RECID=15 STAMP=884522095channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01channel ORA_DISK_1: starting archived log copyinput archived log thread=1 sequence=17 RECID=8 STAMP=884486144output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_17_bssb3jdy_.arc RECID=16 STAMP=884522096channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01channel ORA_DISK_1: starting archived log copyinput archived log thread=1 sequence=18 RECID=9 STAMP=884486148output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_18_bssb3khz_.arc RECID=17 STAMP=884522097channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01channel ORA_DISK_1: starting archived log copyinput archived log thread=1 sequence=19 RECID=10 STAMP=884486151output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_19_bssb3ll4_.arc RECID=18 STAMP=884522098channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01channel ORA_DISK_1: starting archived log copyinput archived log thread=1 sequence=20 RECID=11 STAMP=884486169output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_20_bssb3mnx_.arc RECID=19 STAMP=884522099channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01channel ORA_DISK_1: starting archived log copyinput archived log thread=1 sequence=21 RECID=12 STAMP=884486468output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_21_bssb3nqm_.arc RECID=20 STAMP=884522100channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01channel ORA_DISK_1: starting archived log copyinput archived log thread=1 sequence=22 RECID=13 STAMP=884486525output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_22_bssb3otp_.arc RECID=21 STAMP=884522101channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01channel ORA_DISK_1: starting archived log copyinput archived log thread=1 sequence=23 RECID=14 STAMP=884522094output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_23_bssb3py8_.arc RECID=22 STAMP=884522103channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01Finished backup at 2015/07/08 12:35:03Starting Control File and SPFILE Autobackup at 2015/07/08 12:35:04piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884522104_bssb3r69_.bkp comment=NONEFinished Control File and SPFILE Autobackup at 2015/07/08 12:35:05


备份 文件 数据 镜像 命令 控制 数据库 日志 生成 一致 一一对应 操作系统 参数 磁盘 空间 系统 过程 原始 有效 一致性 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 帮我找到有关网络安全的手抄报 天猫魔盒服务器 html连接数据库代码写在哪里 濮阳软件开发专业熊掌网络 抖音上的mc服务器 sqldbx怎么批量导入数据库 福建省网络安全报告 长三角软件开发 网络技术大专毕业就业 北斗航天信息网络技术 剑网三指尖江湖服务器总掉线 陕西1u服务器机箱供应 大学生应聘软件开发 2020下半年网络安全事件 三级数据库有填空题吗 模拟连接网站获取数据库 食品科学期刊对应数据库 ecs服务器安全防护 贵州晴风网络技术服务有限公司 纺织业互联网科技 许昌软件开发费用是多少 盛世加倍网络技术有限公司 mysql数据库学习难不难 小规模软件开发企业分录 第四届网络安全知识竞赛论文 软件开发流程包括哪些阶段 线上教育服务器频繁崩溃 监控系统的软件开发成本 计算机四级软件开发报考哪个 本地请求服务器接口算跨域吗
0