Friday, August 27, 2021

Duplicate database in ODA (Source and Target database going to be under the same server)


For this duplicate database testing in ODA , we are going to use source database as MANGO db and duplicate database name as clonedb.

1. Preparation

1.1 gather source database information.

First gather MANGO database details such as
  1. datafile location.
  2. number of redo log files.
  3. db recovery file desk.

Check datafile location:


set lines 800
col file_name for a100
select file_name,bytes/1024/1024 MB ,maxbytes/1024/1024 MB from dba_data_files;

FILE_NAME                                                                                                    MB         MB
---------------------------------------------------------------------------------------------------- ---------- ----------
/u02/app/oracle/oradata/datastore/.ACFS/snaps/mango/MANGO/datafile/o1_mf_system_hplvqsyj_.dbf               700 32767.9844
/u02/app/oracle/oradata/datastore/.ACFS/snaps/mango/MANGO/datafile/o1_mf_sysaux_hplvqz98_.dbf              1530 32767.9844
/u02/app/oracle/oradata/datastore/.ACFS/snaps/mango/MANGO/datafile/o1_mf_undotbs1_hplvr39f_.dbf             460 32767.9844
/u02/app/oracle/oradata/datastore/.ACFS/snaps/mango/MANGO/datafile/o1_mf_undotbs2_hplvrgpc_.dbf             200 32767.9844
/u02/app/oracle/oradata/datastore/.ACFS/snaps/mango/MANGO/datafile/o1_mf_users_hplvrj49_.dbf                  5 32767.9844

check for redo file locations :

SQL> show parameter db_uni

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      mango
set lines 700
col member for a100 
select a.MEMBER,b.BYTES/1024/1024 MB from v$logfile a,v$log b;

  MEMBER                                                                                   MB
-------------------------------------------------------------------------------- ----------
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_1_hplvqqz6_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_1_hplvqqz6_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_1_hplvqqz6_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_1_hplvqqz6_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_2_hplvqrvn_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_2_hplvqrvn_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_2_hplvqrvn_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_2_hplvqrvn_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_3_hplwd0s5_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_3_hplwd0s5_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_3_hplwd0s5_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_3_hplwd0s5_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_4_hplwd1t0_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_4_hplwd1t0_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_4_hplwd1t0_.log          1024
/u01/app/oracle/oradata/datastore/mango/MANGO/onlinelog/o1_mf_4_hplwd1t0_.log          1024

flash recovery desk location:

SQL> show parameter db_rec

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_
                                                 area/datastore/mango

1.2 Backup source database. 

 We need to take backup of source database. If the schedule backup are not there use below mention run block to take a source database backup.

############## Backup source database

RUN
{
  ALLOCATE CHANNEL ch1 TYPE DISK MAXPIECESIZE 5G;
  ALLOCATE CHANNEL ch2 TYPE DISK MAXPIECESIZE 5G;
  BACKUP 
  FORMAT '/db_backup/MANGO_BKP/%d_D_%T_%u_s%s_p%p'
  DATABASE
  CURRENT CONTROLFILE 
  FORMAT '/db_backup/MANGO_BKP/%d_C_%T_%u' 
  SPFILE 
  FORMAT '/db_backup/MANGO_BKP/%d_S_%T_%u' 
  PLUS ARCHIVELOG 
  FORMAT '/db_backup/MANGO_BKP/%d_A_%T_%u_s%s_p%p'; 
  RELEASE CHANNEL ch2;
}
If you want to take separate archivelog backup use below run block.

############### archive backup 

run 
{ 
allocate channel c1 type disk format '/db_backup/MANGO_BKP/arc_%U'; 
BACKUP ARCHIVELOG ALL TAG ARCH;
} 



########### create directory for duplicate

oakcli create dbstorage -db CLONEDB

[root@ecl-odabase-0 ~]# oakcli create dbstorage -db CLONEDB
INFO: 2021-08-20 13:20:17: Please check the logfile  '/opt/oracle/oak/log/ecl-odabase-0/tools/18.8.0.0.0/createdbstorage_CLONEDB_20796.log' for more details
INFO: 2021-08-20 13:20:38: Storage for the Database with the name CLONEDB is possible

Please enter the 'SYSASM'  password : (During deployment we set the SYSASM password to 'welcome1'):
Please re-enter the 'SYSASM' password:
Please select one of the following for Database Class  [1 .. 6] :
1    => odb-01s  (   1 cores ,     4 GB memory)
2    =>  odb-01  (   1 cores ,     8 GB memory)
3    =>  odb-02  (   2 cores ,    16 GB memory)
4    =>  odb-04  (   4 cores ,    32 GB memory)
5    =>  odb-06  (   6 cores ,    48 GB memory)
6    =>  odb-12  (  12 cores ,    96 GB memory)
1
The selected value is : odb-01s  (   1 cores ,     4 GB memory)

...SUCCESS: Ran /usr/bin/rsync -tarqvz /opt/oracle/oak/onecmd/ root@192.168.16.28:/opt/oracle/oak/onecmd --exclude=*zip --exclude=*gz --exclude=*log --exclude=*trc --exclude=*rpm and it returned: RC=0

.........
SUCCESS: All nodes in /opt/oracle/oak/onecmd/tmp/db_nodes are pingable and alive.


INFO: 2021-08-20 13:23:33: Successfully setup the storage structure for the database 'CLONEDB'
INFO: 2021-08-20 13:23:36: Set the following directory structure for the Database CLONEDB
INFO: 2021-08-20 13:23:36: DATA: /u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB
INFO: 2021-08-20 13:23:36: REDO: /u01/app/oracle/oradata/datastore/CLONEDB
INFO: 2021-08-20 13:23:36: RECO: /u01/app/oracle/fast_recovery_area/datastore/CLONEDB
SUCCESS: 2021-08-20 13:23:36: Successfully setup the Storage for the Database : CLONED

After creating make sure to verify the created storage mount points


[root@ecl-odabase-0 ~]# oakcli show dbstorage

All the DBs with DB TYPE as non-CDB share the same volumes

DB_NAMES           DB_TYPE    Filesystem                                        Size     Used    Available    AutoExtend Size  DiskGroup
-------            -------    ------------                                    ------    -----    ---------   ----------------   --------
mango              non-CDB    /u02/app/oracle/oradata/datastore                 3665G     2.98G    3662.02G             N/A          DATA
                              /u02/app/oracle/oradata/flashdata                  279G   144.88G     134.12G             N/A          FLASH
                              /u01/app/oracle/oradata/datastore                   60G     4.30G      55.70G             N/A          REDO

                              /u01/app/oracle/fast_recovery_area/datastore      4874G    40.63G    4833.37G             N/A          RECO

cdbdev             CDB        /u02/app/oracle/oradata/datcdbdev                  400G    26.65G     373.35G             40G          DATA
                              /u01/app/oracle/oradata/rdocdbdev                    6G     4.21G       1.79G              1G          REDO
                              /u01/app/oracle/fast_recovery_area/rcocdbdev       530G    45.87G     484.13G             53G          RECO

[root@ecl-odabase-0 ~]#

1.4 If there are existing clone database.

If there are already existing clone database make sure to drop the database before duplicate.


#################### drop previous  database

##### Method 1

startup mount exclusive restrict;

##### Method 2

SQL> startup nomount pfile='/home/oracle/DUP_SCRIPTS/initCLONEDB.ora' restrict;
ORACLE instance started.

Total System Global Area  876609536 bytes
Fixed Size                  2930224 bytes
Variable Size             763365840 bytes
Database Buffers          100663296 bytes
Redo Buffers                9650176 bytes
SQL> alter database mount;

Database altered.

SQL> drop database;

Database dropped.

2. Duplicate source database 

MANGO to target database : clonedb

2.1 create duplicate run block. 

This scenario we are performing backup base duplicate.

################# run block
RUN {
ALLOCATE AUXILIARY CHANNEL T1 TYPE DISK;
ALLOCATE AUXILIARY CHANNEL T2 TYPE DISK;
ALLOCATE AUXILIARY CHANNEL T3 TYPE DISK;
ALLOCATE AUXILIARY CHANNEL T4 TYPE DISK;
ALLOCATE AUXILIARY CHANNEL T5 TYPE DISK;
DUPLICATE DATABASE MANGO TO CLONEDB
backup location '/db_backup/MANGO_BKP'
UNTIL TIME "TO_DATE('2021-08-20 13:41:00', 'YYYY-MM-DD HH24:MI:SS')";
}
 

################# rman_duplicate.sh script
export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_2
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=clonedb1
rman auxiliary \/ cmdfile=/home/oracle/DUP_SCRIPTS/CLONEDB.cmd log=/home/oracle/DUP_SCRIPTS/CLONEDB_20082021.log

2.2 Init file parameter for auxiliary instance.

Note : do not use db_file_name_convert and log_file_name_covert for this ODA duplicate. because database using OMF.

Link to understand the parameters and why we should not use above mention parameters.

Creating a Duplicate Database on a Local or Remote Host (stanford.edu)

init file parameters:

 ########## init file parameters for ODA

[oracle@ecl-odabase-0 DUP_SCRIPTS]$ cat initCLONEDB.ora
control_files='/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/control01.ctl'
db_name='clonedb'
log_archive_dest_1='location=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB'
*.compatible='12.1.0.2.0'
db_create_file_dest='/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB'
db_create_online_log_dest_1='/u01/app/oracle/oradata/datastore/CLONEDB'
[oracle@ecl-odabase-0 DUP_SCRIPTS]$

2.3 Startup database in nomount state. 


start the database using pfile.

startup nomount pfile='/home/oracle/DUP_SCRIPTS/initCLONEDB.ora'
After creating spfile run the rman_duplicate.sh script in nohup mode and tail the log. 

Please find the complete logfile for detail for verification.

[oracle@ecl-odabase-0 DUP_SCRIPTS]$ cat CLONEDB_20082021.log

Recovery Manager: Release 12.1.0.2.0 - Production on Mon Aug 23 12:50:08 2021

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

connected to auxiliary database: CLONEDB (not mounted)

RMAN> RUN {
2> ALLOCATE AUXILIARY CHANNEL T1 TYPE DISK;
3> ALLOCATE AUXILIARY CHANNEL T2 TYPE DISK;
4> ALLOCATE AUXILIARY CHANNEL T3 TYPE DISK;
5> ALLOCATE AUXILIARY CHANNEL T4 TYPE DISK;
6> ALLOCATE AUXILIARY CHANNEL T5 TYPE DISK;
7> DUPLICATE DATABASE MANGO TO CLONEDB
8> backup location '/db_backup/MANGO_BKP'
9> UNTIL TIME "TO_DATE('2021-08-20 13:41:00', 'YYYY-MM-DD HH24:MI:SS')";
10> }
11>
12>
allocated channel: T1
channel T1: SID=994 device type=DISK

allocated channel: T2
channel T2: SID=1242 device type=DISK

allocated channel: T3
channel T3: SID=1366 device type=DISK

allocated channel: T4
channel T4: SID=1490 device type=DISK

allocated channel: T5
channel T5: SID=1614 device type=DISK

Starting Duplicate Db at 23-AUG-21

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

Fixed Size                     2930224 bytes
Variable Size                763365840 bytes
Database Buffers             100663296 bytes
Redo Buffers                   9650176 bytes
allocated channel: T1
channel T1: SID=1118 device type=DISK
allocated channel: T2
channel T2: SID=1242 device type=DISK
allocated channel: T3
channel T3: SID=1366 device type=DISK
allocated channel: T4
channel T4: SID=1490 device type=DISK
allocated channel: T5
channel T5: SID=1614 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''MANGO'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''CLONEDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile from  '/db_backup/MANGO_BKP/MANGO_C_20210820_0706vuu7';
   alter clone database mount;
}
executing Memory Script

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area     876609536 bytes

Fixed Size                     2930224 bytes
Variable Size                763365840 bytes
Database Buffers             100663296 bytes
Redo Buffers                   9650176 bytes
allocated channel: T1
channel T1: SID=1118 device type=DISK
allocated channel: T2
channel T2: SID=1242 device type=DISK
allocated channel: T3
channel T3: SID=1366 device type=DISK
allocated channel: T4
channel T4: SID=1490 device type=DISK
allocated channel: T5
channel T5: SID=1614 device type=DISK

Starting restore at 23-AUG-21

channel T3: skipped, AUTOBACKUP already found
channel T4: skipped, AUTOBACKUP already found
channel T1: skipped, AUTOBACKUP already found
channel T5: skipped, AUTOBACKUP already found
channel T2: restoring control file
channel T2: restore complete, elapsed time: 00:00:09
output file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/control01.ctl
Finished restore at 23-AUG-21

database mounted

contents of Memory Script:
{
   set until scn  12935274;
   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;
   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

Starting restore at 23-AUG-21

channel T1: starting datafile backup set restore
channel T1: specifying datafile(s) to restore from backup set
channel T1: restoring datafile 00001 to /u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_system_%u_.dbf
channel T1: restoring datafile 00003 to /u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_undotbs1_%u_.dbf
channel T1: restoring datafile 00004 to /u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_undotbs2_%u_.dbf
channel T1: reading from backup piece /db_backup/MANGO_BKP/MANGO_D_20210820_0506vutt_s5_p1
channel T2: starting datafile backup set restore
channel T2: specifying datafile(s) to restore from backup set
channel T2: restoring datafile 00002 to /u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_sysaux_%u_.dbf
channel T2: restoring datafile 00005 to /u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_users_%u_.dbf
channel T2: reading from backup piece /db_backup/MANGO_BKP/MANGO_D_20210820_0406vutt_s4_p1
channel T1: piece handle=/db_backup/MANGO_BKP/MANGO_D_20210820_0506vutt_s5_p1 tag=TAG20210820T121244
channel T1: restored backup piece 1
channel T1: restore complete, elapsed time: 00:00:07
channel T2: piece handle=/db_backup/MANGO_BKP/MANGO_D_20210820_0406vutt_s4_p1 tag=TAG20210820T121244
channel T2: restored backup piece 1
channel T2: restore complete, elapsed time: 00:00:07
Finished restore at 23-AUG-21

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

datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=1081342289 file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_system_jl7njb4r_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=7 STAMP=1081342289 file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_sysaux_jl7njb4t_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=8 STAMP=1081342289 file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_undotbs1_jl7njb85_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=9 STAMP=1081342289 file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_undotbs2_jl7njbbz_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=10 STAMP=1081342289 file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_users_jl7njb7l_.dbf

contents of Memory Script:
{
   set until time  "to_date('AUG 20 2021 13:41:00', 'MON DD YYYY HH24:MI:SS')";
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 23-AUG-21

starting media recovery

channel T1: starting archived log restore to default destination
channel T1: restoring archived log
archived log thread=1 sequence=65
channel T1: restoring archived log
archived log thread=2 sequence=46
channel T1: restoring archived log
archived log thread=1 sequence=66
channel T1: restoring archived log
archived log thread=1 sequence=67
channel T1: restoring archived log
archived log thread=2 sequence=47
channel T1: restoring archived log
archived log thread=1 sequence=68
channel T1: restoring archived log
archived log thread=2 sequence=48
channel T1: restoring archived log
archived log thread=1 sequence=69
channel T1: restoring archived log
archived log thread=2 sequence=49
channel T1: restoring archived log
archived log thread=2 sequence=50
channel T1: restoring archived log
archived log thread=1 sequence=70
channel T1: restoring archived log
archived log thread=1 sequence=71
channel T1: reading from backup piece /db_backup/MANGO_BKP/arc_0e07048e_1_1
channel T2: starting archived log restore to default destination
channel T2: restoring archived log
archived log thread=2 sequence=45
channel T2: reading from backup piece /db_backup/MANGO_BKP/MANGO_A_20210820_0b06vuv0_s11_p1
channel T2: piece handle=/db_backup/MANGO_BKP/MANGO_A_20210820_0b06vuv0_s11_p1 tag=TAG20210820T121320
channel T2: restored backup piece 1
channel T2: restore complete, elapsed time: 00:00:01
channel T1: piece handle=/db_backup/MANGO_BKP/arc_0e07048e_1_1 tag=ARCH
channel T1: restored backup piece 1
channel T1: restore complete, elapsed time: 00:00:03
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_65_1051745212.dbf thread=1 sequence=65
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_45_1051745212.dbf thread=2 sequence=45
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_45_1051745212.dbf RECID=1 STAMP=1081342292
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_46_1051745212.dbf thread=2 sequence=46
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_65_1051745212.dbf RECID=4 STAMP=1081342293
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_66_1051745212.dbf thread=1 sequence=66
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_66_1051745212.dbf RECID=10 STAMP=1081342293
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_67_1051745212.dbf thread=1 sequence=67
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_46_1051745212.dbf RECID=2 STAMP=1081342293
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_47_1051745212.dbf thread=2 sequence=47
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_67_1051745212.dbf RECID=5 STAMP=1081342293
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_68_1051745212.dbf thread=1 sequence=68
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_47_1051745212.dbf RECID=3 STAMP=1081342293
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_48_1051745212.dbf thread=2 sequence=48
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_68_1051745212.dbf RECID=7 STAMP=1081342293
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_69_1051745212.dbf thread=1 sequence=69
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_48_1051745212.dbf RECID=6 STAMP=1081342293
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_49_1051745212.dbf thread=2 sequence=49
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_49_1051745212.dbf RECID=9 STAMP=1081342293
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_50_1051745212.dbf thread=2 sequence=50
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_69_1051745212.dbf RECID=8 STAMP=1081342293
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_70_1051745212.dbf thread=1 sequence=70
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_70_1051745212.dbf RECID=12 STAMP=1081342293
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_71_1051745212.dbf thread=1 sequence=71
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch1_71_1051745212.dbf RECID=13 STAMP=1081342293
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/12.1.0.2/dbhome_2/dbs/arch2_50_1051745212.dbf RECID=11 STAMP=1081342293
media recovery complete, elapsed time: 00:00:11
Finished recover at 23-AUG-21
Oracle instance started

Total System Global Area     876609536 bytes

Fixed Size                     2930224 bytes
Variable Size                763365840 bytes
Database Buffers             100663296 bytes
Redo Buffers                   9650176 bytes

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

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

sql statement: alter system reset  db_unique_name scope=spfile
Oracle instance started

Total System Global Area     876609536 bytes

Fixed Size                     2930224 bytes
Variable Size                763365840 bytes
Database Buffers             100663296 bytes
Redo Buffers                   9650176 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CLONEDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES    192
  MAXLOGMEMBERS      3
  MAXDATAFILES     1024
  MAXINSTANCES    32
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1  SIZE 1 G ,
  GROUP   2  SIZE 1 G
 DATAFILE
  '/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_system_jl7njb4r_.dbf'
 CHARACTER SET AL32UTF8

sql statement: ALTER DATABASE ADD LOGFILE

  INSTANCE 'i2'
  GROUP   3  SIZE 1 G ,
  GROUP   4  SIZE 1 G

contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   switch clone tempfile all;
   catalog clone datafilecopy  "/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_sysaux_jl7njb4t_.dbf",
 "/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_undotbs1_jl7njb85_.dbf",
 "/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_undotbs2_jl7njbbz_.dbf",
 "/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_users_jl7njb7l_.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_temp_%u_.tmp in control file

cataloged datafile copy
datafile copy file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_sysaux_jl7njb4t_.dbf RECID=1 STAMP=1081342341
cataloged datafile copy
datafile copy file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_undotbs1_jl7njb85_.dbf RECID=2 STAMP=1081342341
cataloged datafile copy
datafile copy file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_undotbs2_jl7njbbz_.dbf RECID=3 STAMP=1081342341
cataloged datafile copy
datafile copy file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_users_jl7njb7l_.dbf RECID=4 STAMP=1081342341

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=1081342341 file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_sysaux_jl7njb4t_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=1081342341 file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_undotbs1_jl7njb85_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=1081342341 file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_undotbs2_jl7njbbz_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=1081342341 file name=/u02/app/oracle/oradata/datastore/.ACFS/snaps/CLONEDB/CLONEDB/datafile/o1_mf_users_jl7njb7l_.dbf

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

database opened
Cannot remove created server parameter file
Finished Duplicate Db at 23-AUG-21

Recovery Manager complete.


3. Verification.
Once the duplicate is complete you can run oakcli show databases to verify the database status.



[root@ecl-odabase-0 ~]# oakcli show databases
Name     Type       Storage   HomeName             HomeLocation                                       Edition Type Version
-----    ------     --------  --------------       ----------------                                   ------------ ----------
willow   RAC        ACFS      OraDb12102_home1     /u01/app/oracle/product/12.1.0.2/dbhome_1          Enterprise   12.1.0.2.191015
mango    RAC        ACFS      OraDb12102_home2     /u01/app/oracle/product/12.1.0.2/dbhome_2          Enterprise   12.1.0.2.191015
CDBDEV   RAC        ACFS      OraDb12102_home2     /u01/app/oracle/product/12.1.0.2/dbhome_2          Enterprise   12.1.0.2.191015
clonedb  RAC        ACFS      OraDb12102_home2     /u01/app/oracle/product/12.1.0.2/dbhome_2          Enterprise   12.1.0.2.191015
[root@ecl-odabase-0 ~]#

Also check the database status using below mention query. set lines 300 select instance_name,status,HOST_NAME,to_char(startup_time,'dd/mm/yyyy hh24:mi') startup_time from gv$instance;


INSTANCE_NAME    STATUS       HOST_NAME                                                        STARTUP_TIME
---------------- ------------ ---------------------------------------------------------------- ----------------
clonedb1         OPEN         ecl-odabase-0                                                    13/09/2021 14:42
clonedb2         OPEN         ecl-odabase-1                                                    13/09/2021 14:45


1 comment:

Unified Auditing Housekeeping

  Intro  Data is the new currency. It is one of the most valuable organizational assets, however, if that data is not well...