Backup source database Track

[oracle@oel6-node02 dbs]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue May 12 18:01:45 2020

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

connected to target database: TRACK (DBID=2191372520)

RMAN>  backup database plus archivelog ;


Starting backup at 12-MAY-20
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=57 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=3 RECID=1 STAMP=1040213278
input archived log thread=1 sequence=4 RECID=2 STAMP=1040213279
input archived log thread=1 sequence=5 RECID=3 STAMP=1040213374
input archived log thread=1 sequence=6 RECID=4 STAMP=1040213375
input archived log thread=1 sequence=7 RECID=5 STAMP=1040222009
input archived log thread=1 sequence=8 RECID=6 STAMP=1040233835
input archived log thread=1 sequence=9 RECID=7 STAMP=1040234511
channel ORA_DISK_1: starting piece 1 at 12-MAY-20
channel ORA_DISK_1: finished piece 1 at 12-MAY-20
piece handle=/u01/app/oracle/fast_recovery_area/TRACK/backupset/2020_05_12/o1_mf_annnn_TAG20200512T180152_hco5srdq_.bkp tag=TAG20200512T180152 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-MAY-20

Starting backup at 12-MAY-20
using channel ORA_DISK_1
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=/u01/app/oracle/oradata/TRACK/datafile/o1_mf_system_hcnf8ptv_.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/TRACK/datafile/o1_mf_sysaux_hcnf8pw8_.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/TRACK/datafile/o1_mf_example_hcnfc8nr_.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/TRACK/datafile/o1_mf_goldenga_hcnnpypf_.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/TRACK/datafile/o1_mf_undotbs1_hcnf8pwk_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/TRACK/datafile/o1_mf_users_hcnf8px3_.dbf
channel ORA_DISK_1: starting piece 1 at 12-MAY-20
channel ORA_DISK_1: finished piece 1 at 12-MAY-20
piece handle=/u01/app/oracle/fast_recovery_area/TRACK/backupset/2020_05_12/o1_mf_nnndf_TAG20200512T180153_hco5ssr7_.bkp tag=TAG20200512T180153 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
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 12-MAY-20
channel ORA_DISK_1: finished piece 1 at 12-MAY-20
piece handle=/u01/app/oracle/fast_recovery_area/TRACK/backupset/2020_05_12/o1_mf_ncsnf_TAG20200512T180153_hco5tzxh_.bkp tag=TAG20200512T180153 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 12-MAY-20

Starting backup at 12-MAY-20
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=10 RECID=8 STAMP=1040234553
channel ORA_DISK_1: starting piece 1 at 12-MAY-20
channel ORA_DISK_1: finished piece 1 at 12-MAY-20
piece handle=/u01/app/oracle/fast_recovery_area/TRACK/backupset/2020_05_12/o1_mf_annnn_TAG20200512T180233_hco5v1q6_.bkp tag=TAG20200512T180233 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-MAY-20

RMAN>

Capture the SCN

RMAN> restore database preview summary;

Starting restore at 12-MAY-20
using channel ORA_DISK_1


List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
2       B  F  A DISK        12-MAY-20       1       1       NO         TAG20200512T180153

List of Archived Log Copies for database with db_unique_name TRACK
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - ---------
8       1    10      A 12-MAY-20
        Name: /u01/app/oracle/fast_recovery_area/TRACK/archivelog/2020_05_12/o1_mf_1_10_hco5v1mx_.arc

Media recovery start SCN is 1077765
Recovery must be done beyond SCN 1077774 to clear datafile fuzziness
Finished restore at 12-MAY-20

Copy the Rman files to same location in target

[oracle@oel6-node02 2020_05_12]$ pwd
/u01/app/oracle/fast_recovery_area/TRACK/backupset/2020_05_12
[oracle@oel6-node02 2020_05_12]$
[oracle@oel6-node02 2020_05_12]$ scp * oel6-node03:/u01/app/oracle/fast_recovery_area/TRACK/backupset/2020_05_12
oracle@oel6-node03's password:
o1_mf_annnn_TAG20200512T180152_hco5srdq_.bkp                                                                                                               100%   44MB  44.0MB/s   00:00
o1_mf_annnn_TAG20200512T180233_hco5v1q6_.bkp                                                                                                               100%   28KB  28.0KB/s   00:00
o1_mf_ncsnf_TAG20200512T180153_hco5tzxh_.bkp                                                                                                               100% 9600KB   9.4MB/s   00:00
o1_mf_nnndf_TAG20200512T180153_hco5ssr7_.bkp                                                                                                               100% 1057MB  37.8MB/s   00:28

copy snapshot control file

[oracle@oel6-node02 2020_05_12]$ pwd
/u01/app/oracle/fast_recovery_area/TRACK/backupset/2020_05_12
[oracle@oel6-node02 2020_05_12]$ scp /u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_track.f oel6-node03:/u01/app/oracle/product/11.2.0/db_1/dbs
oracle@oel6-node03's password:
snapcf_track.f                                                                                                                                             100% 9520KB   9.3MB/s   00:00

create temporary pfile

*.db_name='solar'
*.db_block_size=8192
*.remote_login_passwordfile='exclusive'
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=5G
*.compatible='11.2.0.0.0'

Run rman command using until SCN

SQL> startup nomount pfile=/u01/app/oracle/product/11.2.0/db_1/dbs/initsolar.ora
ORACLE instance started.

Total System Global Area  238034944 bytes
Fixed Size                  2227136 bytes
Variable Size             180356160 bytes
Database Buffers           50331648 bytes
Redo Buffers                5120000 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@oel6-node03 dbs]$ rman target sys/oracle@track auxiliary /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue May 12 20:06:57 2020

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

connected to target database: TRACK (DBID=2191372520)
connected to auxiliary database: SOLAR (not mounted)

RMAN> duplicate target database to solar nofilenamecheck until scn 1077774  ;

Starting Duplicate Db at 2020-05-12 20:07:41
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

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     238034944 bytes

Fixed Size                     2227136 bytes
Variable Size                180356160 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5120000 bytes

contents of Memory Script:
{
   set until scn  1077774;
   sql clone "alter system set  control_files =
  ''/u01/app/oracle/oradata/SOLAR/controlfile/o1_mf_hcof5vxl_.ctl'', ''/u01/app/oracle/fast_recovery_area/SOLAR/controlfile/o1_mf_hcof5vxy_.ctl'' comment=
 ''Set by RMAN'' scope=spfile";
   sql clone "alter system set  db_name =
 ''TRACK'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''SOLAR'' 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

executing command: SET until clause

sql statement: alter system set  control_files =   ''/u01/app/oracle/oradata/SOLAR/controlfile/o1_mf_hcof5vxl_.ctl'', ''/u01/app/oracle/fast_recovery_area/SOLAR/controlfile/o1_mf_hcof5vxy_.ctl'' comment= ''Set by RMAN'' scope=spfile

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area     238034944 bytes

Fixed Size                     2227136 bytes
Variable Size                180356160 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5120000 bytes

Starting restore at 2020-05-12 20:07:55
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: copied control file copy
input file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_track.f
output file name=/u01/app/oracle/oradata/SOLAR/controlfile/o1_mf_hcof5vxl_.ctl
output file name=/u01/app/oracle/fast_recovery_area/SOLAR/controlfile/o1_mf_hcof5vxy_.ctl
Finished restore at 2020-05-12 20:07:56

database mounted

contents of Memory Script:
{
   set until scn  1077774;
   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 2020-05-12 20:08:01
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 /u01/app/oracle/oradata/SOLAR/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/SOLAR/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/SOLAR/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/SOLAR/datafile/o1_mf_users_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/SOLAR/datafile/o1_mf_example_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/SOLAR/datafile/o1_mf_goldenga_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/TRACK/backupset/2020_05_12/o1_mf_nnndf_TAG20200512T180153_hco5ssr7_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/TRACK/backupset/2020_05_12/o1_mf_nnndf_TAG20200512T180153_hco5ssr7_.bkp tag=TAG20200512T180153
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 2020-05-12 20:08:36

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

datafile 1 switched to datafile copy
input datafile copy RECID=9 STAMP=1040242116 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_system_hcof69ty_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=10 STAMP=1040242116 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_sysaux_hcof69vc_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=11 STAMP=1040242116 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_undotbs1_hcof69wd_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=12 STAMP=1040242117 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_users_hcof69ws_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=13 STAMP=1040242117 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_example_hcof69vl_.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=14 STAMP=1040242117 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_goldenga_hcof69w4_.dbf
Oracle instance started

Total System Global Area     238034944 bytes

Fixed Size                     2227136 bytes
Variable Size                180356160 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5120000 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''SOLAR'' 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

sql statement: alter system set  db_name =  ''SOLAR'' 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     238034944 bytes

Fixed Size                     2227136 bytes
Variable Size                180356160 bytes
Database Buffers              50331648 bytes
Redo Buffers                   5120000 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "SOLAR" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1  SIZE 50 M ,
  GROUP   2  SIZE 50 M ,
  GROUP   3  SIZE 50 M
 DATAFILE
  '/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_system_hcof69ty_.dbf'
 CHARACTER SET WE8MSWIN1252


contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   switch clone tempfile all;
   catalog clone datafilecopy  "/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_sysaux_hcof69vc_.dbf",
 "/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_undotbs1_hcof69wd_.dbf",
 "/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_users_hcof69ws_.dbf",
 "/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_example_hcof69vl_.dbf",
 "/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_goldenga_hcof69w4_.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/SOLAR/datafile/o1_mf_temp_%u_.tmp in control file

cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_sysaux_hcof69vc_.dbf RECID=1 STAMP=1040242128
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_undotbs1_hcof69wd_.dbf RECID=2 STAMP=1040242128
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_users_hcof69ws_.dbf RECID=3 STAMP=1040242128
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_example_hcof69vl_.dbf RECID=4 STAMP=1040242128
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_goldenga_hcof69w4_.dbf RECID=5 STAMP=1040242128

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=1040242128 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_sysaux_hcof69vc_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=1040242128 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_undotbs1_hcof69wd_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=1040242128 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_users_hcof69ws_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=1040242128 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_example_hcof69vl_.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=1040242128 file name=/u01/app/oracle/oradata/SOLAR/datafile/o1_mf_goldenga_hcof69w4_.dbf
Reenabling controlfile options for auxiliary database
Executing: alter database add supplemental log data
Executing: alter database force logging

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

database opened
Finished Duplicate Db at 2020-05-12 20:09:01

RMAN> exit


Recovery Manager complete.

Check database status

SQL> select name,open_mode,host_name from v$database,v$instance;


NAME                        OPEN_MODE                                                    HOST_NAME
--------------------------- ------------------------------------------------------------ ------------------------------
SOLAR                       READ WRITE                                                   oel6-node03.localdomain

SQL> SQL> sho parameter pfile

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
spfile                               string                            /u01/app/oracle/product/11.2.0
                                                                       /db_1/dbs/spfilesolar.ora

Spfile is not present

SQL> !ls -ltr /u01/app/oracle/product/11.2.0/db_1/dbs/spfilesolar.ora
ls: cannot access /u01/app/oracle/product/11.2.0/db_1/dbs/spfilesolar.ora: No such file or directory

to fix this

SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

Add control file details in the temporary pfile used in above step. Name of the control files can be found in rman duplicate log

from duplicate log

output file name=/u01/app/oracle/oradata/SOLAR/controlfile/o1_mf_hcof5vxl_.ctl
output file name=/u01/app/oracle/fast_recovery_area/SOLAR/controlfile/o1_mf_hcof5vxy_.ctl

edit the pfile

[oracle@oel6-node03 dbs]$ cat /u01/app/oracle/product/11.2.0/db_1/dbs/initsolar.ora
*.db_name='solar'
*.db_block_size=8192
*.remote_login_passwordfile='exclusive'
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=5G
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/SOLAR/controlfile/o1_mf_hcof5vxl_.ctl','/u01/app/oracle/fast_recovery_area/SOLAR/controlfile/o1_mf_hcof5vxy_.ctl'

create spfile and restart the database

SQL> create spfile from pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initsolar.ora';

File created.

SQL> startup
ORACLE instance started.

Total System Global Area  238034944 bytes
Fixed Size                  2227136 bytes
Variable Size             180356160 bytes
Database Buffers           50331648 bytes
Redo Buffers                5120000 bytes
Database mounted.
Database opened.
SQL> shu immediate
startup
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
ORACLE instance started.

Total System Global Area  238034944 bytes
Fixed Size                  2227136 bytes
Variable Size             180356160 bytes
Database Buffers           50331648 bytes
Redo Buffers                5120000 bytes
Database mounted.
Database opened.