RMAN备份时报“ORA-19504: failed to create file”和“ORA-27038: created file already exists”的一种情况和解决办法

当尝试使用RMAN备份Oracle数据库时,遇到'ORA-19504: failed to create file'和'ORA-27038: created file already exists'错误。原因在于控制文件和参数文件不能与数据文件共享同一个备份集,且备份文件名需唯一。解决方案是通过在`format`中添加`%U`,确保每次创建的备份文件名不同。经过测试,成功备份了数据库、当前控制文件和归档日志。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

版本:

SQL> select * from v$version;


BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production


SQL> 


在RMAN中使用如下两条命令备份时,

backup database include current controlfile format '/u01/rmanbkp/full01' tag 'fullbk01';

backup database format '/u01/rmanbkp/full01' tag 'fullbk01';

均会出现如下错误:

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/02/2013 19:16:44
ORA-19504: failed to create file "/u01/rmanbkp/full01"
ORA-27038: created file already exists
Additional information: 1


原因是控制文件和参数文件需要单独生成一个备份集,不能和数据库共用一个备份集,而在给数据文件指定备份集时又只指定一个单一的文件名,所以报了个文件已经存在的错误,解决方法是在format里加一个%U,这样就会自动生成不同又唯一的文件名了。


控制文件之所以不能和数据文件共存于一个备份集是因为二者的block size不一样,参看ref2有一段话。

Note:
If the control file block size is not equal to the block size for data file 1, then the control file cannot be written into the same backup set as the data file. RMAN writes the control file into a backup set by itself if the block size is different. The V$CONTROLFILE.BLOCK_SIZE column indicates the control file block size, whereas the DB_BLOCK_SIZE initialization parameter indicates the block size of data file 1.


SQL> select name,block_size from v$controlfile;


NAME     BLOCK_SIZE
------------------------------------------------------------ ----------
/u01/oracle/oradata/ora11g/control01.ctl  16384
/u01/oracle/flash_recovery_area/ora11g/control02.ctl  16384


SQL> show parameter db_block_size


NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
db_block_size     integer 8192
SQL> 


测试:

RMAN> backup database include current controlfile format '/u01/rmanbkp/full01' tag 'fullbk01' plus archivelog format '/u01/rmanbkp/arch01' tag 'fullbk01';




Starting backup at 02-JUN-13
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=44 RECID=1 STAMP=817054481
input archived log thread=1 sequence=45 RECID=2 STAMP=817054522
input archived log thread=1 sequence=46 RECID=3 STAMP=817054526
input archived log thread=1 sequence=47 RECID=4 STAMP=817054712
input

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值