4 Replies Latest reply: Jul 11, 2012 11:59 AM by Shivananda Rao RSS

    Need to duplicate backup of a PROD database to TEST server, but

    cheers4beers
      Need to use RMAN to duplicate a backup of a PROD database to a TEST server, but there is already an instance by the same name running on the TEST server. Also, the directory that I am copying the backup files to on the TEST server is not the same as on the PROD server.

      Example:

      PROD Server = ServerA (AIX 5.3)
      PROD DB = APPL (Oracle 10.2.0.4, running in compatible for 10.2.0.1)
      PROD Backup Directory = /backup/flash_recovery_area/APPL


      TEST Server = ServerB (AIX 5.3)
      TEST DB = APPL --> (Already exists on this server, same name as PROD DB, and same version)
      TEST DB (New) = APPL_WTC --> (Will be the name of the new database, duplicating to this database)
      TEST Backup Directory = /backup2/APPL --> (Location that the PROD DB backup files have been copied to)


      I have created my RMAN duplicate script, and it will SET NEWNAME for all of the datafiles, etc.

      My question is, how do I run this RMAN duplicate with the PROD DB backup files in a directory not of the same name? How can I catalog the files in that location so that the RMAN duplicate job will use them?


      Thanks!

      Brandon
        • 1. Re: Need to duplicate backup of a PROD database to TEST server, but
          mseberg
          Hello;
          My question is, how do I run this RMAN duplicate with the PROD DB backup files in a directory not of the same name? 
          What I do is take a special backup using a different location like /u01/backup

          And then I run something like this
          RMAN RUN {
          allocate channel d1 type disk;
          backup format '/u01/backups/PRIMARY/df_t%t_s%s_p%p' database;
          sql 'alter system archive log current';
          backup format '/u01/backups/PRIMARY/al_t%t_s%s_p%p' archivelog all;
          backup current controlfile  format '/u01/backups/PRIMARY/sb_t%t_s%s_p%p';
          release channel d1;
          }
          Next I move the backup to the same location on the other server and create that location if needed.


          On the target database I create a small INIT file and include these parameters :
          db_name, control_files, db_recovery_file_dest, db_recovery_file_dest_size, compatible, db_block_size, undo_tablespace, undo_management, undo_retention

          Then I start the database nomount on that init file

          and finally issue the

          duplicate target database nofilenamecheck;


          How can I catalog the files in that location so that the RMAN duplicate job will use them?
          If you do similar to above it will just find it. If you change file locations then you need set the Parameters DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT in the INIT file


          Best Regards

          mseberg
          • 2. Re: Need to duplicate backup of a PROD database to TEST server, but
            cheers4beers
            Hi Mseberg,

            Unfortunately, due to disk space limitations, I cannot create the source backup in another location. I have my init file set up, and instead of using the DB_FILE_NAME_CONVERT, I have used SET NEWNAME FOR DATAFILE...

            Here is the error I am getting:

            channel ORA_AUX_DISK_1: reading from backup piece /backup/flash_recovery_area/CRIS/backupset/CRIS_c1_ujunerbjn_p1.bk
            ORA-19870: error reading backup piece /backup/flash_recovery_area/CRIS/backupset/CRIS_c1_ujunerbjn_p1.bk
            ORA-19505: failed to identify file "/backup/flash_recovery_area/CRIS/backupset/CRIS_c1_ujunerbjn_p1.bk"
            ORA-27037: unable to obtain file status
            IBM AIX RISC System/6000 Error: 2: No such file or directory


            That is not where the backup files are located on the server I am duplicating to. That directory ( */backup/flash_recovery_area/CRIS/backupset* ) does not exist on the TEST (destination) server. Instead, the files have been copied to directory '/backup2/CRIS'. I need to somehow be able to CATALOG the files in the '/backup2/CRIS' directory into RMAN, but there are no controlfiles for the CRIS_WTC instance yet, so I can't catalog the backup files there.

            Here is the script that I am using:

            RUN {
            SET UNTIL SEQUENCE 19647;
            SET NEWNAME FOR DATAFILE 1 TO '/tmp2/CRIS_WTC/system01.dbf';
            SET NEWNAME FOR DATAFILE 2 TO '/data2/CRIS_WTC/MDR_DATA3.dbf';
            SET NEWNAME FOR DATAFILE 3 TO '/indx2/CRIS_WTC/indx01.dbf';
            SET NEWNAME FOR DATAFILE 4 TO '/tmp2/CRIS_WTC/tools01.dbf';
            SET NEWNAME FOR DATAFILE 5 TO '/data2/CRIS_WTC/users01.dbf';
            SET NEWNAME FOR DATAFILE 6 TO '/tmp2/CRIS_WTC/oem_repository.dbf';
            SET NEWNAME FOR DATAFILE 7 TO '/data2/CRIS_WTC/BO_DATA.dbf';
            SET NEWNAME FOR DATAFILE 8 TO '/data2/CRIS_WTC/ DI_DATA.dbf';
            SET NEWNAME FOR DATAFILE 9 TO '/data2/CRIS_WTC/MDROCP_DATA.dbf';
            SET NEWNAME FOR DATAFILE 10 TO '/indx2/CRIS_WTC/MDROCP_INDX.dbf';
            SET NEWNAME FOR DATAFILE 11 TO '/data2/CRIS_WTC/MDR_CODE.dbf';
            SET NEWNAME FOR DATAFILE 12 TO '/data2/CRIS_WTC/MDR_CODE_INDX.dbf';
            SET NEWNAME FOR DATAFILE 13 TO '/data2/CRIS_WTC/MDR_DATA.dbf';
            SET NEWNAME FOR DATAFILE 14 TO '/indx2/CRIS_WTC/MDR_INDX.dbf';
            SET NEWNAME FOR DATAFILE 15 TO '/data2/CRIS_WTC/MDR_MV.dbf';
            SET NEWNAME FOR DATAFILE 16 TO '/indx2/CRIS_WTC/MDR_MV_INDX.dbf';
            SET NEWNAME FOR DATAFILE 17 TO '/data2/CRIS_WTC/METASYS_DATA.dbf';
            SET NEWNAME FOR DATAFILE 18 TO '/indx2/CRIS_WTC/METASYS_INDX.dbf';
            SET NEWNAME FOR DATAFILE 19 TO '/data2/CRIS_WTC/STAGE_DATA.dbf';
            SET NEWNAME FOR DATAFILE 20 TO '/indx2/CRIS_WTC/STAGE_INDX.dbf';
            SET NEWNAME FOR DATAFILE 21 TO '/indx2/CRIS_WTC/MDR_INDX02.dbf';
            SET NEWNAME FOR DATAFILE 22 TO '/data2/CRIS_WTC/MDR_DATA2.dbf';
            SET NEWNAME FOR DATAFILE 23 TO '/tmp2/CRIS_WTC/TEMP3.dbf';
            SET NEWNAME FOR DATAFILE 24 TO '/indx2/CRIS_WTC/MDR_INDX03.dbf';
            SET NEWNAME FOR DATAFILE 25 TO '/tmp2/CRIS_WTC/sysaux01.dbf';
            SET NEWNAME FOR DATAFILE 26 TO '/data2/CRIS_WTC/STAGE_DATA1.dbf';
            SET NEWNAME FOR DATAFILE 27 TO '/data2/CRIS_WTC/MDR_MV02.dbf';
            SET NEWNAME FOR DATAFILE 28 TO '/data2/CRIS_WTC/MDR_DATA4.dbf';
            SET NEWNAME FOR DATAFILE 29 TO '/undo2/CRIS_WTC/undo21.dbf';
            SET NEWNAME FOR DATAFILE 30 TO '/data2/CRIS_WTC/STAGE_DATA2.dbf';
            SET NEWNAME FOR DATAFILE 31 TO '/data2/CRIS_WTC/PADATA.dbf';
            SET NEWNAME FOR DATAFILE 32 TO '/indx2/CRIS_WTC/PAINDEX.dbf';
            SET NEWNAME FOR DATAFILE 33 TO '/data2/CRIS_WTC/MDR_DATA5.dbf';
            SET NEWNAME FOR DATAFILE 34 TO '/indx2/CRIS_WTC/MDR_INDX04.dbf';
            SET NEWNAME FOR DATAFILE 35 TO '/data2/CRIS_WTC/MDR_DATA6.dbf';
            SET NEWNAME FOR DATAFILE 36 TO '/indx2/CRIS_WTC/MDR_INDX05.dbf';
            SET NEWNAME FOR DATAFILE 37 TO '/data2/CRIS_WTC/MDR_DATA7.dbf';
            SET NEWNAME FOR DATAFILE 38 TO '/indx2/CRIS_WTC/MDR_INDX06.dbf';
            SET NEWNAME FOR DATAFILE 39 TO '/data2/CRIS_WTC/MDR_MV03.dbf';
            DUPLICATE TARGET DATABASE TO CRIS_WTC
            PFILE = /oracle/Oracle1024/dbs/initCRIS_WTC.ora
            NOFILENAMECHECK
            LOGFILE GROUP 1 ('/redo2/CRIS_WTC/redo01.log') SIZE 1000M,
            GROUP 2 ('/redo2/CRIS_WTC/redo02.log') SIZE 1000M,
            GROUP 3 ('/redo2/CRIS_WTC/redo03.log') SIZE 1000M;
            }
            • 3. Re: Need to duplicate backup of a PROD database to TEST server, but
              mseberg
              Hello again;

              Sorry for the long delay. I think you are closer than it looks. However you are using a method which is different than mine so I do not have an exact answer.

              However I did find an Oracle note which looks very helpful :

              In nocatalog, catalog backuppiece failed with ORA-19870 ORA-19505 ORA-27041 [ID 562671.1]

              I hope this pushes you past the issue.

              Best Regards

              mseberg

              Later

              This thread may also help :

              catalog backupiece failed with errror ORA-19870,ORA-19505,ORA-27037

              Using the search feature with "ORA-19870" inside the RMAN forum is also your friend.

              MS

              Edited by: mseberg on Jul 10, 2012 6:16 PM
              • 4. Re: Need to duplicate backup of a PROD database to TEST server, but
                Shivananda Rao
                That is not where the backup files are located on the server I am duplicating to. That directory ( /backup/flash_recovery_area/CRIS/backupset ) does not exist on the TEST (destination) server. Instead, the files have been copied to directory '/backup2/CRIS'. I need to somehow be able to CATALOG the files in the '/backup2/CRIS' directory into RMAN, but there are no controlfiles for the CRIS_WTC instance yet, so I can't catalog the backup files there.
                Hi,

                Try to restore the controlfile from the backup piece you have copied to the location */backup2/CRIS* by specifying the backup piece. You can determine the backup piece containing the controlfile backup by verifying from the primary (target) database.

                Target db:

                rman>list backup;

                determine the backup piece name containing the controlfile backup. Eg: CRIS_c1_ujunerbjn_p1.bk

                Since you have copied the backup to the location /backup/CRIS, restore it on Test db server as:

                rman>restore controlfile from '/backup/CRIS/CRIS_c1_ujunerbjn_p1.bk';

                Once restored, mount the database, catalog the rest of the backup pieces and you can run your restore script.