Oracle Apps DBA

My photo
More than 5+ Years of IT Experience in administering Enterprise wide Multi Vendor UNIX Servers, Oracle Databases (8i to 11gR2), Middle-tiers, Applications and Clusters. I am a Sun Certified System Administrator (SCSA) for Solaris 10, oracle 10g database certified associate(OCA), Oracle 10g Database certified professional (OCP) and Oracle E-Business suite R12 certified professionl(OCP)

Oracle Database and Applications

Monday, 15 October 2012

RAC to NON RAC Database clone 11gR2

This posts illustrates steps for cloning a 11gR2 RAC database to a single Instance database.  There are many ways to perform a RAC database to NON-RAC database clone, but the below illustrated seems to be the easiest approach for me compare to all other methods.

In this demonstration oelrac1 & oelrac2 are OEL 5.6 Linux hosts running 11.2.0.1 GI and 11.2.0.1 database.


- erpnode3 running OEL 5.6 configured with all database OS pre-requisites, but does not contain any oracle product installed on it.

Steps:

1) perform  full database backup from any of the RAC Instance




RMAN> connect target

connected to target database: PROD (DBID=208065887)


RMAN> RUN
2> {
3> allocate channel ch1 type 
4> disk format '/u01/11g_db/rman_db_backups/%d_DB_%u_%s_%p';
5> backup database plus archivelog;
6> release channel ch1;
7> }



released channel: ORA_DISK_1
allocated channel: ch1
channel ch1: SID=67 instance=prod1 device type=DISK


Starting backup at 14-OCT-12
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=2 RECID=1 STAMP=796227711
input archived log thread=2 sequence=1 RECID=2 STAMP=796227756
input archived log thread=1 sequence=3 RECID=5 STAMP=796229217
input archived log thread=2 sequence=2 RECID=3 STAMP=796227764
input archived log thread=2 sequence=3 RECID=4 STAMP=796229213
input archived log thread=2 sequence=4 RECID=6 STAMP=796232466
input archived log thread=1 sequence=4 RECID=7 STAMP=796648119
input archived log thread=2 sequence=5 RECID=9 STAMP=796649431
input archived log thread=1 sequence=5 RECID=8 STAMP=796649430
input archived log thread=1 sequence=6 RECID=10 STAMP=796649607
input archived log thread=2 sequence=6 RECID=11 STAMP=796649608
input archived log thread=2 sequence=7 RECID=13 STAMP=796649932
input archived log thread=1 sequence=7 RECID=12 STAMP=796649929
channel ch1: starting piece 1 at 14-OCT-12
channel ch1: finished piece 1 at 14-OCT-12
piece handle=/u01/11g_db/rman_db_backups/PROD_DB_05nnnqef_5_1 tag=TAG20121014T113855 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:25
Finished backup at 14-OCT-12

Starting backup at 14-OCT-12
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00001 name=+RACDATA/prod/system01.dbf
input datafile file number=00002 name=+RACDATA/prod/sysaux01.dbf
input datafile file number=00003 name=+RACDATA/prod/undotbs01.dbf
input datafile file number=00005 name=+RACDATA/prod/undotbs02.dbf
input datafile file number=00004 name=+RACDATA/prod/users01.dbf
channel ch1: starting piece 1 at 14-OCT-12
channel ch1: finished piece 1 at 14-OCT-12
piece handle=/u01/11g_db/rman_db_backups/PROD_DB_06nnnqf9_6_1 tag=TAG20121014T113921 comment=NONE
channel ch1: backup set complete, elapsed time: 00:01:16
Finished backup at 14-OCT-12

Starting backup at 14-OCT-12
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=15 STAMP=796650041
input archived log thread=2 sequence=8 RECID=14 STAMP=796650041
channel ch1: starting piece 1 at 14-OCT-12
channel ch1: finished piece 1 at 14-OCT-12
piece handle=/u01/11g_db/rman_db_backups/PROD_DB_07nnnqhr_7_1 tag=TAG20121014T114042 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 14-OCT-12

Starting Control File and SPFILE Autobackup at 14-OCT-12
piece handle=/u01/11g_db/rman_db_backups/prod_c-208065887-20121014-01 comment=NONE
Finished Control File and SPFILE Autobackup at 14-OCT-12

released channel: ch1

RMAN> 



2) create pfile and edit it as per the requirement

- remove all cluster related parameters


ora11g@oelrac1 db_scripts]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Oct 14 12:46:17 2012

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


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


SQL> create pfile='/home/ora11g/db_scripts/initTEST.ora' from spfile;

File created.


- sample initTEST.ora


[ora11g@erpnode3 dbs]$ more initTEST.ora 
[ora11g@erpnode3 dbs]$ more initTEST.ora 
TEST.__db_cache_size=230686720
TEST.__java_pool_size=4194304
TEST.__large_pool_size=4194304
TEST.__pga_aggregate_target=348127232
TEST.__sga_target=515899392
TEST.__shared_io_pool_size=0
TEST.__shared_pool_size=268435456
TEST.__streams_pool_size=0
*.audit_file_dest='/u01/11g_db/ora11g/admin/TEST/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/11g_db/oradata/TEST/control01.ctl','/u01/11g_db/oradata/TEST/control02.ctl'
*.db_create_file_dest='/u01/11g_db/oradata/TEST'
*.db_block_size=8192
*.db_domain='orasol.com'
*.db_name='prod'
*.diagnostic_dest='/u01/11g_db/ora11g'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=TESTXDB)'
*.memory_target=862978048
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='exclusive'
[ora11g@erpnode3 dbs]$ 


- Here i am using db_name= prod, as this name is stored in controlfile. We can change it after completion of clone

 3) Clone RDBMS $ORACLE_HOME

- create tar file for ORACLE_HOME from any of the RAC node
- copy to remote server and untar it
- Disable RAC configuration from oracle home & relink binaries
- create password file
- copy backup pieces to the remote host. I have copied it on the same directory location (/u01/11g_db/rman_db_backups)


[ora11g@oelrac1 dbhome_1]$ pwd
/u01/11g_db/ora11g/product/11.2.0/dbhome_1
[ora11g@oelrac1 dbhome_1]$ cd ..
[ora11g@oelrac1 11.2.0]$ ls
dbhome_1
[ora11g@oelrac1 11.2.0]$ tar -cvf 11gr2.tar dbhome_1



[ora11g@oelrac1 11.2.0]$ ls
11gr2.tar  dbhome_1
[ora11g@oelrac1 11.2.0]$ scp 11gr2.tar root@erpnode3:/u01/11g_db/ora11g/product/11.2.0



[ora11g@erpnode3 lib]$ make -f ins_rdbms.mk rac_off
rm -f /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/libskgxp11.so
cp /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib//libskgxpg.so /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/libskgxp11.so
rm -f /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/libskgxn2.so
cp /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib//libskgxns.so \
              /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/libskgxn2.so
/usr/bin/ar cr /u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/libknlopt.a /u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/ksnkcs.o 
[ora11g@erpnode3 lib]$ 




[ora11g@erpnode3 lib]$ make -f ins_rdbms.mk ioracle 
chmod 755 /u01/11g_db/ora11g/product/11.2.0/dbhome_1/bin

 - Linking Oracle 
rm -f /u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/oracle
gcc  -o /u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/oracle -m32 -L/u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/ -L/u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/ -L/u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/stubs/ -L/u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/ -lirc -lipgo    -Wl,-E /u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/opimai.o /u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/ssoraed.o /u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/ttcsoi.o  -Wl,--whole-archive -lperfsrv11 -Wl,--no-whole-archive /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/nautab.o /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/naeet.o /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/naect.o /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/naedhs.o /u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/config.o  -lserver11 -lodm11 -lcell11 -lnnet11 -lskgxp11 -lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11  -lvsn11 -lcommon11 -lgeneric11 -lknlopt `if /usr/bin/ar tv /u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/libknlopt.a | grep xsyeolap.o > /dev/null 2>&1 ; then echo "-loraolap11" ; fi` -lslax11 -lpls11  -lrt -lplp11 -lserver11 -lclient11  -lvsn11 -lcommon11 -lgeneric11 `if [ -f /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/libavserver11.a ] ; then echo "-lavserver11" ; else echo "-lavstub11"; fi` `if [ -f /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/libavclient11.a ] ; then echo "-lavclient11" ; fi` -lknlopt -lslax11 -lpls11  -lrt -lplp11 -ljavavm11 -lserver11  -lwwg  `cat /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lmm -lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lztkg11 `cat /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/ldflags`    -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11   -lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `if /usr/bin/ar tv /u01/11g_db/ora11g/product/11.2.0/dbhome_1/rdbms/lib/libknlopt.a | grep "kxmnsd.o" > /dev/null 2>&1 ; then echo " " ; else echo "-lordsdo11"; fi` -L/u01/11g_db/ora11g/product/11.2.0/dbhome_1/ctx/lib/ -lctxc11 -lctx11 -lzx11 -lgx11 -lctx11 -lzx11 -lgx11 -lordimt11 -lclsra11 -ldbcfg11 -lhasgen11 -lskgxn2 -lnnz11 -lzt11 -lxml11 -locr11 -locrb11 -locrutl11 -lhasgen11 -lskgxn2 -lnnz11 -lzt11 -lxml11 -lasmclnt11 -lcommon11 -lcell11 -lskgxp11 -lgeneric11  -lcommon11 -lgeneric11  -loraz -llzopro -lorabz2 -lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lsnls11 -lunls11  -lsnls11 -lnls11  -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lasmclnt11 -laio    `cat /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/sysliblist` -Wl,-rpath,/u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib -lm    `cat /u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib/sysliblist` -ldl -lm   -L/u01/11g_db/ora11g/product/11.2.0/dbhome_1/lib
 



[ora11g@erpnode3 dbs]$ orapwd file=orapwTEST entries=6 password=oracle
[ora11g@erpnode3 dbs]$ ls -lrt orapwTEST
-rw-r----- 1 ora11g dba 2048 Oct 14 14:33 orapwTEST
[ora11g@erpnode3 dbs]$  



rman backups on erpnode3:


[ora11g@erpnode3 11g_db]$ cd rman_db_backups/
[ora11g@erpnode3 rman_db_backups]$ ls
prod_c-208065887-20121014-00  prod_c-208065887-20121014-02  prod_c-208065887-20121015-00  PROD_DB_06nnnqf9_6_1
prod_c-208065887-20121014-01  prod_c-208065887-20121014-03  PROD_DB_05nnnqef_5_1          PROD_DB_07nnnqhr_7_1
[ora11g@erpnode3 rman_db_backups]$ pwd
/u01/11g_db/rman_db_backups
[ora11g@erpnode3 rman_db_backups]$ 


4) startup Database in nomount stage


[ora11g@erpnode3 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Oct 14 14:33:47 2012

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

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  862089216 bytes
Fixed Size                  1339908 bytes
Variable Size             624954876 bytes
Database Buffers          230686720 bytes
Redo Buffers                5107712 bytes
SQL>



5) Restore controlfile and startup database in nomount state


[ora11g@erpnode3 dbs]$ rman target / nocatalog

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Oct 14 14:56:03 2012

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

connected to target database: PROD (not mounted)
using target database control file instead of recovery catalog

RMAN> restore controlfile from '/u01/11g_db/rman_db_backups/prod_c-208065887-20121014-01';

Starting restore at 14-OCT-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
output file name=/u01/11g_db/oradata/TEST/control01.ctl
output file name=/u01/11g_db/oradata/TEST/control02.ctl
Finished restore at 14-OCT-12

RMAN>alter database mount;



6) check backup of archive logs and execute restore database script accordingly



RMAN> list backup of archivelog all;                                        


List of Backup Sets
===================


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
1       188.37M    DISK        00:00:15     14-OCT-12      
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20121014T113032
        Piece Name: +RACDATA/prod/backupset/2012_10_14/annnf0_tag20121014t113032_0.291.796649433

  List of Archived Logs in backup set 1
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    2       758603     09-OCT-12 765511     09-OCT-12
  1    3       765514     09-OCT-12 798790     09-OCT-12
  1    4       798790     09-OCT-12 832214     14-OCT-12
  1    5       832214     14-OCT-12 838642     14-OCT-12
  2    1       765308     09-OCT-12 765516     09-OCT-12
  2    2       765516     09-OCT-12 765518     09-OCT-12
  2    3       765518     09-OCT-12 798783     09-OCT-12
  2    4       798783     09-OCT-12 815859     09-OCT-12
  2    5       816155     14-OCT-12 838646     14-OCT-12

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
3       369.50K    DISK        00:00:01     14-OCT-12      
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20121014T113329
        Piece Name: +RACDATA/prod/backupset/2012_10_14/annnf0_tag20121014t113329_0.295.796649609

  List of Archived Logs in backup set 3
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    6       838642     14-OCT-12 839718     14-OCT-12
  2    6       838646     14-OCT-12 839715     14-OCT-12

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5       188.84M    DISK        00:00:18     14-OCT-12      
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20121014T113855
        Piece Name: /u01/11g_db/rman_db_backups/PROD_DB_05nnnqef_5_1

  List of Archived Logs in backup set 5
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    2       758603     09-OCT-12 765511     09-OCT-12
  1    3       765514     09-OCT-12 798790     09-OCT-12
  1    4       798790     09-OCT-12 832214     14-OCT-12
  1    5       832214     14-OCT-12 838642     14-OCT-12
  1    6       838642     14-OCT-12 839718     14-OCT-12
  1    7       839718     14-OCT-12 840284     14-OCT-12
  2    1       765308     09-OCT-12 765516     09-OCT-12
  2    2       765516     09-OCT-12 765518     09-OCT-12
  2    3       765518     09-OCT-12 798783     09-OCT-12
  2    4       798783     09-OCT-12 815859     09-OCT-12
  2    5       816155     14-OCT-12 838646     14-OCT-12
  2    6       838646     14-OCT-12 839715     14-OCT-12
  2    7       839715     14-OCT-12 840289     14-OCT-12

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
7       37.50K     DISK        00:00:00     14-OCT-12      
        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20121014T114042
        Piece Name: /u01/11g_db/rman_db_backups/PROD_DB_07nnnqhr_7_1

  List of Archived Logs in backup set 7
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    8       840284     14-OCT-12 840456     14-OCT-12
  2    8       840289     14-OCT-12 840453     14-OCT-12

RMAN>




RMAN> run {
2> set until sequence 9 thread 2;
3> set newname for datafile 1 to '/u01/11g_db/oradata/TEST/system01.dbf';
4> set newname for datafile 2 to '/u01/11g_db/oradata/TEST/sysaux01.dbf';
5> set newname for datafile 3 to '/u01/11g_db/oradata/TEST/undotbs01.dbf';
6> set newname for datafile 4 to '/u01/11g_db/oradata/TEST/users01.dbf';
7> set newname for datafile 5 to '/u01/11g_db/oradata/TEST/undotbs02.dbf';
8> restore database;
9> switch datafile all;
10> recover database;
11>}


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 14-OCT-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/11g_db/oradata/TEST/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/11g_db/oradata/TEST/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/11g_db/oradata/TEST/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/11g_db/oradata/TEST/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/11g_db/oradata/TEST/undotbs02.dbf
channel ORA_DISK_1: reading from backup piece /u01/11g_db/rman_db_backups/PROD_DB_06nnnqf9_6_1
channel ORA_DISK_1: piece handle=/u01/11g_db/rman_db_backups/PROD_DB_06nnnqf9_6_1 tag=TAG20121014T113921
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:55
Finished restore at 14-OCT-12

datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=796662728 file name=/u01/11g_db/oradata/TEST/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=7 STAMP=796662728 file name=/u01/11g_db/oradata/TEST/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=8 STAMP=796662729 file name=/u01/11g_db/oradata/TEST/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=9 STAMP=796662729 file name=/u01/11g_db/oradata/TEST/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=10 STAMP=796662729 file name=/u01/11g_db/oradata/TEST/undotbs02.dbf

Starting recover at 14-OCT-12
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=8
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=8
channel ORA_DISK_1: reading from backup piece /u01/11g_db/rman_db_backups/PROD_DB_07nnnqhr_7_1
channel ORA_DISK_1: piece handle=/u01/11g_db/rman_db_backups/PROD_DB_07nnnqhr_7_1 tag=TAG20121014T114042
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/11g_db/ora11g/product/11.2.0/dbhome_1/dbs/arch1_8_796227555.dbf thread=1 sequence=8
archived log file name=/u01/11g_db/ora11g/product/11.2.0/dbhome_1/dbs/arch2_8_796227555.dbf thread=2 sequence=8
media recovery complete, elapsed time: 00:00:01
Finished recover at 14-OCT-12

RMAN> 


 

7) Rename online redologfiles and open database with resetlogs

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
+RACDATA/prod/redo02.log
+RACDATA/prod/redo01.log
+RACDATA/prod/redo03.log
+RACDATA/prod/redo04.log



SQL> alter database rename file '+RACDATA/prod/redo02.log' to '/u01/11g_db/oradata/TEST/redo02.log';

Database altered.

SQL> alter database rename file '+RACDATA/prod/redo01.log' to '/u01/11g_db/oradata/TEST/redo01.log';

Database altered.

SQL> alter database rename file '+RACDATA/prod/redo03.log' to '/u01/11g_db/oradata/TEST/redo03.log';

Database altered.

SQL> alter database rename file '+RACDATA/prod/redo04.log' to '/u01/11g_db/oradata/TEST/redo04.log';

Database altered.
SQL> alter database open resetlogs;

Database altered.

SQL> select open_mode, name from v$database;

OPEN_MODE            NAME
-------------------- ---------
READ WRITE           PROD

SQL> 

 
8) Disable and drop closed online redolog group



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

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

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

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

SQL> alter database disable thread 2;

Database altered.

SQL> alter database drop logfile group 3;

Database altered.

SQL> alter database drop logfile group 4;

Database altered.

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

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


8) Create new temp tablespace and drop old temp TS


SQL> create temporary tablespace TEMP1
  2  tempfile '/u01/11g_db/oradata/TEST/temp001.dbf'
  3  size 50M;

Tablespace created.

SQL> alter database default temporary tablespace TEMP1;

Database altered.

SQL> drop tablespace TEMP including contents and datafiles;

Tablespace dropped.



9) change the database name

- Here SID is TEST and database name is PROD, just change the database name using dbnewid utility
-verify the database name
- shutdown database
- startup nomount
- use nid command to change
- edit initilization parameter file and change db_name parameter from "prod" to "TEST"
- startup mount and open database with resetlogs option


[ora11g@erpnode3 ~]$ echo $ORACLE_SID
TEST



[ora11g@erpnode3 ~]$ nid TARGET=SYS/password DBNAME=TEST

DBNEWID: Release 11.2.0.1.0 - Production on Mon Oct 15 13:52:58 2012

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

Connected to database PROD (DBID=208065887)

Connected to server version 11.2.0

Control Files in database:
    /u01/11g_db/oradata/TEST/control01.ctl
    /u01/11g_db/oradata/TEST/control02.ctl

Change database ID and database name PROD to TEST? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 208065887 to 2580097082
Changing database name from PROD to TEST
    Control File /u01/11g_db/oradata/TEST/control01.ctl - modified
    Control File /u01/11g_db/oradata/TEST/control02.ctl - modified
    Datafile /u01/11g_db/oradata/TEST/system01.db - dbid changed, wrote new name
    Datafile /u01/11g_db/oradata/TEST/sysaux01.db - dbid changed, wrote new name
    Datafile /u01/11g_db/oradata/TEST/undotbs01.db - dbid changed, wrote new name
    Datafile /u01/11g_db/oradata/TEST/users01.db - dbid changed, wrote new name
    Datafile /u01/11g_db/oradata/TEST/undotbs02.db - dbid changed, wrote new name
    Datafile /u01/11g_db/oradata/TEST/temp001.db - dbid changed, wrote new name
    Control File /u01/11g_db/oradata/TEST/control01.ctl - dbid changed, wrote new name
    Control File /u01/11g_db/oradata/TEST/control02.ctl - dbid changed, wrote new name
    Instance shut down

Database name changed to TEST.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST changed to 2580097082.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully. 



[ora11g@erpnode3 dbs]$ grep db_name initTEST.ora 
*.db_name='TEST'
[ora11g@erpnode3 dbs]$  



[ora11g@erpnode3 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 15 14:04:34 2012

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

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area  862089216 bytes
Fixed Size                  1339908 bytes
Variable Size             624954876 bytes
Database Buffers          230686720 bytes
Redo Buffers                5107712 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

SQL>select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
TEST    READ WRITE

SQL>



Done with RAC to Non-RAc clone :)

If you have any comment's/suggestion/queries in regards with this article then update me.

Thanks for reading.

regards,
X A H E E R

9 comments:

TAI said...

Great work Zaheer

Anonymous said...

Terrific work...

Request you to kindly specify the path from where we have to remove the cluster related entries.

Syed Zaheer said...

Thanks for appreciation.

Please refer sample initialization parameter file listed above for all required parameters on a non-rac host.

thanks,
X A H E E R

mohd qadar said...

Assalamualaikum zaheer, the total steps in RAC to non RAC is 10, the 8 number is come in two times, just look at the steps which you are given in this blogs, 8 number comes two times

mirek kiryk said...

great job
- i had the same work but on rac 10.2.0.5 and i have done with rman duplicate to .... works :)

ravi kishor said...

Really nice work..Zaheer..
I have a small doubt...
You issued "list backup of archivelog all" in step 6 by connecting to clone node as a target database....my question is ..we have restored & mounted backup copy of control file in cloning node..how come backup control file holds updated metadata about the recent backup sets before restoring and recovering it on the same node ?
Plz clarify my doubt...
Thnz in advance..

Unknown said...

Salam bhai,

Very good explanation. how to read AWR report and take action according to that.

zainul from oracle expert group.

Yousuf said...

Great work, appreciated..!!
Well drafted and executed.
Xaheer's post are handy tools for all Major DB related tasks.

Few are below things that would add up more value to this post cloning from rac to non-rac:-

Firstly :
to convert binaries from rac to non rac it should be noted that
"make -f ins_rdbms.mk rac_off" &"make -f ins_rdbms.mk ioracle" command should be run from $ORACLE_HOME/rdbms/lib not from $ORACLE_HOME/lib or any other.
Someone above asked in the comment.

Secondly got a new issue with my latest cloning from rac to non-rac for the first time.
v$logfile dispalyed members as "+DATA" instead of providing "+DATA\prod\onlinelog1a.dbf" for all the logfile and when we try to rename it got below error:

GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- -------------------------------------------------- ---
1 INVALID ONLINE +DATA NO
1 INVALID ONLINE +DATA NO
2 INVALID ONLINE +DATA NO
2 INVALID ONLINE +DATA NO
3 INVALID ONLINE +DATA NO
4 INVALID ONLINE +DATA NO
11 ONLINE +CCB_DATA/ccbprod/onlinelog/group_11_2_1.dbf NO


WHEN I TRY TO DROP THEM ITS SAYS FILE DOESN'T EXIST.

NOW LET'S STRAIGHT AWAY GO TO SOLUTION:

SOLUTION A:
ALTER DATABASE OPEN RESETLOGS fails with ORA-00392 (NOTE 1352133.1)

SOLUTION B:

Hi Yousuf,

This issue may have happened as you have not set log_file_name_convert or db_create_online_log_dest_n parameters before restore and you are cloning from ASM to non-ASM.
To avoid it set any 1 of the parameters and retry the restore/recovery.
To resolve the issue we did below actions:

>> drop the logfile group:

alter database drop logfile group ;

If it doesn't drop, check the status of the logfile and clear it:

alter database clear unarchived logfile group ;

after this runs drop the logfile group and drop it.

ORA Error Encountered:
ORA-00360, ORA-00392, ORA-00312, ORA-00349

Hopefully this might assist you.

Regards,
Usuf.

Anonymous said...

Where does "perl adcfgclone.pl dbTechStack" fit into this procedure in an 11.5.10.2 environment? Aren't there additional steps to get adcfgclone and AutoConfig to correctly configure the database listener when cloning from RAC to non-RAC? Thanks!