您好,登錄后才能下訂單哦!
我們上一講講到了RMAN能提供全庫(kù)備份、表空間備份、數(shù)據(jù)文件備份、歸檔日志備份、控制文件及參數(shù)文件的備份。RMAN備份出來(lái)的文件稱之為備份集,RMAN在備份的過(guò)程中,只備份已經(jīng)使用過(guò)的數(shù)據(jù)塊。RMAN將多個(gè)數(shù)據(jù)文件打包到一起,生成一個(gè)備份集。數(shù)據(jù)文件與備份集文件不再是一一對(duì)應(yīng)的關(guān)系。關(guān)于備份集的概念,我們下一講再詳細(xì)介紹。本將我們說(shuō)說(shuō)RMAN的另一種備份方式--鏡像copy。
鏡像copy是單個(gè)數(shù)據(jù)文件、控制文件、歸檔日志的克隆。備份出來(lái)的備份文件與數(shù)據(jù)庫(kù)文件一一對(duì)應(yīng)。下圖描述了備份集與鏡像copy之間的區(qū)別
鏡像copy可以使用RMAN的backup as copy命令生成,也可以使用操作系統(tǒng)命令生成。
使用backup as copy命令備份時(shí),Oracle服務(wù)器會(huì)話驗(yàn)證數(shù)據(jù)文件中的數(shù)據(jù)塊,并且會(huì)將此次備份操作記錄到控制文件中。我們知道,如果使用操作系統(tǒng)命令進(jìn)行熱備,首先要在數(shù)據(jù)庫(kù)中執(zhí)行begin backup命令,執(zhí)行該命令后,數(shù)據(jù)文件的頭部將被冷凍,在備份期間,為了保證數(shù)據(jù)塊的有效性,一旦數(shù)據(jù)塊被修改,那么日志文件將記錄下該數(shù)據(jù)塊的原始鏡像。如果使用RMAN的backup as copy命令進(jìn)行備份,則無(wú)需執(zhí)行begin backup。 因?yàn)閞man在備份的過(guò)程中會(huì)檢查數(shù)據(jù)塊的一致性,直到數(shù)據(jù)塊一致了,才將其copy到備份文件中。
鏡像copy有如下特征:
鏡像copy只能寫到磁盤上,當(dāng)備份大文件時(shí),將花費(fèi)很長(zhǎng)時(shí)間。但是數(shù)據(jù)還原的時(shí)間將大大減少。因?yàn)閿?shù)據(jù)文件已經(jīng)在磁盤上,無(wú)需從其他介質(zhì)中還原數(shù)據(jù)文件。
鏡像copy中包含數(shù)據(jù)文件中的所有的塊,無(wú)論該塊是否被使用。
執(zhí)行鏡像copy
備份數(shù)據(jù)庫(kù)
RMAN> backup as copy database; Starting backup at 2015/07/08 11:53:55 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=39 device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf output file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_system_bss7pnh3_.dbf tag=TAG20150708T115355 RECID=9 STAMP=884519670 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35 channel ORA_DISK_1: starting datafile copy input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf output file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_sysaux_bss7qqqg_.dbf tag=TAG20150708T115355 RECID=10 STAMP=884519692 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25 channel ORA_DISK_1: starting datafile copy input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf output file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_example_bss7rk3f_.dbf tag=TAG20150708T115355 RECID=11 STAMP=884519708 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf output file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_undotbs1_bss7s07q_.dbf tag=TAG20150708T115355 RECID=12 STAMP=884519715 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile copy input datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbf output file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_idx_bss7s7gp_.dbf tag=TAG20150708T115355 RECID=13 STAMP=884519720 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting datafile copy input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf output file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_users_bss7s8mb_.dbf tag=TAG20150708T115355 RECID=14 STAMP=884519720 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 2015/07/08 11:55:21 Starting Control File and SPFILE Autobackup at 2015/07/08 11:55:21 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884519721_bss7sbdk_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 2015/07/08 11:55:22
備份了數(shù)據(jù)庫(kù)中所有的數(shù)據(jù)文件(包括undo,其實(shí)undo也是數(shù)據(jù)文件)。但是backup database as copy時(shí),并不會(huì)備份控制文件和spfile。最后一段備份控制文件與參數(shù)文件是因?yàn)槲覀兣渲昧丝刂莆募詣?dòng)備份功能。
備份表空間
RMAN> backup as copy tablespace EXAMPLE; Starting backup at 2015/07/08 12:26:58 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=1 device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf output file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_example_bss9nmnv_.dbf tag=TAG20150708T122659 RECID=15 STAMP=884521632 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 Finished backup at 2015/07/08 12:27:14 Starting Control File and SPFILE Autobackup at 2015/07/08 12:27:14 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884521634_bss9o37t_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 2015/07/08 12:27:15
備份數(shù)據(jù)文件
RMAN> backup as copy datafile '/u01/app/oracle/oradata/devdb/example01.dbf'; Starting backup at 2015/07/08 12:28:59 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf output file name=/u01/app/oracle/fast_recovery_area/DEVDB/datafile/o1_mf_example_bss9rcv9_.dbf tag=TAG20150708T122859 RECID=16 STAMP=884521750 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 Finished backup at 2015/07/08 12:29:14 Starting Control File and SPFILE Autobackup at 2015/07/08 12:29:15 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884521755_bss9rv8v_.bkp comment=NONE Finished 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:34 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy copying current control file output file name=/u01/app/oracle/fast_recovery_area/DEVDB/controlfile/o1_mf_TAG20150708T123334_bssb0yj4_.ctl tag=TAG20150708T123334 RECID=17 STAMP=884522014 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 2015/07/08 12:33:35 Starting Control File and SPFILE Autobackup at 2015/07/08 12:33:35 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884522015_bssb0zrf_.bkp comment=NONE Finished 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:54 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log copy input archived log thread=1 sequence=16 RECID=7 STAMP=884486041 output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_16_bssb3h9w_.arc RECID=15 STAMP=884522095 channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log copy input archived log thread=1 sequence=17 RECID=8 STAMP=884486144 output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_17_bssb3jdy_.arc RECID=16 STAMP=884522096 channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log copy input archived log thread=1 sequence=18 RECID=9 STAMP=884486148 output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_18_bssb3khz_.arc RECID=17 STAMP=884522097 channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log copy input archived log thread=1 sequence=19 RECID=10 STAMP=884486151 output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_19_bssb3ll4_.arc RECID=18 STAMP=884522098 channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log copy input archived log thread=1 sequence=20 RECID=11 STAMP=884486169 output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_20_bssb3mnx_.arc RECID=19 STAMP=884522099 channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log copy input archived log thread=1 sequence=21 RECID=12 STAMP=884486468 output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_21_bssb3nqm_.arc RECID=20 STAMP=884522100 channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log copy input archived log thread=1 sequence=22 RECID=13 STAMP=884486525 output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_22_bssb3otp_.arc RECID=21 STAMP=884522101 channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log copy input archived log thread=1 sequence=23 RECID=14 STAMP=884522094 output file name=/u01/app/oracle/fast_recovery_area/DEVDB/archivelog/2015_07_08/o1_mf_1_23_bssb3py8_.arc RECID=22 STAMP=884522103 channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01 Finished backup at 2015/07/08 12:35:03 Starting Control File and SPFILE Autobackup at 2015/07/08 12:35:04 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/autobackup/2015_07_08/o1_mf_s_884522104_bssb3r69_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 2015/07/08 12:35:05
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。