Wednesday, March 1, 2017

Backup-Based Database Duplication Without Target and Recovery Catalog connection ( ASM to ASM on same host)

OS: Oracle Linux

DB: 11.2.0.1.0

1. First of all, define storage to duplicate database (we will use +DATA_DUP, +FRA_DUP here).
2. Backup target(source) database ora11g. 
    The backup locations are in the following output: 
    RMAN> list backup;
    List of Backup Sets
    ===================
    BS Key  Size      Device Type   Elapsed Time   Completion Time
    -------  ----------    -----------     ------------       ---------------
   141     6.30M   DISK        00:00:05       10-DEC-16      
           BP Key: 146   Status: AVAILABLE  Compressed: YES  Tag: TAG20161210T111816
           Piece Name: +FRA/ora11g/backupset/2016_12_10/annnf0_tag20161210t111816_0.698.930223097
     List of Archived Logs in backup set 141
     Thrd  Seq     Low SCN    Low Time    Next SCN   Next Time
      ----   -------    ----------    ---------       ----------     ---------
      1    1       5129793    10-DEC-16   5138592    10-DEC-16
      1    2       5138592    10-DEC-16   5138690    10-DEC-16
      1    3       5138690    10-DEC-16   5138931    10-DEC-16
      1    4       5138931    10-DEC-16   5139928    10-DEC-16
     BS Key  Type LV   Size       Device Type  Elapsed Time   Completion Time
    -------    ----      --        ----------      -----------      -----------------------
    142     Full     406.77M   DISK        00:03:00      10-DEC-16      
            BP Key: 147   Status: AVAILABLE  Compressed: YES  Tag: TAG20161210T111827
           Piece Name: +FRA/ora11g/backupset/2016_12_10/nnndf0_tag20161210t111827_0.692.930223111
     List of Datafiles in backup set 142
     File LV Type Ckp SCN    Ckp Time  Name
     ---- -- ---- ---------- --------- ----
     1       Full 5139950    10-DEC-16 +DATA/ora11g/datafile/system.dbf
     2       Full 5139950    10-DEC-16 +DATA/ora11g/datafile/sysaux.dbf
     3       Full 5139950    10-DEC-16 +DATA/ora11g/datafile/undotbs1.dbf
     4       Full 5139950    10-DEC-16 +DATA/ora11g/datafile/users.dbf
     5       Full 5139950    10-DEC-16 +DATA/ora11g/datafile/example.dbf
     6       Full 5139950    10-DEC-16 +DATA/ora11g/datafile/rcat_data_01.dbf
    BS Key  Size       Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
   143     30.00K     DISK        00:00:01     10-DEC-16      
           BP Key: 148   Status: AVAILABLE  Compressed: YES  Tag: TAG20161210T112137
           Piece Name: +FRA/ora11g/backupset/2016_12_10/annnf0_tag20161210t112137_0.688.930223297
     List of Archived Logs in backup set 143
     Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
     ---- ------- ---------- --------- ---------- ---------
     1    5       5139928    10-DEC-16 5140052    10-DEC-16
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    144     Full    10.42M     DISK        00:00:07     10-DEC-16      
            BP Key: 149   Status: AVAILABLE  Compressed: NO  Tag: TAG20161210T112139
            Piece Name: +FRA/ora11g/autobackup/2016_12_10/s_930223299.690.930223303
     SPFILE Included: Modification time: 10-DEC-16
     SPFILE db_unique_name: ORA11G
     Control File Included: Ckp SCN: 5140065      Ckp time: 10-DEC-16
    RMAN> 
   The archive logs location are
   ASMCMD [+fra/ora11g/archivelog] > ls
   2016_12_10/
   2016_12_25/
   2016_12_29/
3. Add the below entry in the /etc/oratab file
    BDUPDB2:/u01/app/oracle/product/11.2.0/dbhome_1:N
4. Create the TNS ENTRY in the tnsnames.ora file
    [loc:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin]
    BDUPDB2 =
      (DESCRIPTION =
         (ADDRESS_LIST =
             (ADDRESS = (PROTOCOL = TCP)(HOST = orcl11g)(PORT = 1521))
      )
      ( CONNECT_DATA =
         (SERVER=DEDICATED)
         (SERVICE_NAME = BDUPDB2)
      )
    )  
5. Edit listener.ora file
    (/u01/app/grid/product/11.2.0/grid/network/admin/listener.ora) 
    Before editing we have to stop listener([grid@orcl11ggrid]$lsnrctl stop) 
    ......
       (SID_DESC =
       (GLOBAL_DBNAME = DUPDB2)
       (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
       (SID_NAME = BDUPDB2)
       )
     )
    .....
    Then start listener ([grid@orcl11g grid]$ lsnrctl start) 
6. Create initBDUPDB2.ora file (created at $ORACLE_HOME/dbs) with following parameters 
     Option 1:
     #####################
      db_name=BDUPDB2
      control_files=('+DATA_DUP','+FRA_DUP')
      ## DB_FILE_NAME_CONVERT=('+DATA','+DATA_DUP')
      LOG_FILE_NAME_CONVERT=('+DATA','+DATA_DUP','+FRA','+FRA_DUP')
      db_recovery_file_dest='+FRA_DUP'
      db_recovery_file_dest_size=10737418240
      db_create_file_dest='+DATA_DUP'
     #####################
     Option 2:
     #####################
       db_name=BDUPDB2
       control_files=('+DATA_DUP','+FRA_DUP')
       #DB_FILE_NAME_CONVERT=('+DATA','+DATA_DUP')
       #LOG_FILE_NAME_CONVERT+('+DATA','+DATA_DUP','+FRA','+FRA_DUP')
       db_recovery_file_dest='+FRA_DUP'
       db_recovery_file_dest_size=10737418240
       db_create_file_dest='+DATA_DUP'
     ##################### 

     The following initBDUPDB2.ora file options will not work with OMF files.
      Option 3: 
      #####################
        db_name=BDUPDB2
        control_files=('+DATA_DUP','+FRA_DUP')
        DB_FILE_NAME_CONVERT=('+DATA','+DATA_DUP')
        LOG_FILE_NAME_CONVERT=('+DATA','+DATA_DUP','+FRA','+FRA_DUP') 
        db_recovery_file_dest='+FRA_DUP'
        db_recovery_file_dest_size=10737418240
        ##db_create_file_dest='+DATA_DUP'
      #####################
      Option 4:
      #####################
        db_name=BDUPDB2
        control_files=('+DATA_DUP','+FRA_DUP')
        ##DB_FILE_NAME_CONVERT=('+DATA','+DATA_DUP')
        LOG_FILE_NAME_CONVERT=('+DATA','+DATA_DUP','+FRA','+FRA_DUP') 
        db_recovery_file_dest='+FRA_DUP'
        db_recovery_file_dest_size=10737418240
        ##db_create_file_dest='+DATA_DUP'
      #####################
      Option 5:
      #####################
        db_name=BDUPDB2
        control_files=('+DATA_DUP','+FRA_DUP')
        DB_FILE_NAME_CONVERT=('+DATA','+DATA_DUP')
        LOG_FILE_NAME_CONVERT=('+DATA','+DATA_DUP','+FRA','+FRA_DUP')
        db_recovery_file_dest='+FRA_DUP'
        db_recovery_file_dest_size=10737418240
        db_create_file_dest='+DATA_DUP'
      #####################
      If we use initBDUPDB2.ora content like in Option 5 then the following warning and error occurred. Some portion from output
      …
      database mounted
      RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.
      contents of Memory Script:
      {
         set until scn  4325803;
         set newname for datafile  1 to "+DATA_DUP/ora11g/datafile/system.dbf";
         set newname for datafile  2 to "+DATA_DUP/ora11g/datafile/sysaux.dbf";
        set newname for datafile  3 to  "+DATA_DUP/ora11g/datafile/undotbs1.dbf";
        set newname for datafile  4 to  "+DATA_DUP/ora11g/datafile/users.dbf";
        set newname for datafile  5 to  "+DATA_DUP/ora11g/datafile/example.dbf";
        set newname for datafile  6 to  "+DATA_DUP/ora11g/datafile/rcat_data_01.dbf";
        restore
        clone database;
     }
    executing Memory Script
    executing command: SET until clause
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME  
    executing command: SET NEWNAME
    executing command: SET NEWNAME
     Starting restore at 05-OCT-16
    using channel ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: starting datafile backup set restore
    channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
    channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA_DUP/ora11g/datafile/system.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00002 to +DATA_DUP/ora11g/datafile/sysaux.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA_DUP/ora11g/datafile/undotbs1.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA_DUP/ora11g/datafile/users.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00005 to +DATA_DUP/ora11g/datafile/example.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00006 to +DATA_DUP/ora11g/datafile/rcat_data_01.dbf
   channel ORA_AUX_DISK_1: reading from backup piece +FRA/ora11g/backupset/2016_10_03/nnndf0_tag20161003t110620_0.748.924260783
    channel ORA_AUX_DISK_1: ORA-19870: error while restoring backup piece
                    +FRA/ora11g/backupset/2016_10_03/nnndf0_tag20161003t110620_0.748.924260783
    ORA-19504: failed to create file "+DATA_DUP/ora11g/datafile/users.dbf"
    ORA-17502: ksfdcre:4 Failed to create file +DATA_DUP/ora11g/datafile/users.dbf
    ORA-15173: entry 'datafile' does not exist in directory 'ora11g' failover to previous backup
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 10/05/2016 16:06:00
    RMAN-05556: not all datafiles have backups that can be recovered to SCN 4325803
    RMAN-03015: error occurred in stored script Memory Script
   RMAN-06026: some targets not found - aborting restore
   RMAN-06023: no backup or copy of datafile 5 found to restore
   RMAN-06023: no backup or copy of datafile 4 found to restore
   RMAN-06023: no backup or copy of datafile 2 found to restore
   RMAN-06023: no backup or copy of datafile 1 found to restore
   RMAN> 
7. Create password file for new database
    [oracle11g@orcl11g Desktop]$ cd $ORACLE_HOME/dbs
        (must change path like $ORACLE_HOME/dbs before creating password file)
    [oracle11g@orcl11g dbs]$ orapwd file=orapwBDUPDB2 entries=5
    or just copy from source like
    [oracle11g@orcl11g~]cp $ORACLE_HOME/dbs/orapwORA11G $ORACLE_HOME/dbs/orapwBDUPDB2
8. Set environment for duplicated database as SID
     [oracle11g@orcl11g oracle]$ . oraenv
     ORACLE_SID = [ora11g] ? BDUPDB2
     The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
9. Start auxiliary database in nomount state.
       [oracle11g@orcl11g~]$ sqlplus / as sysdba
       SQL> startup nomount;
       Oracle instance started
       Total System Global Area     217157632 bytes
       Fixed Size                               2211928 bytes
       Variable Size                         159387560 bytes
       Database Buffers                   50331648 bytes
       Redo Buffers                          5226496 bytes
10. Connect to only auxiliary instance.
       [oracle11g@orcl11g Desktop]$ rman auxiliary=sys/222333@BDUPDB2
       Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jan 6 13:26:37 2017
       Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
       connected to auxiliary database: BDUPDB2 (not mounted)
       RMAN>
11. We have some duplication options here.
       Option 1:
       RMAN> duplicate database to BDUPDB2 noredo
       2> BACKUP LOCATION '+fra/ora11g';
      Starting Duplicate Db at 05-JAN-17
      contents of Memory Script:
      {
          sql clone "create spfile from memory";
      }
     executing Memory Script
     sql statement: create spfile from memory
     contents of Memory Script:
     {
        shutdown clone immediate;
        startup clone nomount; 
     }
     executing Memory Script
    Oracle instance shut down
    connected to auxiliary database (not started)
    Oracle instance started
    Total System Global Area     217157632 bytes
     Fixed Size                     2211928 bytes
    Variable Size                159387560 bytes
    Database Buffers              50331648 bytes
    Redo Buffers                   5226496 bytes
    contents of Memory Script:
    {
       sql clone "alter system set  control_files = 
       ''+DATA_DUP/bdupdb2/controlfile/current.298.932486209'', ''+FRA_DUP/bdupdb2/controlfile/current.318.932486209'' comment=
 ''Set by RMAN'' scope=spfile";
   sql clone "alter system set  db_name = 
 ''ORA11G'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name = 
 ''BDUPDB2'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile from  '+fra/ORA11G/AUTOBACKUP/2016_12_10/s_930223299.690.930223303';
   alter clone database mount;
}
executing Memory Script
sql statement: alter system set  control_files =   ''+DATA_DUP/bdupdb2/controlfile/current.298.932486209'', ''+FRA_DUP/bdupdb2/controlfile/current.318.932486209'' comment= ''Set by RMAN'' scope=spfile
sql statement: alter system set  db_name =  ''ORA11G'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set  db_unique_name =  ''BDUPDB2'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area     217157632 bytes
Fixed Size                     2211928 bytes
Variable Size                159387560 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5226496 bytes
Starting restore at 05-JAN-17
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=96 device type=DISK
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:18
output file name=+DATA_DUP/bdupdb2/controlfile/current.298.932486209
output file name=+FRA_DUP/bdupdb2/controlfile/current.318.932486209
Finished restore at 05-JAN-17
database mounted
released channel: ORA_AUX_DISK_1
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=96 device type=DISK
contents of Memory Script:
{
   set newname for clone datafile  1 to new;
   set newname for clone datafile  2 to new;
   set newname for clone datafile  3 to new;
   set newname for clone datafile  4 to new;
   set newname for clone datafile  5 to new;
   set newname for clone datafile  6 to new;
   restore
   clone database ;
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 05-JAN-17
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA_DUP
channel ORA_AUX_DISK_1: restoring datafile 00002 to +DATA_DUP
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA_DUP
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA_DUP
channel ORA_AUX_DISK_1: restoring datafile 00005 to +DATA_DUP
channel ORA_AUX_DISK_1: restoring datafile 00006 to +DATA_DUP
channel ORA_AUX_DISK_1: reading from backup piece +FRA/ora11g/backupset/2016_12_10/nnndf0_tag20161210t111827_0.692.930223111
channel ORA_AUX_DISK_1: piece handle=+FRA/ora11g/backupset/2016_12_10/nnndf0_tag20161210t111827_0.692.930223111 tag=TAG20161210T111827
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:22:05
Finished restore at 05-JAN-17
contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=932487565 file name=+DATA_DUP/bdupdb2/datafile/system.300.932486243
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=932487565 file name=+DATA_DUP/bdupdb2/datafile/sysaux.301.932486243
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=932487565 file name=+DATA_DUP/bdupdb2/datafile/undotbs1.302.932486243
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=932487565 file name=+DATA_DUP/bdupdb2/datafile/users.299.932486241
datafile 5 switched to datafile copy
input datafile copy RECID=11 STAMP=932487565 file name=+DATA_DUP/bdupdb2/datafile/example.303.932486245
datafile 6 switched to datafile copy
input datafile copy RECID=12 STAMP=932487565 file name=+DATA_DUP/bdupdb2/datafile/rcat_data.304.932486245
contents of Memory Script:
{
   recover
   clone database
   noredo
    delete archivelog ;
}
executing Memory Script
Starting recover at 05-JAN-17
using channel ORA_AUX_DISK_1
Finished recover at 05-JAN-17
contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name = 
 ''BDUPDB2'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area     217157632 bytes
Fixed Size                     2211928 bytes
Variable Size                159387560 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5226496 bytes
sql statement: alter system set  db_name =  ''BDUPDB2'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset  db_unique_name scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area     217157632 bytes
Fixed Size                     2211928 bytes
Variable Size                159387560 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5226496 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "BDUPDB2" RESETLOGS NOARCHIVELOG 
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      584
 LOGFILE
  GROUP  1  SIZE 50 M ,
  GROUP  2  SIZE 50 M ,
  GROUP  3  SIZE 50 M 
 DATAFILE
  '+DATA_DUP/bdupdb2/datafile/system.300.932486243'
 CHARACTER SET AL32UTF8
contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   switch clone tempfile all;
   catalog clone datafilecopy  "+DATA_DUP/bdupdb2/datafile/sysaux.301.932486243", 
 "+DATA_DUP/bdupdb2/datafile/undotbs1.302.932486243", 
 "+DATA_DUP/bdupdb2/datafile/users.299.932486241", 
 "+DATA_DUP/bdupdb2/datafile/example.303.932486245", 
 "+DATA_DUP/bdupdb2/datafile/rcat_data.304.932486245";
   switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME renamed tempfile 1 to +DATA_DUP in control file
cataloged datafile copy
datafile copy file name=+DATA_DUP/bdupdb2/datafile/sysaux.301.932486243 RECID=1 STAMP=932487589
cataloged datafile copy
datafile copy file name=+DATA_DUP/bdupdb2/datafile/undotbs1.302.932486243 RECID=2 STAMP=932487589
cataloged datafile copy
datafile copy file name=+DATA_DUP/bdupdb2/datafile/users.299.932486241 RECID=3 STAMP=932487589
cataloged datafile copy
datafile copy file name=+DATA_DUP/bdupdb2/datafile/example.303.932486245 RECID=4 STAMP=932487589
cataloged datafile copy
datafile copy file name=+DATA_DUP/bdupdb2/datafile/rcat_data.304.932486245 RECID=5 STAMP=932487589
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=932487589 file name=+DATA_DUP/bdupdb2/datafile/sysaux.301.932486243
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=932487589 file name=+DATA_DUP/bdupdb2/datafile/undotbs1.302.932486243
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=932487589 file name=+DATA_DUP/bdupdb2/datafile/users.299.932486241
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=932487589 file name=+DATA_DUP/bdupdb2/datafile/example.303.932486245
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=932487589 file name=+DATA_DUP/bdupdb2/datafile/rcat_data.304.932486245
contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 05-JAN-17

RMAN>
    Option 2:
    We can use only UNTIL TIME clause in - without target connection and recovery catalog connection. 
    Otherwise the following error occurred:
     RMAN> duplicate database to BDUPDB2
     2> until SCN 5284630   
     3> BACKUP LOCATION '+FRA/ORA11G';
    Starting Duplicate Db at 06-JAN-17
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 01/06/2017 11:18:57
    RMAN-05542: Only UNTIL TIME can be used with DUPLICATE without TARGET and CATALOG connections
   
    If we use UNTIL TIME clause then output:
    
    RMAN> duplicate database to BDUPDB2
    2> UNTIL TIME "to_date('01/04/2017 22:04:20', 'MM/DD/YYYY HH24:MI:SS')"
    3> BACKUP LOCATION '+fra/ora11g';
    Starting Duplicate Db at 06-JAN-17
    contents of Memory Script:
    {
       sql clone "create spfile from memory";
    }
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     217157632 bytes

Fixed Size                     2211928 bytes
Variable Size                159387560 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5226496 bytes

contents of Memory Script:
{
   sql clone "alter system set  control_files = 
  ''+DATA_DUP/bdupdb2/controlfile/current.286.932558501'', ''+FRA_DUP/bdupdb2/controlfile/current.284.932558503'' comment=
 ''Set by RMAN'' scope=spfile";
   sql clone "alter system set  db_name = 
 ''ORA11G'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name = 
 ''BDUPDB2'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile from  '+fra/ORA11G/AUTOBACKUP/2016_12_10/s_930223299.690.930223303';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  control_files =   ''+DATA_DUP/bdupdb2/controlfile/current.286.932558501'', ''+FRA_DUP/bdupdb2/controlfile/current.284.932558503'' comment= ''Set by RMAN'' scope=spfile

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area     217157632 bytes

Fixed Size                     2211928 bytes
Variable Size                159387560 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5226496 bytes

Starting restore at 06-JAN-17
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=96 device type=DISK

channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:18
output file name=+DATA_DUP/bdupdb2/controlfile/current.286.932558501
output file name=+FRA_DUP/bdupdb2/controlfile/current.284.932558503
Finished restore at 06-JAN-17

database mounted
released channel: ORA_AUX_DISK_1
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=96 device type=DISK

contents of Memory Script:
{
   set until scn  5139950;
   set newname for clone datafile  1 to new;
   set newname for clone datafile  2 to new;
   set newname for clone datafile  3 to new;
   set newname for clone datafile  4 to new;
   set newname for clone datafile  5 to new;
   set newname for clone datafile  6 to new;
   restore
   clone database
   ;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 06-JAN-17
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA_DUP
channel ORA_AUX_DISK_1: restoring datafile 00002 to +DATA_DUP
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA_DUP
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA_DUP
channel ORA_AUX_DISK_1: restoring datafile 00005 to +DATA_DUP
channel ORA_AUX_DISK_1: restoring datafile 00006 to +DATA_DUP
channel ORA_AUX_DISK_1: reading from backup piece +FRA/ora11g/backupset/2016_12_10/nnndf0_tag20161210t111827_0.692.930223111
channel ORA_AUX_DISK_1: piece handle=+FRA/ora11g/backupset/2016_12_10/nnndf0_tag20161210t111827_0.692.930223111 tag=TAG20161210T111827
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:12:16
Finished restore at 06-JAN-17

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=932559268 file name=+DATA_DUP/bdupdb2/datafile/system.274.932558535
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=932559268 file name=+DATA_DUP/bdupdb2/datafile/sysaux.273.932558535
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=932559268 file name=+DATA_DUP/bdupdb2/datafile/undotbs1.281.932558535
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=932559268 file name=+DATA_DUP/bdupdb2/datafile/users.283.932558533
datafile 5 switched to datafile copy
input datafile copy RECID=11 STAMP=932559268 file name=+DATA_DUP/bdupdb2/datafile/example.279.932558537
datafile 6 switched to datafile copy
input datafile copy RECID=12 STAMP=932559268 file name=+DATA_DUP/bdupdb2/datafile/rcat_data.285.932558537

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name = 
 ''BDUPDB2'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     217157632 bytes

Fixed Size                     2211928 bytes
Variable Size                159387560 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5226496 bytes

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

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     217157632 bytes

Fixed Size                     2211928 bytes
Variable Size                159387560 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5226496 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "BDUPDB2" RESETLOGS ARCHIVELOG 
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      584
 LOGFILE
  GROUP  1  SIZE 50 M ,
  GROUP  2  SIZE 50 M ,
  GROUP  3  SIZE 50 M 
 DATAFILE
  '+DATA_DUP/bdupdb2/datafile/system.274.932558535'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   switch clone tempfile all;
   catalog clone datafilecopy  "+DATA_DUP/bdupdb2/datafile/sysaux.273.932558535", 
 "+DATA_DUP/bdupdb2/datafile/undotbs1.281.932558535", 
 "+DATA_DUP/bdupdb2/datafile/users.283.932558533", 
 "+DATA_DUP/bdupdb2/datafile/example.279.932558537", 
 "+DATA_DUP/bdupdb2/datafile/rcat_data.285.932558537";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to +DATA_DUP in control file

cataloged datafile copy
datafile copy file name=+DATA_DUP/bdupdb2/datafile/sysaux.273.932558535 RECID=1 STAMP=932559294
cataloged datafile copy
datafile copy file name=+DATA_DUP/bdupdb2/datafile/undotbs1.281.932558535 RECID=2 STAMP=932559294
cataloged datafile copy
datafile copy file name=+DATA_DUP/bdupdb2/datafile/users.283.932558533 RECID=3 STAMP=932559294
cataloged datafile copy
datafile copy file name=+DATA_DUP/bdupdb2/datafile/example.279.932558537 RECID=4 STAMP=932559294
cataloged datafile copy
datafile copy file name=+DATA_DUP/bdupdb2/datafile/rcat_data.285.932558537 RECID=5 STAMP=932559294

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=932559294 file name=+DATA_DUP/bdupdb2/datafile/sysaux.273.932558535
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=932559294 file name=+DATA_DUP/bdupdb2/datafile/undotbs1.281.932558535
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=932559294 file name=+DATA_DUP/bdupdb2/datafile/users.283.932558533
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=932559294 file name=+DATA_DUP/bdupdb2/datafile/example.279.932558537
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=932559294 file name=+DATA_DUP/bdupdb2/datafile/rcat_data.285.932558537

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 06-JAN-17

RMAN> 

That's it!!!

No comments:

Post a Comment