Monday, January 22, 2018

RAC Database Cloning with RMAN

RMAN RAC Database Cloning.


Hai, this article helps those like to clone the Oracle RAC database.
for RAC to RAC DB Clone Click Here RAC - RAC Clone
Assumptions:


RAC-1
RAC-3
Host IP
192.168.1.11
192.168.1.13
SID
DELL
CDELL
PORT
1521
1522

Source Machine & RAC Database Details:


How to check master node in RAC Cluster Ware:
[root@rac1 ~]#
[root@rac1 ~]# olsnodes
rac1
rac2
[root@rac1 ~]#
[root@rac1 ~]# cat /u01/app/grid_home/log/rac1/crsd/crsd.log | grep 'OCR MASTER' | tail -1
2018-01-18 11:27:20.201: [  OCRMAS][1223633216]th_master:12: I AM THE NEW OCR MASTER at incar 1. Node Number 1
[root@rac1 ~]#
[root@rac2 ~]# cat /u01/app/grid_home/log/rac2/crsd/crsd.log | grep 'OCR MASTER' | tail -1
2018-01-18 11:27:25.170: [  OCRMAS][1220979008]th_master: NEW OCR MASTER IS 1
[root@rac2 ~]#
[root@rac1 ~]#
[root@rac1 ~]# hostname
rac1.dell.com
[root@rac1 ~]#
[root@rac1 ~]# hostname -i
192.168.1.11
[root@rac1 ~]#
[root@rac1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
##-- Public-IP
192.168.1.11    rac1.dell.com   rac1
192.168.1.12    rac2.dell.com   rac2
192.168.1.13    rac3.dell.com   rac3
##-- Private-IP
10.0.0.11 rac1-priv.dell.com rac1-priv
10.0.0.12 rac2-priv.dell.com rac2-priv
10.0.0.13 rac3-priv.dell.com rac3-priv
##-- Virtual-IP
192.168.1.21 rac1-vip.dell.com rac1-vip
192.168.1.22 rac2-vip.dell.com rac2-vip
192.168.1.23 rac3-vip.dell.com rac3-vip
##-- SCAN IP
192.168.1.30 dellc-scan.dell.com dellc-scan
192.168.1.31 dellc-scan.dell.com dellc-scan
192.168.1.32 dellc-scan.dell.com dellc-scan
##-- Storage-IP
192.168.1.40    san.dell.com    san


[oracle@rac1 ~]$
[oracle@rac1 ~]$ 
[oracle@rac1 ~]$ cat dell.env
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=DELL1
TNS_ADMIN=$ORACLE_HOME/network/admin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib/usr/lib; export LD_LIBRARY_PATH


[oracle@rac1 ~]$
[oracle@rac1 ~]$ . dell.env

[oracle@rac1 ~]$
[oracle@rac1 ~]$ srvctl config database
DELL
[oracle@rac1 ~]$
[oracle@rac1 ~]$ srvctl status database -d DELL
Instance DELL1 is running on node rac1
Instance DELL2 is running on node rac2
[oracle@rac1 ~]$
[oracle@rac1 ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): rac1,rac2
[oracle@rac1 ~]$
[oracle@rac1 ~]$ srvctl config scan
SCAN name: dellc-scan, Network: 1/192.168.1.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /dellc-scan.dell.com/192.168.1.30
[oracle@rac1 ~]$
[oracle@rac1 ~]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node rac1
[oracle@rac1 ~]$
[oracle@rac1 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node rac1
[oracle@rac1 ~]$
[oracle@rac1 ~]$

Tns parameter of Source(RAC-1,2), use the same entries for target(RAC-3) also: 
[oracle@rac1 ~]$ 
[oracle@rac1 ~]$ cat $TNS_ADMIN/tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

DELL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dellc-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DELL)
    )
  )

CDELL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac3.dell.com)(PORT = 1522))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = CDELL)
    )
  )



[oracle@rac1 ~]$ ls $TNS_ADMIN
orapwDELL1  samples  shrept.lst  tnsnames1801184PM1359.bak  tnsnames.ora

[oracle@rac1 ~]$
[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 21 09:12:34 2018

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL>
SQL>
SQL> select instance_name,status from gv$instance;

INSTANCE_NAME    STATUS
---------------- ------------
DELL2            OPEN
DELL1            OPEN


SQL>
SQL> select name,CREATED, CONTROLFILE_TYPE from v$database;

NAME      CREATED   CONTROL
--------- --------- -------
DELL      18-JAN-18 CURRENT

SQL>
SQL> show parameter cluster

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cluster_database                     boolean     TRUE
cluster_database_instances           integer     2
cluster_interconnects                string

SQL>
SQL>

C-R-D file Locations & Archive log status:
SQL> 
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA/dell/control01.ctl
+DATA/dell/control02.ctl

SQL>
SQL> col member for a30;
SQL> select  GROUP#,STATUS,TYPE,MEMBER from v$logfile;

    GROUP# STATUS  TYPE    MEMBER
---------- ------- ------- ------------------------------
         2         ONLINE  +DATA/dell/redo02.log
         1         ONLINE  +DATA/dell/redo01.log
         3         ONLINE  +DATA/dell/redo03.log
         4         ONLINE  +DATA/dell/redo04.log

SQL>
SQL> 
col TABLESPACE_NAME for a20;
col FILE_NAME for a40;
select TABLESPACE_NAME, FILE_NAME,STATUS from dba_data_files;

TABLESPACE_NAME      FILE_NAME                                STATUS
-------------------- ---------------------------------------- ---------
USERS                +DATA/dell/users01.dbf                   AVAILABLE
UNDOTBS1             +DATA/dell/undotbs01.dbf                 AVAILABLE
SYSAUX               +DATA/dell/sysaux01.dbf                  AVAILABLE
SYSTEM               +DATA/dell/system01.dbf                  AVAILABLE
UNDOTBS2             +DATA/dell/undotbs02.dbf                 AVAILABLE

SQL>

SQL>

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     12
Next log sequence to archive   13
Current log sequence           13
SQL>

To check component list and last applied bundel patch
SQL> select comp_id,comp_name,version,status from dba_registry;
SQL>
SQL> select description from dba_registry_sqlpatch;
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

[oracle@rac1 ~]$
[oracle@rac1 ~]$


=============================================================================================================
Preparation of TARGET Machine & Database:
=============================================================================================================
[oracle@rac3 ~]$
[oracle@rac3 ~]$ hostname
rac3.dell.com
[oracle@rac3 ~]$
[oracle@rac3 ~]$ hostname -i
192.168.1.13
[oracle@rac3 ~]$ cat dell.env
export ORACLE_SID=CDELL
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib/usr/lib; export LD_LIBRARY_PATH

Creation of Password file, Directory Structure, Parameter file, 
[oracle@rac3 ~]$
[oracle@rac3 ~]$. dell.env
[oracle@rac3 ~]$
[oracle@rac3 ~]$ cd $ORACLE_HOME/dbs
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$ orapwd file=orapwCDELL  password=sys123 force=y entries=30
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$ mkdir -p /u01/app/oracle/admin/CDELL/adump
[oracle@rac3 dbs]$ mkdir -p /u01/app/oracle/flash_recovery_area
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$ vi initCDELL.ora
*.audit_file_dest='/u01/app/oracle/admin/CDELL/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.db_block_size=8192
*.db_domain=''
*.db_name='CDELL'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_create_file_dest='/u01/app/oracle/'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/u01/app/oracle'
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='exclusive'


Listener & tns file for Target Machine: 
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$ cat $TNS_ADMIN/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

ADR_BASE_CDELL = /u01/app/oracle

CDELL =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac3.dell.com)(PORT = 1522))
    )
  )
SID_LIST_CDELL =
  (SID_LIST =
    (SID_DESC = (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)(SID_NAME = CDELL))
  )



[oracle@rac3 dbs]$ cat $TNS_ADMIN/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

DELL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dellc-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DELL)
    )
  )

CDELL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac3.dell.com)(PORT = 1522))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = CDELL)
    )
  )



[oracle@rac3 dbs]$
[oracle@rac3 dbs]$ lsnrctl start  CDELL

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-JAN-2018 16:15:07

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

TNS-01106: Listener using listener name CDELL has already been started
[oracle@rac3 admin]$ lsnrctl status CDELL

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-JAN-2018 16:15:15

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac3.dell.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     CDELL
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                21-JAN-2018 16:14:17
Uptime                    0 days 0 hr. 0 min. 57 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac3/cdell/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac3.dell.com)(PORT=1522)))
Services Summary...
Service "CDELL" has 1 instance(s).
  Instance "CDELL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$ lsnrctl status cdell

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-JAN-2018 16:48:21

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac3.dell.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     CDELL
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                21-JAN-2018 16:14:17
Uptime                    0 days 0 hr. 34 min. 3 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac3/cdell/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac3.dell.com)(PORT=1522)))
Services Summary...
Service "CDELL" has 1 instance(s).
Instance "CDELL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$

[oracle@rac3 dbs]$ ps -ef | grep tns
root         9     2  0 09:46 ?        00:00:00 [netns]
oracle    9363     1  0 16:14 ?        00:00:00 /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr CDELL -inherit
oracle   10659 10321  0 16:49 pts/2    00:00:00 grep tns
[oracle@rac3 dbs]$

Start Target Database in nomount and register Database:
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jan 21 10:03:25 2018

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> 
SQL> create spfile from pfile;

File created.

SQL>
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
SQL>
SQL> alter system register;

System altered.

SQL> 
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rac3 dbs]$


Connect to RMAN from Either Source or Target: Here it is Target:
[oracle@rac3 ~]$
[oracle@rac3 ~]$ tnsping dell

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 21-JAN-2018 09:48:15

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dellc-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DELL)))
OK (10 msec)
[oracle@rac3 ~]$
[oracle@rac3 ~]$ 
[oracle@rac3 ~]$ tnsping cdell

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 21-JAN-2018 09:50:10

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac3.dell.com)(PORT = 1522))) (CONNECT_DATA = (SERVICE_NAME = CDELL)))
OK (10 msec)
[oracle@rac3 ~]$

Make sure our target and auxiliary passwords are same
[oracle@rac3 ~]$ rman target sys/sys123@DELL nocatalog auxiliary sys/sys123@CDELL

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jan 21 16:15:24 2018

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

connected to target database: DELL (DBID=3936476647)
using target database control file instead of recovery catalog
connected to auxiliary database: CDELL (not mounted)

RMAN>
RMAN>
RMAN>
RMAN> duplicate database to CDELL from active database nofilenamecheck;

Starting Duplicate Db at 21-JAN-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  control_files =
  ''/u01/app/oracle/oradata/CDELL/controlfile/o1_mf_f694np1y_.ctl'', ''/u01/app/oracle/flash_recovery_area/CDELL/controlfile/o1_mf_f694np28_.ctl'' comment=
 ''Set by RMAN'' scope=spfile";
   sql clone "alter system set  db_name =
 ''DELL'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''CDELL'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u01/app/oracle/oradata/CDELL/controlfile/o1_mf_f694np2o_.ctl';
   restore clone controlfile to  '/u01/app/oracle/flash_recovery_area/CDELL/controlfile/o1_mf_f694np2t_.ctl' from
 '/u01/app/oracle/oradata/CDELL/controlfile/o1_mf_f694np2o_.ctl';
   sql clone "alter system set  control_files =
  ''/u01/app/oracle/oradata/CDELL/controlfile/o1_mf_f694np2o_.ctl'', ''/u01/app/oracle/flash_recovery_area/CDELL/controlfile/o1_mf_f694np2t_.ctl'' comment=
 ''Set by RMAN'' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  control_files =   ''/u01/app/oracle/oradata/CDELL/controlfile/o1_mf_f694np1y_.ctl'', ''/u01/app/oracle/flash_recovery_area/CDELL/controlfile/o1_mf_f694np28_.ctl'' comment= ''Set by RMAN'' scope=spfile

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

sql statement: alter system set  db_unique_name =  ''CDELL'' 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 backup at 21-JAN-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=32 instance=DELL1 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_DELL1.f tag=TAG20180121T161608 RECID=1 STAMP=966010569
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 21-JAN-18

Starting restore at 21-JAN-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 21-JAN-18

sql statement: alter system set  control_files =   ''/u01/app/oracle/oradata/CDELL/controlfile/o1_mf_f694np2o_.ctl'', ''/u01/app/oracle/flash_recovery_area/CDELL/controlfile/o1_mf_f694np2t_.ctl'' comment= ''Set by RMAN'' 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

database mounted

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;
   backup as copy reuse
   datafile  1 auxiliary format new
   datafile  2 auxiliary format new
   datafile  3 auxiliary format new
   datafile  4 auxiliary format new
   datafile  5 auxiliary format new
   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 21-JAN-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/dell/system01.dbf
output file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_system_02sp89mn_.dbf tag=TAG20180121T161622
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/dell/sysaux01.dbf
output file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_sysaux_03sp89nq_.dbf tag=TAG20180121T161622
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/dell/undotbs01.dbf
output file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_undotbs1_04sp89ou_.dbf tag=TAG20180121T161622
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:04
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/dell/undotbs02.dbf
output file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_undotbs2_05sp89p2_.dbf tag=TAG20180121T161622
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/dell/users01.dbf
output file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_users_06sp89p3_.dbf tag=TAG20180121T161622
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 21-JAN-18

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "+DATA/dell/archivelog/2018_01_21/thread_1_seq_7.279.966002405" auxiliary format
 "/u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_1_7_%u_.arc"   archivelog like
 "+DATA/dell/archivelog/2018_01_21/thread_1_seq_8.280.966010661" auxiliary format
 "/u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_1_8_%u_.arc"   archivelog like
 "+DATA/dell/archivelog/2018_01_21/thread_2_seq_6.281.966010663" auxiliary format
 "/u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_2_6_%u_.arc"   ;
   catalog clone recovery area;
   switch clone datafile all;
}
executing Memory Script

Starting backup at 21-JAN-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=7 RECID=11 STAMP=966002405
output file name=/u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_1_7_07sp89pb_.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=8 RECID=12 STAMP=966010661
output file name=/u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_1_8_08sp89pe_.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting archived log copy
input archived log thread=2 sequence=6 RECID=13 STAMP=966010663
output file name=/u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_2_6_09sp89pi_.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 21-JAN-18

searching for all files in the recovery area

List of Files Unknown to the Database
=====================================
File Name: /u01/app/oracle/flash_recovery_area/CDELL/controlfile/o1_mf_f694np28_.ctl
File Name: /u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_1_8_08sp89pe_.arc
File Name: /u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_2_6_09sp89pi_.arc
File Name: /u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_1_7_07sp89pb_.arc
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_1_8_08sp89pe_.arc
File Name: /u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_2_6_09sp89pi_.arc
File Name: /u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_1_7_07sp89pb_.arc

List of Files Which Where Not Cataloged
=======================================
File Name: /u01/app/oracle/flash_recovery_area/CDELL/controlfile/o1_mf_f694np28_.ctl
  RMAN-07517: Reason: The file header is corrupted

datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=966010678 file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_system_02sp89mn_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=966010678 file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_sysaux_03sp89nq_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=966010678 file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_undotbs1_04sp89ou_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=966010678 file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_users_06sp89p3_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=5 STAMP=966010678 file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_undotbs2_05sp89p2_.dbf

contents of Memory Script:
{
   set until scn  1348881;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 21-JAN-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

starting media recovery

archived log for thread 1 with sequence 8 is already on disk as file /u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_1_8_08sp89pe_.arc
archived log for thread 2 with sequence 6 is already on disk as file /u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_2_6_09sp89pi_.arc
archived log file name=/u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_1_8_08sp89pe_.arc thread=1 sequence=8
archived log file name=/u01/app/oracle/flash_recovery_area/CDELL/archivelog/2018_01_21/o1_mf_2_6_09sp89pi_.arc thread=2 sequence=6
media recovery complete, elapsed time: 00:00:00
Finished recover at 21-JAN-18

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name =
 ''CDELL'' 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 =  ''CDELL'' 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 "CDELL" RESETLOGS ARCHIVELOG
  MAXLOGFILES    192
  MAXLOGMEMBERS      3
  MAXDATAFILES     1024
  MAXINSTANCES    32
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1  SIZE 50 M ,
  GROUP  2  SIZE 50 M
 DATAFILE
  '/u01/app/oracle/oradata/CDELL/datafile/o1_mf_system_02sp89mn_.dbf'
 CHARACTER SET WE8MSWIN1252

sql statement: ALTER DATABASE ADD LOGFILE

  INSTANCE 'i2'
  GROUP  3  SIZE 50 M ,
  GROUP  4  SIZE 50 M

contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   switch clone tempfile all;
   catalog clone datafilecopy  "/u01/app/oracle/oradata/CDELL/datafile/o1_mf_sysaux_03sp89nq_.dbf",
 "/u01/app/oracle/oradata/CDELL/datafile/o1_mf_undotbs1_04sp89ou_.dbf",
 "/u01/app/oracle/oradata/CDELL/datafile/o1_mf_users_06sp89p3_.dbf",
 "/u01/app/oracle/oradata/CDELL/datafile/o1_mf_undotbs2_05sp89p2_.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

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

cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_sysaux_03sp89nq_.dbf RECID=1 STAMP=966010693
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_undotbs1_04sp89ou_.dbf RECID=2 STAMP=966010693
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_users_06sp89p3_.dbf RECID=3 STAMP=966010693
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_undotbs2_05sp89p2_.dbf RECID=4 STAMP=966010693

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=966010693 file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_sysaux_03sp89nq_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=966010693 file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_undotbs1_04sp89ou_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=966010693 file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_users_06sp89p3_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=966010693 file name=/u01/app/oracle/oradata/CDELL/datafile/o1_mf_undotbs2_05sp89p2_.dbf

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

database opened
Finished Duplicate Db at 21-JAN-18

RMAN>


=============================================================================================================
Post Clone Steps
=============================================================================================================
List of Background process on Target Machine:
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$ ps -ef | grep -i CDELL
oracle    4683     1  0 11:53 ?        00:00:00 /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr cdell -inherit
oracle    5194     1  0 11:59 ?        00:00:00 ora_pmon_CDELL
oracle    5198     1  0 11:59 ?        00:00:00 ora_vktm_CDELL
oracle    5204     1  0 11:59 ?        00:00:00 ora_gen0_CDELL
oracle    5208     1  0 11:59 ?        00:00:00 ora_diag_CDELL
oracle    5212     1  0 11:59 ?        00:00:00 ora_dbrm_CDELL
oracle    5216     1  0 11:59 ?        00:00:00 ora_psp0_CDELL
oracle    5220     1  0 11:59 ?        00:00:00 ora_dia0_CDELL
oracle    5224     1  0 11:59 ?        00:00:00 ora_mman_CDELL
oracle    5228     1  0 11:59 ?        00:00:00 ora_dbw0_CDELL
oracle    5232     1  0 11:59 ?        00:00:00 ora_lgwr_CDELL
oracle    5236     1  0 11:59 ?        00:00:00 ora_ckpt_CDELL
oracle    5240     1  0 11:59 ?        00:00:00 ora_smon_CDELL
oracle    5244     1  0 11:59 ?        00:00:00 ora_reco_CDELL
oracle    5248     1  2 11:59 ?        00:00:00 ora_mmon_CDELL
oracle    5252     1  0 11:59 ?        00:00:00 ora_mmnl_CDELL
oracle    5268     1 14 11:59 ?        00:00:03 oracleCDELL (LOCAL=NO)
oracle    5272     1  0 11:59 ?        00:00:00 oracleCDELL (LOCAL=NO)
oracle    5297     1  0 11:59 ?        00:00:00 ora_arc0_CDELL
oracle    5302     1  0 11:59 ?        00:00:00 ora_arc1_CDELL
oracle    5306     1  0 11:59 ?        00:00:00 ora_arc2_CDELL
oracle    5310     1  0 11:59 ?        00:00:00 ora_arc3_CDELL
oracle    5314     1  0 11:59 ?        00:00:00 ora_qmnc_CDELL
oracle    5318     1  0 11:59 ?        00:00:00 ora_q000_CDELL
oracle    5322     1  2 11:59 ?        00:00:00 ora_q001_CDELL
oracle    5350     1  1 11:59 ?        00:00:00 ora_cjq0_CDELL
oracle    5356     1  0 11:59 ?        00:00:00 ora_j000_CDELL
oracle    5360     1  0 11:59 ?        00:00:00 ora_j001_CDELL
oracle    5364     1  0 11:59 ?        00:00:00 ora_j002_CDELL
oracle    5368     1  0 11:59 ?        00:00:00 ora_j003_CDELL
oracle    5374  4552  0 11:59 pts/1    00:00:00 grep -i cdell
[oracle@rac3 dbs]$

Target Database Details:
[oracle@rac3 dbs]$
[oracle@rac3 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jan 21 11:15:41 2018

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL> 
set linesize 300;
col HOST_NAME for a9;
select INSTANCE_NUMBER,INSTANCE_NAME,HOST_NAME,STATUS,DATABASE_STATUS,INSTANCE_ROLE,ACTIVE_STATE,INSTANCE_MODE from gv$instance;

INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME STATUS       DATABASE_STATUS   INSTANCE_ROLE      ACTIVE_ST INSTANCE_MO
--------------- ---------------- --------- ------------ ----------------- ------------------ --------- -----------
              2 CDELL2           rac2      OPEN         ACTIVE            PRIMARY_INSTANCE   NORMAL    REGULAR
              1 CDELL1           rac1      OPEN         ACTIVE            PRIMARY_INSTANCE   NORMAL    REGULAR

SQL>
SQL> select INSTANCE_NAME, STATUS, DATABASE_STATUS, VERSION from v$instance;

INSTANCE_NAME    STATUS       DATABASE_STATUS   VERSION
---------------- ------------ ----------------- -----------------
CDELL            OPEN         ACTIVE            11.2.0.1.0

SQL>
SQL> select name,OPEN_MODE,CREATED,LOG_MODE,CONTROLFILE_TYPE,FLASHBACK_ON,DATABASE_ROLE,GUARD_STATUS,PROTECTION_MODE from gv$database;

NAME      OPEN_MODE            CREATED   LOG_MODE     CONTROL FLASHBACK_ON       DATABASE_ROLE    GUARD_S PROTECTION_MODE
--------- -------------------- --------- ------------ ------- ------------------ ---------------- ------- --------------------
CDELL     READ WRITE           22-SEP-21 ARCHIVELOG   CURRENT NO                 PRIMARY          NONE    MAXIMUM PERFORMANCE
CDELL     READ WRITE           22-SEP-21 ARCHIVELOG   CURRENT NO                 PRIMARY          NONE    MAXIMUM PERFORMANCE

SQL> 
SQL> select name,CREATED, CONTROLFILE_TYPE from v$database;

NAME      CREATED   CONTROL
--------- --------- -------
CDELL     21-JAN-18 CURRENT


SQL>

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/CDELL/datafile/o1_mf_system_0mspabb6_.dbf
/u01/app/oracle/CDELL/datafile/o1_mf_sysaux_0nspabc9_.dbf
/u01/app/oracle/CDELL/datafile/o1_mf_undotbs1_0ospabd2_.dbf
/u01/app/oracle/CDELL/datafile/o1_mf_users_0qspabd7_.dbf
/u01/app/oracle/CDELL/datafile/o1_mf_undotbs2_0pspabd5_.dbf

SQL>
SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/CDELL/onlinelog/o1_mf_2_f6c6dmr1_.log
/u01/app/oracle/flash_recovery_area/CDELL/onlinelog/o1_mf_2_f6c6dnot_.log
/u01/app/oracle/CDELL/onlinelog/o1_mf_1_f6c6dky5_.log
/u01/app/oracle/flash_recovery_area/CDELL/onlinelog/o1_mf_1_f6c6dlv5_.log
/u01/app/oracle/CDELL/onlinelog/o1_mf_3_f6c6dfq3_.log
/u01/app/oracle/flash_recovery_area/CDELL/onlinelog/o1_mf_3_f6c6dfs3_.log
/u01/app/oracle/CDELL/onlinelog/o1_mf_4_f6c6dgqn_.log
/u01/app/oracle/flash_recovery_area/CDELL/onlinelog/o1_mf_4_f6c6dhp9_.log

8 rows selected.

SQL>
SQL> select THREAD#, STATUS, ENABLED from v$thread;

   THREAD# STATUS ENABLED
---------- ------ --------
         1 OPEN   PUBLIC
         2 CLOSED PUBLIC

SQL>
SQL> select group# from V$log where THREAD#=2;

    GROUP#
----------
         3
         4

SQL>
SQL> alter database disable thread 2;

Database altered.

SQL>
SQL> alter database drop logfile group 3;

Database altered.

SQL>
SQL> alter database drop logfile group 4;

Database altered.

SQL>
SQL> select THREAD#, STATUS, ENABLED from v$thread;

   THREAD# STATUS ENABLED
---------- ------ --------
         1 OPEN   PUBLIC

SQL>
SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
UNDOTBS2

6 rows selected.

SQL>
SQL> drop tablespace  UNDOTBS2 including contents and datafiles;

Tablespace dropped.

SQL>
SQL> col file_name for a30;
SQL> select tablespace_name,file_name,status from dba_temp_files;

TABLESPACE_NAME                FILE_NAME                      STATUS
------------------------------ ------------------------------ -------
TEMP                           /u01/app/oracle/CDELL/datafile ONLINE
                               /o1_mf_temp_f6c6ds8p_.tmp


SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rac3 dbs]$


                            
This article helps those who like to Clone RAC in Linux Environment. 
Thanks for Reading.

Regards,
Mohammed Areefuddin.

No comments:

Post a Comment