[20171031]rman merge例子2.txt

[20171031]rman merge例子2.txt

--//以前做的测试 [20170626]rman merge例子.txt
--//链接 http://blog.itpub.net/267265/viewspace-2141253/

--//不断应用日志,常用的方式如下:
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

RUN
{
backup incremental level 1 for recover of copy with tag 'incr_update' database ;
recover copy of database with tag 'incr_update' ;
}

--//但这样数据文件建立在闪回区,采用OMF格式.而如果采用如下方式执行:

RUN
{
backup incremental level 1 for recover of copy with tag 'incr_update' database format '/home/oracle/backup/%b';
recover copy of database with tag 'incr_update' ;
}

--//可以发现这样不行.指定format无效.虽然以上脚本一直可以应用,主要是文件名采用OMF格式.数据文件放在闪回区.
--//实际上主要问题这样的方式不支持%b的格式,因为这样实际上level 0不存在,第一次实际实际上做level 0 as copy备份.

--//如果写成 backup incremental level 0 for recover of copy with tag 'incr_update' database format '/home/oracle/backup/%b';
--//会出现如下提示:

RMAN> backup incremental level 0 for recover of copy with tag 'incr_update' database format '/home/oracle/backup/%b';

Starting backup at 2017-10-31 09:42:14
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 10/31/2017 09:42:14
RMAN-06578: INCREMENTAL LEVEL > 0 must be specified with FOR RECOVER OF

--//我前面采用如下方式,先备份成datafilecopy文件.然后注册为增量备份.就ok了,看下面的测试.

RMAN> backup as copy  database format '/home/oracle/backup/%b' tag 'incr_update';

RMAN> catalog datafilecopy '/home/oracle/backup/system01.dbf' level 0 ;
cataloged datafile copy
datafile copy file name=/home/oracle/backup/system01.dbf RECID=43 STAMP=947675261

catalog datafilecopy '/home/oracle/backup/sysaux01.dbf' level 0 ;
catalog datafilecopy '/home/oracle/backup/example01.dbf' level 0 ;
catalog datafilecopy '/home/oracle/backup/undotbs01.dbf' level 0 ;
catalog datafilecopy '/home/oracle/backup/users01.dbf' level 0 ;
catalog datafilecopy '/home/oracle/backup/tea01.dbf' level 0 ;

--//实际上建立datacopyfile可以一步搞定.执行如下:(注:12c 使用PDB可能存在问题!!)
RMAN> backup as copy  incremental level 0 database format '/home/oracle/backup/%b' tag 'incr_update';
Starting backup at 2017-10-31 09:45:58
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=224 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=237 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=248 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/mnt/ramdisk/book/sysaux01.dbf
channel ORA_DISK_2: starting datafile copy
input datafile file number=00003 name=/mnt/ramdisk/book/undotbs01.dbf
channel ORA_DISK_3: starting datafile copy
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
output file name=/home/oracle/backup/sysaux01.dbf tag=INCR_UPDATE RECID=15 STAMP=958815971
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/mnt/ramdisk/book/example01.dbf
output file name=/home/oracle/backup/undotbs01.dbf tag=INCR_UPDATE RECID=14 STAMP=958815971
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_2: starting datafile copy
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
output file name=/home/oracle/backup/system01.dbf tag=INCR_UPDATE RECID=13 STAMP=958815971
channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_3: starting datafile copy
input datafile file number=00006 name=/mnt/ramdisk/book/tea01.dbf
output file name=/home/oracle/backup/example01.dbf tag=INCR_UPDATE RECID=18 STAMP=958815976
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
output file name=/home/oracle/backup/users01.dbf tag=INCR_UPDATE RECID=17 STAMP=958815975
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:01
output file name=/home/oracle/backup/tea01.dbf tag=INCR_UPDATE RECID=16 STAMP=958815975
channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2017-10-31 09:46:16
Starting Control File and SPFILE Autobackup at 2017-10-31 09:46:16
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2017_10_31/o1_mf_s_958815976_dzhoh8nx_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2017-10-31 09:46:17

$ ls -l /home/oracle/backup/*.dbf */
-rw-r----- 1 oracle oinstall 363077632 2017-10-31 09:46:16 /home/oracle/backup/example01.dbf
-rw-r----- 1 oracle oinstall 985669632 2017-10-31 09:46:03 /home/oracle/backup/sysaux01.dbf
-rw-r----- 1 oracle oinstall 796925952 2017-10-31 09:46:03 /home/oracle/backup/system01.dbf
-rw-r----- 1 oracle oinstall  41951232 2017-10-31 09:46:15 /home/oracle/backup/tea01.dbf
-rw-r----- 1 oracle oinstall 907026432 2017-10-31 09:46:03 /home/oracle/backup/undotbs01.dbf
-rw-r----- 1 oracle oinstall 134225920 2017-10-31 09:46:15 /home/oracle/backup/users01.dbf

--//这样就建立datacopy的level=0备份.再执行如下就没有任何问题.

RUN
{
backup incremental level 1 for recover of copy with tag 'incr_update' database ;
recover copy of database with tag 'incr_update' ;
}

Starting backup at 2017-10-31 09:55:50
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/mnt/ramdisk/book/sysaux01.dbf
input datafile file number=00005 name=/mnt/ramdisk/book/example01.dbf
channel ORA_DISK_1: starting piece 1 at 2017-10-31 09:55:50
channel ORA_DISK_2: starting incremental level 1 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00003 name=/mnt/ramdisk/book/undotbs01.dbf
input datafile file number=00006 name=/mnt/ramdisk/book/tea01.dbf
channel ORA_DISK_2: starting piece 1 at 2017-10-31 09:55:50
channel ORA_DISK_3: starting incremental level 1 datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
channel ORA_DISK_3: starting piece 1 at 2017-10-31 09:55:50
channel ORA_DISK_1: finished piece 1 at 2017-10-31 09:55:51
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_10_31/o1_mf_nnnd1_INCR_UPDATE_dzhp16hk_.bkp tag=INCR_UPDATE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_2: finished piece 1 at 2017-10-31 09:55:51
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_10_31/o1_mf_nnnd1_INCR_UPDATE_dzhp16hp_.bkp tag=INCR_UPDATE comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_3: finished piece 1 at 2017-10-31 09:55:51
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_10_31/o1_mf_nnnd1_INCR_UPDATE_dzhp16hw_.bkp tag=INCR_UPDATE comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:01
Finished backup at 2017-10-31 09:55:51

Starting recover at 2017-10-31 09:55:51
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy file number=00001 name=/home/oracle/backup/system01.dbf
recovering datafile copy file number=00004 name=/home/oracle/backup/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_10_31/o1_mf_nnnd1_INCR_UPDATE_dzhp16hw_.bkp
channel ORA_DISK_2: starting incremental datafile backup set restore
channel ORA_DISK_2: specifying datafile copies to recover
recovering datafile copy file number=00003 name=/home/oracle/backup/undotbs01.dbf
recovering datafile copy file number=00006 name=/home/oracle/backup/tea01.dbf
channel ORA_DISK_2: reading from backup piece /u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_10_31/o1_mf_nnnd1_INCR_UPDATE_dzhp16hp_.bkp
channel ORA_DISK_3: starting incremental datafile backup set restore
channel ORA_DISK_3: specifying datafile copies to recover
recovering datafile copy file number=00002 name=/home/oracle/backup/sysaux01.dbf
recovering datafile copy file number=00005 name=/home/oracle/backup/example01.dbf
channel ORA_DISK_3: reading from backup piece /u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_10_31/o1_mf_nnnd1_INCR_UPDATE_dzhp16hk_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_10_31/o1_mf_nnnd1_INCR_UPDATE_dzhp16hw_.bkp tag=INCR_UPDATE
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:00
channel ORA_DISK_2: piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_10_31/o1_mf_nnnd1_INCR_UPDATE_dzhp16hp_.bkp tag=INCR_UPDATE
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:01
channel ORA_DISK_3: piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_10_31/o1_mf_nnnd1_INCR_UPDATE_dzhp16hk_.bkp tag=INCR_UPDATE
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:01
Finished recover at 2017-10-31 09:55:52

Starting Control File and SPFILE Autobackup at 2017-10-31 09:55:52
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2017_10_31/o1_mf_s_958816552_dzhp1827_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2017-10-31 09:55:53

--//这样也是可以,使用format参数.
RMAN> backup incremental level 1 for recover of copy with tag 'incr_update' database format '/home/oracle/backup/inc_%U';
RMAN> recover copy of database with tag 'incr_update' ;

--//总结:
--//写这么多实际上就是说明.建立datacopy的level=0备份,可以执行如下:
backup as copy  incremental level 0 database format '/home/oracle/backup/%b' tag 'incr_update';

时间: 2024-10-23 08:52:38

[20171031]rman merge例子2.txt的相关文章

[20170626]rman merge例子.txt

[20170626]rman merge例子.txt 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- -------------------------------------------------------------------------------- x86_64/Linux

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

[20171031]rman备份压缩模式.txt --//测试rman备份压缩模式,那种效果好,我记忆里选择medium在备份时间和备份文件大小综合考虑最佳. --//还是通过脚本测试: 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ---------------------------

[20171031]rman xxx Failure.txt

[20171031]rman xxx Failure.txt --//简单测试 List Failure, Advise Failure and Repair Failure命令在11g下,也许以后工作需要. --//虽然我自己很少使用这个命令,感觉这个有点傻瓜化. 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ ----

[20171130]关于rman的一些总结.txt

[20171130]关于rman的一些总结.txt --//最近一直做rman相关测试,测试那个乱,没办法.无法从周围的人获得帮助,纯粹是自己的乱猜,乱测,不知道别人是否能看懂我写的东西. --//有必要做一些总结,不一定对,仅仅是我当前的看法. 1.数据文件备份集中,文件头是最后写到备份集文件的. 2.使用备份集恢复也是一样,文件头也是最好写入的. 3.以上情况对as copy的方式也是一样. --//oracle这样操作主要目的保证备份是好的可用,反之恢复也是一样. 4.关于备份参数file

[20160427]rman tag format标识.txt

[20160427]rman tag format标识.txt --昨天别人问一个关于rman很奇怪的问题,就是能否实现给全备以及archive加不同的tag. --当然最简单的方法就是分开执行,这样就没有问题. --我们生产系统就是分开写的,例子: backup as compressed backupset full database filesperset=1     tag="full $current"     include current controlfile    

[20171121]rman backup as copy.txt

[20171121]rman backup as copy.txt --//上个星期做数据文件块头恢复时,提到使用rman备份数据文件时,文件头数据库信息是最后写入备份集文件的,在filesperset=1的情况 --//下写入备份集文件中的倒数第2块就是文件头的备份.参考链接: http://blog.itpub.net/267265/viewspace-2147297/=>[20171115]恢复数据文件块头4补充.txt --//而且我最后还做了测试证明如果resotre数据文件,实际上文

[20171204]关于rman备份疑问4.txt

[20171204]关于rman备份疑问4.txt --//上午排除我几天在做rman测试的疑问. --//链接如下:http://blog.itpub.net/267265/viewspace-2148029/ --//顺便测试备份集包含5个数据文件的情况(本来不想做,还是做看看),验证自己的判断是否正确. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER -----------

[20171205]bash for例子错误.txt

[20171205]bash for例子错误.txt --//今天写bash for循环,遇到问题.通过例子说明: $ cat tt1.sh #! /bin/bash for i in { 1 .. 5 } do   echo $i done --//本想输出1,2,3,4,5的.而实际上执行输出是: $ . tt1.sh { 1 .. 5 } --//使用这样的方式{ 1 .. 5 }之间不能有任何空格.正确的写法如下: $ cat tt1.sh #! /bin/bash for i in {

[20161114]rman备份的疑问.txt

[20161114]rman备份的疑问.txt --这个是我前几天做测试时遇到的疑问,不知道为什么rman 备份要修改数据块的dba地址. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ---------------------------------------------------