RMAN> run { 2> allocate channel ch00 type disk; 3> backup format '/dbbackup/db_%T' database; 4> release channel ch00; 5> }
報出以下錯誤:
released channel: ch00 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03009: failure of backup command on ch00 channel at 08/11/2015 17:32:39 ORA-19504: failed to create file "/dbbackup/db_20150811" ORA-27038: created file already exists Additional information: 1 RMAN>
原因是控制文件和參數文件需要單獨生成一個備份集,不能和數據庫共用一個備份集,而在給數據文件指定備份集時又只指定一個單一的文件名,所以報了個文件已經存在的錯誤。 解決方法是在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/app/oracle/oradata/dbt/control01.ctl 16384 /u01/app/oracle/oradata/dbt/control02.ctl 16384 SQL> show parameter db_block_size NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_block_size integer 8192 SQL>