Integrite RMAN data file copy feature into Shell/Perl script

Links: http://www.dbatools.net/experience/rman_copy_data_file.html

    We really like RMAN's data file copy feature, and we like to automate the standby build job with our own script. When we use RMAN script to copy the data file, we got few problems, first is a Oracle bug (2391697). As the database is huge (about 1000 data files) and busy, RMAN need to record the data file copy information into control file even if you specify the NOCATALOG option.

RMAN> copy  datafile 'a.dbf' to 'b.dbf';
Starting copy at 06-SEP-06
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=644 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of copy command at 09/06/2006 19:31:09
ORA-00235: controlfile fixed table inconsistent due to concurrent update
RMAN-06010: error while looking up datafile: a.dbf

    And the second is that the control file will become larger and larger. So we directly call the Oracle package to do the job.

declare  
  full_name varchar2(256);  
  recid     number;  
  stamp     number;
begin  
   sys.dbms_backup_restore.copydatafile(
       :P_FID,:P_FNAME,full_name, recid, stamp);
end;

    The "P_ID" is the file number to be copied, and the "P_NAME" is the target file name. After we make the change of our script, it run very smoothly and more robustly.

Post a comment

« Previous | Main | Next »

Powered by
Movable Type 3.36