博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
RMAN备份时报“ORA-19504: failed to create file”和“ORA-27038: created file already exists”的一种情况和解决办法
阅读量:4177 次
发布时间:2019-05-26

本文共 14450 字,大约阅读时间需要 48 分钟。

版本:

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 archived log thread=1 sequence=48 RECID=5 STAMP=817061936
input archived log thread=1 sequence=49 RECID=6 STAMP=817065148
input archived log thread=1 sequence=50 RECID=7 STAMP=817065192
input archived log thread=1 sequence=51 RECID=8 STAMP=817066777
input archived log thread=1 sequence=52 RECID=9 STAMP=817066795
input archived log thread=1 sequence=53 RECID=10 STAMP=817066905
input archived log thread=1 sequence=54 RECID=11 STAMP=817066934
input archived log thread=1 sequence=55 RECID=12 STAMP=817067207
input archived log thread=1 sequence=56 RECID=13 STAMP=817067228
input archived log thread=1 sequence=57 RECID=14 STAMP=817067257
input archived log thread=1 sequence=58 RECID=15 STAMP=817067276
input archived log thread=1 sequence=59 RECID=16 STAMP=817067373
channel ORA_DISK_1: starting piece 1 at 02-JUN-13
channel ORA_DISK_1: finished piece 1 at 02-JUN-13
piece handle=/u01/rmanbkp/arch01 tag=FULLBK01 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-JUN-13
Starting backup at 02-JUN-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/oracle/oradata/ora11g/system01.dbf
input datafile file number=00002 name=/u01/oracle/oradata/ora11g/sysaux01.dbf
input datafile file number=00003 name=/u01/oracle/oradata/ora11g/undotbs01.dbf
input datafile file number=00005 name=/u01/oracle/oradata/ora11g/ts1.dbf
input datafile file number=00006 name=/u01/oracle/oradata/ora11g/ts2.dbf
input datafile file number=00007 name=/u01/oracle/oradata/ora11g/ts3.dbf
input datafile file number=00008 name=/u01/oracle/oradata/ora11g/ts4.dbf
input datafile file number=00004 name=/u01/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 02-JUN-13
channel ORA_DISK_1: finished piece 1 at 02-JUN-13
piece handle=/u01/rmanbkp/full01 tag=FULLBK01 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 02-JUN-13
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup plus archivelog command at 06/02/2013 19:09:52
ORA-19504: failed to create file "/u01/rmanbkp/full01"
ORA-27038: created file already exists
Additional information: 1
RMAN> list backup;
List of Backup Sets
===================
BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
25      24.60M     DISK        00:00:01     02-JUN-13      
        BP Key: 25   Status: AVAILABLE  Compressed: NO  Tag: FULLBK01
        Piece Name: /u01/rmanbkp/arch01
  List of Archived Logs in backup set 25
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    44      1628668    02-JUN-13 1637132    02-JUN-13
  1    45      1637132    02-JUN-13 1637150    02-JUN-13
  1    46      1637150    02-JUN-13 1637154    02-JUN-13
  1    47      1637154    02-JUN-13 1637223    02-JUN-13
  1    48      1637223    02-JUN-13 1641689    02-JUN-13
  1    49      1641689    02-JUN-13 1643658    02-JUN-13
  1    50      1643658    02-JUN-13 1643685    02-JUN-13
  1    51      1643685    02-JUN-13 1644335    02-JUN-13
  1    52      1644335    02-JUN-13 1644352    02-JUN-13
  1    53      1644352    02-JUN-13 1644493    02-JUN-13
  1    54      1644493    02-JUN-13 1644513    02-JUN-13
  1    55      1644513    02-JUN-13 1644664    02-JUN-13
  1    56      1644664    02-JUN-13 1644681    02-JUN-13
  1    57      1644681    02-JUN-13 1644718    02-JUN-13
  1    58      1644718    02-JUN-13 1644737    02-JUN-13
  1    59      1644737    02-JUN-13 1644818    02-JUN-13
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
26      Full    1.00G      DISK        00:00:09     02-JUN-13      
        BP Key: 26   Status: AVAILABLE  Compressed: NO  Tag: FULLBK01
        Piece Name: /u01/rmanbkp/full01
  List of Datafiles in backup set 26
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1644824    02-JUN-13 /u01/oracle/oradata/ora11g/system01.dbf
  2       Full 1644824    02-JUN-13 /u01/oracle/oradata/ora11g/sysaux01.dbf
  3       Full 1644824    02-JUN-13 /u01/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1644824    02-JUN-13 /u01/oracle/oradata/ora11g/users01.dbf
  5       Full 1644824    02-JUN-13 /u01/oracle/oradata/ora11g/ts1.dbf
  6       Full 1644824    02-JUN-13 /u01/oracle/oradata/ora11g/ts2.dbf
  7       Full 1644824    02-JUN-13 /u01/oracle/oradata/ora11g/ts3.dbf
  8       Full 1644824    02-JUN-13 /u01/oracle/oradata/ora11g/ts4.dbf
(从上面可以看到控制文件、参数文件和收尾的归档日志都没备份,注意和接下来备份成功的情况比较一下)
RMAN> delete noprompt backup;
using channel ORA_DISK_1
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
25      25      1   1   AVAILABLE   DISK        /u01/rmanbkp/arch01
26      26      1   1   AVAILABLE   DISK        /u01/rmanbkp/full01
deleted backup piece
backup piece handle=/u01/rmanbkp/arch01 RECID=25 STAMP=817067373
deleted backup piece
backup piece handle=/u01/rmanbkp/full01 RECID=26 STAMP=817067375
Deleted 2 objects
RMAN> list backup;
specification does not match any backup in the repository
RMAN> backup database include current controlfile format '/u01/rmanbkp/full01_%U' tag 'fullbk01' plus archivelog format '/u01/rmanbkp/arch01_%U' 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 archived log thread=1 sequence=48 RECID=5 STAMP=817061936
input archived log thread=1 sequence=49 RECID=6 STAMP=817065148
input archived log thread=1 sequence=50 RECID=7 STAMP=817065192
input archived log thread=1 sequence=51 RECID=8 STAMP=817066777
input archived log thread=1 sequence=52 RECID=9 STAMP=817066795
input archived log thread=1 sequence=53 RECID=10 STAMP=817066905
input archived log thread=1 sequence=54 RECID=11 STAMP=817066934
input archived log thread=1 sequence=55 RECID=12 STAMP=817067207
input archived log thread=1 sequence=56 RECID=13 STAMP=817067228
input archived log thread=1 sequence=57 RECID=14 STAMP=817067257
input archived log thread=1 sequence=58 RECID=15 STAMP=817067276
input archived log thread=1 sequence=59 RECID=16 STAMP=817067373
input archived log thread=1 sequence=60 RECID=17 STAMP=817067522
channel ORA_DISK_1: starting piece 1 at 02-JUN-13
channel ORA_DISK_1: finished piece 1 at 02-JUN-13
piece handle=/u01/rmanbkp/arch01_14ob6tg2_1_1 tag=FULLBK01 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-JUN-13
Starting backup at 02-JUN-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/oracle/oradata/ora11g/system01.dbf
input datafile file number=00002 name=/u01/oracle/oradata/ora11g/sysaux01.dbf
input datafile file number=00003 name=/u01/oracle/oradata/ora11g/undotbs01.dbf
input datafile file number=00005 name=/u01/oracle/oradata/ora11g/ts1.dbf
input datafile file number=00006 name=/u01/oracle/oradata/ora11g/ts2.dbf
input datafile file number=00007 name=/u01/oracle/oradata/ora11g/ts3.dbf
input datafile file number=00008 name=/u01/oracle/oradata/ora11g/ts4.dbf
input datafile file number=00004 name=/u01/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 02-JUN-13
channel ORA_DISK_1: finished piece 1 at 02-JUN-13
piece handle=/u01/rmanbkp/full01_15ob6tg3_1_1 tag=FULLBK01 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 02-JUN-13
channel ORA_DISK_1: finished piece 1 at 02-JUN-13
piece handle=/u01/rmanbkp/full01_16ob6tgi_1_1 tag=FULLBK01 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-JUN-13
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=61 RECID=18 STAMP=817067540
channel ORA_DISK_1: starting piece 1 at 02-JUN-13
channel ORA_DISK_1: finished piece 1 at 02-JUN-13
piece handle=/u01/rmanbkp/arch01_17ob6tgk_1_1 tag=FULLBK01 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-JUN-13
RMAN> list backup tag fullbk01;
List of Backup Sets
===================
BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
27      24.85M     DISK        00:00:00     02-JUN-13      
        BP Key: 27   Status: AVAILABLE  Compressed: NO  Tag: FULLBK01
        Piece Name: /u01/rmanbkp/arch01_14ob6tg2_1_1
  List of Archived Logs in backup set 27
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    44      1628668    02-JUN-13 1637132    02-JUN-13
  1    45      1637132    02-JUN-13 1637150    02-JUN-13
  1    46      1637150    02-JUN-13 1637154    02-JUN-13
  1    47      1637154    02-JUN-13 1637223    02-JUN-13
  1    48      1637223    02-JUN-13 1641689    02-JUN-13
  1    49      1641689    02-JUN-13 1643658    02-JUN-13
  1    50      1643658    02-JUN-13 1643685    02-JUN-13
  1    51      1643685    02-JUN-13 1644335    02-JUN-13
  1    52      1644335    02-JUN-13 1644352    02-JUN-13
  1    53      1644352    02-JUN-13 1644493    02-JUN-13
  1    54      1644493    02-JUN-13 1644513    02-JUN-13
  1    55      1644513    02-JUN-13 1644664    02-JUN-13
  1    56      1644664    02-JUN-13 1644681    02-JUN-13
  1    57      1644681    02-JUN-13 1644718    02-JUN-13
  1    58      1644718    02-JUN-13 1644737    02-JUN-13
  1    59      1644737    02-JUN-13 1644818    02-JUN-13
  1    60      1644818    02-JUN-13 1645261    02-JUN-13
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
28      Full    1.00G      DISK        00:00:08     02-JUN-13      
        BP Key: 28   Status: AVAILABLE  Compressed: NO  Tag: FULLBK01
        Piece Name: /u01/rmanbkp/full01_15ob6tg3_1_1
  List of Datafiles in backup set 28
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1645267    02-JUN-13 /u01/oracle/oradata/ora11g/system01.dbf
  2       Full 1645267    02-JUN-13 /u01/oracle/oradata/ora11g/sysaux01.dbf
  3       Full 1645267    02-JUN-13 /u01/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1645267    02-JUN-13 /u01/oracle/oradata/ora11g/users01.dbf
  5       Full 1645267    02-JUN-13 /u01/oracle/oradata/ora11g/ts1.dbf
  6       Full 1645267    02-JUN-13 /u01/oracle/oradata/ora11g/ts2.dbf
  7       Full 1645267    02-JUN-13 /u01/oracle/oradata/ora11g/ts3.dbf
  8       Full 1645267    02-JUN-13 /u01/oracle/oradata/ora11g/ts4.dbf
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
29      Full    9.36M      DISK        00:00:01     02-JUN-13      
        BP Key: 29   Status: AVAILABLE  Compressed: NO  Tag: FULLBK01
        Piece Name: /u01/rmanbkp/full01_16ob6tgi_1_1
  SPFILE Included: Modification time: 02-JUN-13
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1645271      Ckp time: 02-JUN-13
BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
30      3.00K      DISK        00:00:00     02-JUN-13      
        BP Key: 30   Status: AVAILABLE  Compressed: NO  Tag: FULLBK01
        Piece Name: /u01/rmanbkp/arch01_17ob6tgk_1_1
  List of Archived Logs in backup set 30
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    61      1645261    02-JUN-13 1645277    02-JUN-13
RMAN> 

1. Specifying a Format for RMAN Backups

2. Backing Up Control Files with RMAN

3. RMAN配置参数解释

转载地址:http://gitai.baihongyu.com/

你可能感兴趣的文章
Java之synchronized小例
查看>>
jstl之set与out小例
查看>>
apploc.bat
查看>>
乱撞解决word只能以安全模式启动
查看>>
Oracle外部表小例
查看>>
在VS.NET的VC++中运行控制台程序后暂停
查看>>
Linux下rz,sz与ssh,SecureCRT的配合使用
查看>>
一个使用Pro*C实现增删改查的小例子
查看>>
Save could not be completed. Eclipse国际化的问题解决
查看>>
Xblo(JSP+Servlet+JavaBean+Oracle单用户Blog)
查看>>
Unable to use IEC module under PortablePython_1.1_py2.5.4
查看>>
实用英文地址书写格式
查看>>
在oracle中通过connect by prior来实现递归查询!
查看>>
百度空间如何才能另存为 mht
查看>>
How to Reset or Change Microsoft Office 2007 Product License Key or Volume License Key (VLK)
查看>>
使用java concurrent调用xmlp api生成pdf
查看>>
Oracle日期计算之INTERVAL
查看>>
Oracle PL/SQL之EXCEPTION
查看>>
Oracle PL/SQL之EXCEPTION -- WHEN OTHERS THEN
查看>>
Oracle PL/SQL之VARCHAR2 QUALIFIER
查看>>