9 Replies Latest reply on May 16, 2019 5:00 PM by Dude!

    Use RMAN to copy/clone a database

    Alex2068

      I wanted to clone a database using RMAN. Found this http://www.dba-oracle.com/t_rman_clone_copy_database.htm

      It is divided into two sections. If you clone to maintaining the same folder structure or using another folder structure. I am interested in the second part.

      My source database (A) is on Windows Server 2012, Oracle 12.2.0.1 Standard Edition. Data files are on drive X, oracle software on V.

      My destination database (B) is on Windows Server 2016, Oracle 12.2.0.1 Standard Edition. Data files are on drive Y, oracle software on W.

      I actually created both database using the same template, only needed to modify files location from X to Y, and V to W. So database names are the same.

      Now, using RMAN, I want to overwrite database B with A. They are both container databases (one pluggable database) in noarchive log mode.

       

      So my steps were, while A was mounted, backup database using RMAN. As a result I get four files containing CDB, SEED, PDB and Control-Spfile and I and move them to destination server.

      On destination server, using RMAN I shutdown B and bring it to nomount state so I can start overwriting it, by cloning A to B.

       

      So from that article link, my very first serious RMAN step is:

      5. Restore the controlfile from the backup piece.

      RMAN> restore controlfile from '/u01/oracle/product/ora10g/dbs/c-3932056136-20070213-02';

      This gives me (using my real file name):

      RMAN> restore controlfile from 'F:\Test\IFSLCDB_D_20190425_0MTVSSLU_S22_P1';

      Starting restore at 10-MAY-19

      restore not done; all files read only, offline, excluded, or already restored

      Finished restore at 10-MAY-19

      RMAN>

       

      What is missing here? I am failing on the very first step.

      I even tried to set on B, DBID, using the one from A, no joy.

      Any help please?

        • 1. Re: Use RMAN to copy/clone a database
          EdStevens

          Alex2068 wrote:

           

          I wanted to clone a database using RMAN. Found this http://www.dba-oracle.com/t_rman_clone_copy_database.htm

          It is divided into two sections. If you clone to maintaining the same folder structure or using another folder structure. I am interested in the second part.

          My source database (A) is on Windows Server 2012, Oracle 12.2.0.1 Standard Edition. Data files are on drive X, oracle software on V.

          My destination database (B) is on Windows Server 2016, Oracle 12.2.0.1 Standard Edition. Data files are on drive Y, oracle software on W.

          I actually created both database using the same template, only needed to modify files location from X to Y, and V to W. So database names are the same.

          Now, using RMAN, I want to overwrite database B with A. They are both container databases (one pluggable database) in noarchive log mode.

           

          So my steps were, while A was mounted, backup database using RMAN. As a result I get four files containing CDB, SEED, PDB and Control-Spfile and I and move them to destination server.

          On destination server, using RMAN I shutdown B and bring it to nomount state so I can start overwriting it, by cloning A to B.

           

          So from that article link, my very first serious RMAN step is:

          5. Restore the controlfile from the backup piece.

          RMAN> restore controlfile from '/u01/oracle/product/ora10g/dbs/c-3932056136-20070213-02';

          This gives me (using my real file name):

          RMAN> restore controlfile from 'F:\Test\IFSLCDB_D_20190425_0MTVSSLU_S22_P1';

          Starting restore at 10-MAY-19

          restore not done; all files read only, offline, excluded, or already restored

          Finished restore at 10-MAY-19

          RMAN>

           

          What is missing here? I am failing on the very first step.

          I even tried to set on B, DBID, using the one from A, no joy.

          Any help please?

          You say you are working with 12., but it appears you are restoring your control file backup from an 10g home:  restore controlfile from '/u01/oracle/product/ora10g/dbs

           

          Rather than rely on a 3d party website that is not held in high regard in these parts, why not look at the official oracle docs:

          https://docs.oracle.com/en/database/oracle/oracle-database/12.2/bradv/index.html

           

          Look at the section on 'duplicate database'.

          • 2. Re: Use RMAN to copy/clone a database
            Dude!

            Now, using RMAN, I want to overwrite database B with A. They are both container databases (one pluggable database) in noarchive log mode.

             

            You are probably in for a much longer session than a quick fix.

             

            You cannot restore database A overwriting B, nor can you restore A into B. You can only restore database A overwriting A, or B restoring B. You can, however, copy A to B, which is called RMAN duplicate, however, but if I remember correctly, B (datafiles) must not exist.

             

            I suggest to review some of the information.

            Restore Database And Rename Database Files Example

            Oracle 12c Active Database Duplication Using Backup Sets Example

             

            Whether you have CDB or non-container database is irrelevant. You will have to modify the parameter file as mentioned in section 2c above, and also set the correct location for your controlfiles.

             

            Regarding the restore of the spfile I suggest to review:

            Oracle Database 11g: Disaster Recovery Example

             

             

            RMAN> restore controlfile from 'F:\Test\IFSLCDB_D_20190425_0MTVSSLU_S22_P1';

            Starting restore at 10-MAY-19

            restore not done; all files read only, offline, excluded, or already restored

            How did you determine this is a spfile/controflile backup piece?

             

            Anyway, there's no error? It just means the file has already been restored. RMAN does not restore files when the very same file already exists.

            • 3. Re: Use RMAN to copy/clone a database
              Alex2068

              ok, the follow up to the responses.

              1. I working with 12, restore controlfile from '/u01/oracle/product/ora10g/dbs is from that linked article. I use windows and F drive. I also thought it is not any 3rd party but some kind of more respectfull one. I might be wrong here but I thought they became a part of Oracle now.

              2. How did you determine this is a spfile/controflile backup piece?

              Well, I think this might be a valid question now.

              I took the step back and on B (destination) I renamed spfile. Then:

              RMAN> startup nomount;

              connected to target database (not started)

              startup failed: ORA-01078: failure in processing system parameters

              LRM-00109: could not open parameter file 'E:\APP\ORACLE\PRODUCT\12.2.0\DBHOME_1\DATABASE\INITIFSL.ORA'

              starting Oracle instance without parameter file for retrieval of spfile

              Oracle instance started

              Total System Global Area    1073741824 bytes

               

              Fixed Size                     8755392 bytes

              Variable Size                591398720 bytes

              Database Buffers             452984832 bytes

              Redo Buffers                  20602880 bytes

               

              RMAN> restore spfile from autobackup db_recovery_file_dest='F:\Test';

              Starting restore at 15-MAY-19

              restore not done; all files read only, offline, excluded, or already restored

              Finished restore at 15-MAY-19

               

              RMAN> restore spfile from 'F:\Test\IFSLCDB_D_20190425_0MTVSSLU_S22_P1';

              Starting restore at 15-MAY-19

              restore not done; all files read only, offline, excluded, or already restored

              Finished restore at 15-MAY-19

               

              RMAN> restore spfile from 'F:\Test\IFSLCDB_D_20190425_0LTVSSLQ_S21_P1';

              Starting restore at 15-MAY-19

              restore not done; all files read only, offline, excluded, or already restored

              Finished restore at 15-MAY-19

               

              RMAN>

               

              No matter which file I choos (out of 4 files) I do, I fail in restoring spfile.

              When doing database backup on A, I enjoed changing

              CONFIGURE CONTROLFILE AUTOBACKUP OFF;

              As a result I was NOT getting in Oracle_Home\database folder that extra backup piece with control/spfile and I WAS getting en extra backup piece in my

              CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   'F:\RMAN\%d_D_%T_%u_s%s_p%p';

              and I enjoyed it as more consistent aproach for file storage (in one folder).

               

              How do I know, where control file is? I was guessing that from the backup:

               

              RMAN> backup database;

              Starting backup at 15-MAY-19

              allocated channel: ORA_DISK_1

              channel ORA_DISK_1: SID=311 device type=DISK

              channel ORA_DISK_1: starting full datafile backup set

              channel ORA_DISK_1: specifying datafile(s) in backup set

              input datafile file number=00010 name=E:\ORADATA\IFSLCDB\IFSLPDB\UNDOTBS01.DBF

              input datafile file number=00015 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_LOB01.DBF

              input datafile file number=00016 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_LOB02.DBF

              input datafile file number=00017 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_LOB03.DBF

              input datafile file number=00018 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_LOB04.DBF

              input datafile file number=00019 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_LOB05.DBF

              input datafile file number=00020 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_LOB06.DBF

              input datafile file number=00021 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_LOB07.DBF

              input datafile file number=00022 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_LOB08.DBF

              input datafile file number=00024 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_INDEX01.DBF

              input datafile file number=00025 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_INDEX02.DBF

              input datafile file number=00026 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_INDEX03.DBF

              input datafile file number=00027 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_INDEX04.DBF

              input datafile file number=00028 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_INDEX05.DBF

              input datafile file number=00029 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_INDEX06.DBF

              input datafile file number=00030 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_DATA01.DBF

              input datafile file number=00031 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_DATA02.DBF

              input datafile file number=00032 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_DATA03.DBF

              input datafile file number=00033 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_DATA04.DBF

              input datafile file number=00034 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_DATA05.DBF

              input datafile file number=00035 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_DATA06.DBF

              input datafile file number=00036 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_DATA07.DBF

              input datafile file number=00037 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_DATA08.DBF

              input datafile file number=00014 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_REPORT_DATA01.DBF

              input datafile file number=00008 name=E:\ORADATA\IFSLCDB\IFSLPDB\SYSTEM01.DBF

              input datafile file number=00009 name=E:\ORADATA\IFSLCDB\IFSLPDB\SYSAUX01.DBF

              input datafile file number=00013 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_REPORT_INDEX01.DBF

              input datafile file number=00023 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_LOB09.DBF

              input datafile file number=00012 name=E:\ORADATA\IFSLCDB\IFSLPDB\MTS_DATA01.DBF

              input datafile file number=00038 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_ARCHIVE_INDEX01.DBF

              input datafile file number=00039 name=E:\ORADATA\IFSLCDB\IFSLPDB\IFSAPP_ARCHIVE_DATA01.DBF

              input datafile file number=00011 name=E:\ORADATA\IFSLCDB\IFSLPDB\USERS01.DBF

              channel ORA_DISK_1: starting piece 1 at 15-MAY-19

              channel ORA_DISK_1: finished piece 1 at 15-MAY-19

              piece handle=G:\RMAN\MATT\IFSLCDB_D_20190515_0AU1JULQ_S10_P1 tag=TAG20190515T131

              225 comment=NONE

              channel ORA_DISK_1: backup set complete, elapsed time: 00:29:47

              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=E:\ORADATA\IFSLCDB\SYSTEM01.DBF

              input datafile file number=00003 name=E:\ORADATA\IFSLCDB\SYSAUX01.DBF

              input datafile file number=00005 name=E:\ORADATA\IFSLCDB\UNDOTBS01.DBF

              input datafile file number=00007 name=E:\ORADATA\IFSLCDB\USERS01.DBF

              channel ORA_DISK_1: starting piece 1 at 15-MAY-19

              channel ORA_DISK_1: finished piece 1 at 15-MAY-19

              piece handle=G:\RMAN\MATT\IFSLCDB_D_20190515_0BU1K0DL_S11_P1 tag=TAG20190515T131

              225 comment=NONE

              channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07

              channel ORA_DISK_1: starting full datafile backup set

              channel ORA_DISK_1: specifying datafile(s) in backup set

              input datafile file number=00006 name=E:\ORADATA\IFSLCDB\PDBSEED\UNDOTBS01.DBF

              input datafile file number=00002 name=E:\ORADATA\IFSLCDB\PDBSEED\SYSTEM01.DBF

              input datafile file number=00004 name=E:\ORADATA\IFSLCDB\PDBSEED\SYSAUX01.DBF

              channel ORA_DISK_1: starting piece 1 at 15-MAY-19

              channel ORA_DISK_1: finished piece 1 at 15-MAY-19

              piece handle=G:\RMAN\MATT\IFSLCDB_D_20190515_0CU1K0DS_S12_P1 tag=TAG20190515T131

              225 comment=NONE

              channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03

              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 15-MAY-19

              channel ORA_DISK_1: finished piece 1 at 15-MAY-19

              piece handle=G:\RMAN\MATT\IFSLCDB_D_20190515_0DU1K0DV_S13_P1 tag=TAG20190515T131

              225 comment=NONE

              channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

              Finished backup at 15-MAY-19

              RMAN>

               

              I did not try to set DBID here yet as I lost that number. this above backup was taken just to paste it here as a prove.

              • 4. Re: Use RMAN to copy/clone a database
                EdStevens

                Alex2068 wrote:

                 

                ok, the follow up to the responses.

                1. I working with 12, restore controlfile from '/u01/oracle/product/ora10g/dbs is from that linked article. I use windows and F drive.

                Ah, I didn't pick up on that. Sorry.

                 

                 

                I also thought it is not any 3rd party but some kind of more respectfull one. I might be wrong here but I thought they became a part of Oracle now.

                Huh?  Are you saying you thought dba-oracle.com was/is "part of oracle"?  If so, how in the world did you ever get that idea?

                • 5. Re: Use RMAN to copy/clone a database
                  Alex2068

                  I would swear I saw the other day (weeks, months ago) Oracle logo on Burleson Consulting and at that time a thought struck me they were taken over by Oracle. Now, after your doubt, I was trying to google it somewhere, and I cannot find anything to support my previous idea, so I assume I am wrong here (deeply?).

                  • 6. Re: Use RMAN to copy/clone a database
                    Alex2068

                    I still need some guidance please. After reading here and there, I changed my approach.

                    Source (A) and destination (B) databases have the same names, created from the same template. Different Windows servers though and different location for oracle_home, datafiles, controlfiles, log files, spfile.

                     

                    On destination server I did run: create pfile from spfile;

                    First surprise, many parameters from spfile are not getting to pfile. I ignored that as not using pfile.

                    Since destination database was fully created using DBCA, I don't think pfile is needed as my destination database is using spfile anyway, when in nomount state (simple startup nomount).

                    Now I want to ovewrite it with the source database.

                     

                    C:\Users\Administrator>rman target sys/oracle@test_a auxiliary /

                     

                    Recovery Manager: Release 12.2.0.1.0 - Production on Thu May 16 15:14:08 2019

                    Copyright (c) 1982, 2018, Oracle and/or its affiliates.  All rights reserved.

                    connected to target database: TESTCDB (DBID=2607983709)

                    connected to auxiliary database: TESTCDB (not mounted)

                     

                    RMAN> show all;

                    using target database control file instead of recovery catalog

                    RMAN configuration parameters for database with db_unique_name TESTCDB are:

                    CONFIGURE RETENTION POLICY TO REDUNDANCY 10;

                    CONFIGURE BACKUP OPTIMIZATION OFF; # default

                    CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

                    CONFIGURE CONTROLFILE AUTOBACKUP OFF;

                    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

                    CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

                    CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

                    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

                    CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   'G:\RMAN\Matt\%d_D_%T_%u_s%s_p%p';

                    CONFIGURE MAXSETSIZE TO UNLIMITED; # default

                    CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

                    CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

                    CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

                    CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default

                    CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

                    CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'F:\APP\ORACLE\PRODUCT\12.2.0\DBHOME_1\DATABASE\SNCFTEST.ORA'; # default

                     

                    RMAN> RUN

                    {

                    SET NEWNAME FOR DATAFILE 1 TO 'F:\ORADATA\TESTCDB\SYSTEM01.DBF';

                    SET NEWNAME FOR DATAFILE 2 TO 'F:\ORADATA\TESTCDB\PDBSEED\SYSTEM01.DBF';

                    SET NEWNAME FOR DATAFILE 3 TO 'F:\ORADATA\TESTCDB\SYSAUX01.DBF';

                    SET NEWNAME FOR DATAFILE 4 TO 'F:\ORADATA\TESTCDB\PDBSEED\SYSAUX01.DBF';

                    SET NEWNAME FOR DATAFILE 5 TO 'F:\ORADATA\TESTCDB\UNDOTBS01.DBF';

                    SET NEWNAME FOR DATAFILE 6 TO 'F:\ORADATA\TESTCDB\PDBSEED\UNDOTBS01.DBF';

                    SET NEWNAME FOR DATAFILE 7 TO 'F:\ORADATA\TESTCDB\USERS01.DBF';

                    SET NEWNAME FOR DATAFILE 8 TO 'F:\ORADATA\TESTCDB\TESTPDB\SYSTEM01.DBF';

                    SET NEWNAME FOR DATAFILE 9 TO 'F:\ORADATA\TESTCDB\TESTPDB\SYSAUX01.DBF';

                    SET NEWNAME FOR DATAFILE 10 TO 'F:\ORADATA\TESTCDB\TESTPDB\UNDOTBS01.DBF';

                    SET NEWNAME FOR DATAFILE 11 TO 'F:\ORADATA\TESTCDB\TESTPDB\USERS01.DBF';

                    SET NEWNAME FOR DATAFILE 12 TO 'F:\ORADATA\TESTCDB\TESTPDB\MTS_DATA01.DBF';

                    SET NEWNAME FOR DATAFILE 13 TO 'F:\ORADATA\TESTCDB\TESTPDB\REPORT_INDEX01.DBF';

                    SET NEWNAME FOR DATAFILE 14 TO 'F:\ORADATA\TESTCDB\TESTPDB\REPORT_DATA01.DBF';

                    SET NEWNAME FOR DATAFILE 15 TO 'F:\ORADATA\TESTCDB\TESTPDB\LOB01.DBF';

                    SET NEWNAME FOR DATAFILE 16 TO 'F:\ORADATA\TESTCDB\TESTPDB\LOB02.DBF';

                    SET NEWNAME FOR DATAFILE 17 TO 'F:\ORADATA\TESTCDB\TESTPDB\LOB03.DBF';

                    SET NEWNAME FOR DATAFILE 18 TO 'F:\ORADATA\TESTCDB\TESTPDB\LOB04.DBF';

                    SET NEWNAME FOR DATAFILE 19 TO 'F:\ORADATA\TESTCDB\TESTPDB\LOB05.DBF';

                    SET NEWNAME FOR DATAFILE 20 TO 'F:\ORADATA\TESTCDB\TESTPDB\LOB06.DBF';

                    SET NEWNAME FOR DATAFILE 21 TO 'F:\ORADATA\TESTCDB\TESTPDB\LOB07.DBF';

                    SET NEWNAME FOR DATAFILE 22 TO 'F:\ORADATA\TESTCDB\TESTPDB\LOB08.DBF';

                    SET NEWNAME FOR DATAFILE 23 TO 'F:\ORADATA\TESTCDB\TESTPDB\LOB09.DBF';

                    SET NEWNAME FOR DATAFILE 24 TO 'F:\ORADATA\TESTCDB\TESTPDB\INDEX01.DBF';

                    SET NEWNAME FOR DATAFILE 25 TO 'F:\ORADATA\TESTCDB\TESTPDB\INDEX02.DBF';

                    SET NEWNAME FOR DATAFILE 26 TO 'F:\ORADATA\TESTCDB\TESTPDB\INDEX03.DBF';

                    SET NEWNAME FOR DATAFILE 27 TO 'F:\ORADATA\TESTCDB\TESTPDB\INDEX04.DBF';

                    SET NEWNAME FOR DATAFILE 28 TO 'F:\ORADATA\TESTCDB\TESTPDB\INDEX05.DBF';

                    SET NEWNAME FOR DATAFILE 29 TO 'F:\ORADATA\TESTCDB\TESTPDB\INDEX06.DBF';

                    SET NEWNAME FOR DATAFILE 30 TO 'F:\ORADATA\TESTCDB\TESTPDB\DATA01.DBF';

                    SET NEWNAME FOR DATAFILE 31 TO 'F:\ORADATA\TESTCDB\TESTPDB\DATA02.DBF';

                    SET NEWNAME FOR DATAFILE 32 TO 'F:\ORADATA\TESTCDB\TESTPDB\DATA03.DBF';

                    SET NEWNAME FOR DATAFILE 33 TO 'F:\ORADATA\TESTCDB\TESTPDB\DATA04.DBF';

                    SET NEWNAME FOR DATAFILE 34 TO 'F:\ORADATA\TESTCDB\TESTPDB\DATA05.DBF';

                    SET NEWNAME FOR DATAFILE 35 TO 'F:\ORADATA\TESTCDB\TESTPDB\DATA06.DBF';

                    SET NEWNAME FOR DATAFILE 36 TO 'F:\ORADATA\TESTCDB\TESTPDB\DATA07.DBF';

                    SET NEWNAME FOR DATAFILE 37 TO 'F:\ORADATA\TESTCDB\TESTPDB\DATA08.DBF';

                    SET NEWNAME FOR DATAFILE 38 TO 'F:\ORADATA\TESTCDB\TESTPDB\ARCHIVE_INDEX01.DBF';

                    SET NEWNAME FOR DATAFILE 39 TO 'F:\ORADATA\TESTCDB\TESTPDB\ARCHIVE_DATA01.DBF';

                     

                    DUPLICATE TARGET DATABASE to TESTCDB

                    LOGFILE GROUP 1 ('F:\ORADATA\TESTCDB\REDOLOGS\REDO010.LOG') SIZE 300M REUSE,

                            GROUP 2 ('F:\ORADATA\TESTCDB\REDOLOGS\REDO020.LOG') SIZE 300M REUSE,

                            GROUP 3 ('F:\ORADATA\TESTCDB\REDOLOGS\REDO030.LOG') SIZE 300M REUSE;

                    }

                     

                    Then it fails:

                    #executing command: SET NEWNAME

                    ..

                    ..

                    ..

                    executing command: SET NEWNAME

                     

                    Starting Duplicate Db at 16-MAY-19

                     

                    using target database control file instead of recovery catalog

                    allocated channel: ORA_AUX_DISK_1

                    channel ORA_AUX_DISK_1: SID=781 device type=DISK

                     

                    contents of Memory Script:

                    {

                       sql clone "alter system set  db_name =

                    ''TESTCDB'' comment=

                    ''Modified by RMAN duplicate'' scope=spfile";

                       sql clone "alter system set  db_unique_name =

                    ''TESTCDB'' comment=

                    ''Modified by RMAN duplicate'' scope=spfile";

                       shutdown clone immediate;

                       startup clone force nomount

                       restore clone primary controlfile;

                       alter clone database mount;

                    }

                     

                    executing Memory Script

                     

                    sql statement: alter system set  db_name =  ''TESTCDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

                    sql statement: alter system set  db_unique_name =  ''TESTCDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

                    Oracle instance shut down

                     

                    Oracle instance started

                     

                    Total System Global Area  117306294272 bytes

                     

                    Fixed Size                    26630840 bytes

                    Variable Size               9663677768 bytes

                    Database Buffers          107374182400 bytes

                    Redo Buffers                 241803264 bytes

                     

                     

                    Starting restore at 16-MAY-19

                     

                     

                    allocated channel: ORA_AUX_DISK_1

                    channel ORA_AUX_DISK_1: SID=1015 device type=DISK

                     

                     

                    Oracle instance started

                     

                     

                     

                     

                    Total System Global Area  117306294272 bytes

                     

                     

                    Fixed Size                    26630840 bytes

                    Variable Size               9663677768 bytes

                    Database Buffers          107374182400 bytes

                    Redo Buffers                 241803264 bytes

                     

                    contents of Memory Script:

                    {

                       sql clone "alter system set  db_name =

                    ''TESTCDB'' comment=

                    ''Reset to original value by RMAN'' scope=spfile";

                       sql clone "alter system reset  db_unique_name scope=spfile";

                       shutdown clone immediate;

                    }

                     

                    executing Memory Script

                     

                    sql statement: alter system set  db_name =  ''TESTCDB'' comment= ''Reset to original value by RMAN'' scope=spfile

                    sql statement: alter system reset  db_unique_name scope=spfile

                     

                    Oracle instance shut down

                     

                    RMAN-00571: ===========================================================

                    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

                    RMAN-00571: ===========================================================

                    RMAN-03002: failure of Duplicate Db command at 05/16/2019 15:19:52

                    RMAN-05501: aborting duplication of target database

                    RMAN-03015: error occurred in stored script Memory Script

                    RMAN-06026: some targets not found - aborting restore

                    RMAN-06024: no backup or copy of the control file found to restore

                    RMAN>

                     

                    When I go to source database server:

                     

                    RMAN> list backup of controlfile completed before 'sysdate';

                     

                    List of Backup Sets

                    ===================

                     

                    BS Key  Type LV Size       Device Type Elapsed Time Completion Time

                    ------- ---- -- ---------- ----------- ------------ ---------------

                    12      Full    18.03M     DISK        00:00:02     15-MAY-19

                            BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: TAG20190515T131225

                            Piece Name: G:\RMAN\MATT\TESTCDB_D_20190515_0DU1K0DV_S13_P1

                      Control File Included: Ckp SCN: 37166284     Ckp time: 15-MAY-19

                    RMAN>

                     

                    This location G:\RMAN\MATT is available from the destination server via mapped drive (same path G:\RMAN\MATT\).

                    • 7. Re: Use RMAN to copy/clone a database
                      Dude!

                      No one can grasp RMAN in a couple of days. You cannot use RMAN without understanding underlying concepts. Trial and error with RMAN is just going to get you frustrated.

                       

                      Source (A) and destination (B) databases have the same names, created from the same template. Different Windows servers though and different location for oracle_home, datafiles, controlfiles, log files, spfile.

                      What exactly have you done? Created a database with the same name on your destination server? Like I mentioned, this isn't possible. You cannot restore one database into another - for this you need datapump import/export. You can restore "the same" database - which is determined by DBID - or clone (duplicate) the target database to a new database. "Target" is the name of the database you are trying to backup or restore.

                       

                      Perhaps you should start with an easier approach than cloning and renaming a database along the way. You can for example create symlinks (also in Windows), so that drive Y can be addressed as letter X, etc. This way you can move your backups to the new server and perform a simple restore and recovery.

                      • 8. Re: Use RMAN to copy/clone a database
                        Alex2068

                        I am puzzeled with this sentence:

                        "Target" is the name of the database you are trying to backup or restore.

                         

                        So from your example:

                        Oracle 12c Active Database Duplication Using Backup Sets Example

                         

                        i) Connect RMAN to target and auxiliary database:

                        [oracle@701 ~]$ rman target sys/oracle_4U@CDB1 auxiliary sys/oracle_4U@CDB1DUP

                         

                        connected to target database: CDB1 (DBID=909549395)

                        connected to auxiliary database: CDB1DUP (not mounted)

                         

                        j) Duplicate the database:

                        RMAN> duplicate target database to cdb1dup from active database using backupset;

                         

                        I take it, you are trying to copy Target (cdb1) to Auxiliary (cdb1dup). And I am trying the same I belive. Though not using from active database using backupset.

                         

                        If you created your cdbdup1 using database configuration asistant (DBCA) first, you would have a shell database. I call it a shell as no transactional data inside, while your cdb1 (created weeks earlier from the same template) is working for last couple of weeks and is full of other data.

                        Now you go for nomount with that shell database cdb1dup (actually it doesn't matter if it has any more data as you want to overwrite it anyway), and you try the above process to duplicate cdb1 over cdb1dup. Is my reasoning wrong?

                        • 9. Re: Use RMAN to copy/clone a database
                          Dude!
                          Now you go for nomount with that shell database cdb1dup (actually it doesn't matter if it has any more data as you want to overwrite it anyway), and you try the above process to duplicate cdb1 over cdb1dup. Is my reasoning wrong?

                          Sorry that's not how it works.

                           

                          In Oracle you have a database instance, which is essentially all the server processes, and the database which are the database files. The instance can run without a parameter file, controlfile or database files, but you need to specify a DBID and start the instance in nomount mode. This is what you do to restore a pfile or binary spfile and controlfile. After you have the controlfile mounted, only then does the database and RMAN know which datafiles to restore.

                           

                          You can of course also shutdown the database and copy all the files, which is the easiest method. You can also rename datafiles or their location in the pfile.