ITPub博客

首页 > 数据库 > Oracle > [20190522]rman备份问题.txt

[20190522]rman备份问题.txt

原创 Oracle 作者:lfree 时间:2019-05-22 09:45:40 0 删除 编辑

[20190522]rman备份问题.txt


--//链接http://www.itpub.net/thread-2116768-1-1.html,提到的一个问题,主要脚本里面出现2次database.

--//导致备份出现2次,1次备份到闪回区,导致闪回区空间不足的情况.


backup as compressed backupset incremental level= 1  skip inaccessible filesperset 5 Database format='/home/oracle/ora_bak/orcl_lev1_%U_%T'  tag='orcl_lev1_0520' database   

include current controlfile ; 

--//注意看可以发现出现2次database.我认为应该删除第2个database,zergduan指出


不对, 标准的Backup 语法是

Backup + Backup_Operand + Backup_Spec

format 子句属于 operand

database 属于 spec

所以应该是 backup format=xxx database, 这样才标准~

具体可以参考 rman 的官方文档 reference那本


--//我个人喜欢放在最后,例子:

http://blog.itpub.net/267265/viewspace-2089074/=>[20160427]rman tag format标识.txt


--//我还是测试看看:


1.环境:

SCOTT@book> @ 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


--//CONFIGURE CHANNEL DEVICE TYPE SBT_TAPE clear;

--//CONFIGURE DEFAULT DEVICE TYPE TO DISK;

--//CONFIGURE CHANNEL 1 DEVICE TYPE DISK clear;


2.测试:


RMAN> backup as compressed backupset datafile 9 tag='file 9' format '/home/oracle/backup/datafile9_%U' datafile 9 tag='filex 9' format '/home/oracle/backup/datafile9x_%U';


Starting backup at 2019-05-22 09:35:43

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 compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-22 09:35:44

channel ORA_DISK_1: finished piece 1 at 2019-05-22 09:35:45

piece handle=/home/oracle/backup/datafile9_2vu260jg_1_1 tag=FILE 9 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-22 09:35:45

channel ORA_DISK_1: finished piece 1 at 2019-05-22 09:35:46

piece handle=/home/oracle/backup/datafile9x_30u260jh_1_1 tag=FILEX 9 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 2019-05-22 09:35:46


$ ls -l /home/oracle/backup/datafile9*

-rw-r----- 1 oracle oinstall 3284992 2019-05-22 09:35:44 /home/oracle/backup/datafile9_2vu260jg_1_1

-rw-r----- 1 oracle oinstall 3284992 2019-05-22 09:35:46 /home/oracle/backup/datafile9x_30u260jh_1_1


--//感觉我写的是对的.修改如下:


RMAN> backup as compressed backupset datafile 9 tag='file 9' format '/home/oracle/backup/datafile9_%U' datafile 9 ;

Starting backup at 2019-05-22 09:41:25

using channel ORA_DISK_1

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-22 09:41:25

channel ORA_DISK_1: finished piece 1 at 2019-05-22 09:41:26

piece handle=/home/oracle/backup/datafile9_31u260u5_1_1 tag=FILE 9 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-22 09:41:26

channel ORA_DISK_1: finished piece 1 at 2019-05-22 09:41:27

piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2019_05_22/o1_mf_nnndf_TAG20190522T094125_gg9b66j0_.bkp tag=TAG20190522T094125 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 2019-05-22 09:41:27


RMAN> backup as compressed backupset  tag='file 9' format '/home/oracle/backup/datafile9_%U' datafile 9 ;

Starting backup at 2019-05-22 09:42:51

using channel ORA_DISK_1

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00009 name=/mnt/ramdisk/book/T01.dbf

channel ORA_DISK_1: starting piece 1 at 2019-05-22 09:42:51

channel ORA_DISK_1: finished piece 1 at 2019-05-22 09:42:52

piece handle=/home/oracle/backup/datafile9_33u2610r_1_1 tag=FILE 9 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 2019-05-22 09:42:52


--//感觉前面没有什么区别,这样看来前后没有什么区别,只不过oracle自动"分组".


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2645146/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2435
  • 访问量
    6216315