Saturday, August 26, 2017

NON RAC TO RAC CLONING(METHOD-MANNUAL)

NON RAC TO RAC CLONING(METHOD-MANNUAL)

1. Copy backup of database/ archivelog / controlfile
[oracle@rac1pub111 u01]$ ls
11.2.0.4  11g.env  app  backup  grid.env  gridsw  lost+found
[oracle@rac1pub111 u01]$

2. scp backup to rac node 1
3. create parameter file and copy to asm disk group


[oracle@rac1pub111 dbs]$ cat initPROD.ora
*.audit_file_dest='/u01/app/oracle/admin/PROD/adump'
*.audit_trail='db'
*.cluster_database=false
*.compatible='11.2.0.4.0'
*.control_files='+DATA/PROD/controlfile/current.260.951842647'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='PROD'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=PRODXDB)'
*.open_cursors=300
*.processes=150
*.remote_listener='rcscan:1521'
*.remote_login_passwordfile='exclusive'
*.undo_tablespace='UNDOTBS1'

log_file_name_convert='/u01/test','+DATA'
db_file_name_convert=='/u01/test','+DATA'
[oracle@rac1pub111 dbs]$


4. start database in nomount stage.

ASMCMD> mkdir PROD
ASMCMD> ls
DEV/
PROD/
shz1.dbf
tbs01.dbf
ASMCMD

ASMCMD> mkdir spfile
ASMCMD> pwd
+DATA/PROD
ASMCMD>

[oracle@rac1pub111 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 14 21:02:20 2017

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

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  246386688 bytes
Fixed Size                  2252096 bytes
Variable Size             188744384 bytes
Database Buffers           50331648 bytes
Redo Buffers                5058560 bytes
SQL>


SQL>  create spfile='+DATA/PROD/spfile/spfilePROD.ora' from pfile;

File created.

SQL>

5. duplicate target database to clone
    rman auxiliary /

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Aug 14 21:04:49 2017

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

connected to auxiliary database: PROD (not mounted)

RMAN> duplicate target database to 'PROD' backup location '/u01/backup' nofilenamecheck;
6.clone database open.




Mannually setps to convert non rac to rac.

first create spfile from pfile
SQL> create spfile='+DATA/PROD/spfile/spfilePROD.ora' from pfile;

File created.

then create pfile and add loction of spfile.
[oracle@rac1pub111 dbs]$ cat initPROD.ora
spfile='+DATA/PROD/spfile/spfilePROD.ora'

[oracle@rac1pub111 dbs]$


SQL> startup
ORACLE instance started.

Total System Global Area  246386688 bytes
Fixed Size                  2252096 bytes
Variable Size             188744384 bytes
Database Buffers           50331648 bytes
Redo Buffers                5058560 bytes
Database mounted.
Database opened.
SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/prod/spfile/spfileprod.o
                                                 ra
SQL>


SQL> alter system checkpoint;

System altered.

SQL> alter system switch logfile;

System altered.

SQL>  alter database add logfile thread 2 group 3 size 100m;

Database altered.

SQL>  alter database add logfile thread 2 group 5 size 100m;

Database altered.

SQL> alter database enable thread 2;

Database altered.

SQL> alter database add logfile thread 1 group 6 size 100m;

Database altered.

SQL> alter database add logfile thread 1 group 7 size 100m;

Database altered.

SQL>  alter database add logfile thread 1 group 8 size 100m;

Database altered.

SQL> alter database drop logfile group 3;

Database altered.

SQL> alter database drop logfile group 2;

Database altered.

SQL> select thread#,group#,bytes/1024 from v$log;

   THREAD#     GROUP# BYTES/1024
---------- ---------- ----------
         1          3      51200
         2          4     102400
         2          5     102400
         1          6     102400
         1          7     102400
         1          8     102400



SQL> create undo tablespace UNDOTBS2 datafile '+DATA';

Tablespace created.



SQL> alter system set cluster_database=true scope=spfile;

System altered.

SQL> alter system set cluster_database_instances=2 scope=spfile;

System altered.

SQL> alter system set THREAD=1 scope=spfile sid='PROD1';

System altered.

SQL>  alter system set THREAD=2  scope=spfile sid='PROD2';

System altered.

SQL> show parameter undo_tablespace;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_tablespace                      string      UNDOTBS1
SQL> alter system set undo_tablespace=UNDOTBS1 scope=spfile SID='PROD1';

System altered.

SQL> alter system set undo_tablespace=UNDOTBS2 scope=spfile SID='PROD2';

System altered.

SQL> alter system set INSTANCE_NUMBER=1 scope=spfile sid='PROD1';

System altered.

SQL> alter system set INSTANCE_NUMBER=2 scope=spfile sid='PROD2';

System altered.


SQL> alter system set diagnostic_dest='/u01/app/oracle' scope=spfile sid='PROD1';

System altered.

SQL> alter system set diagnostic_dest='/u01/app/oracle' scope=spfile sid='PROD2';

System altered.

[oracle@rac1pub111 dbs]$ vi initPROD1.ora
[oracle@rac1pub111 dbs]$ orapwd file=orapwPROD1 password=manager
[oracle@rac1pub111 dbs]$ export ORACLE_SID=PROD1
[oracle@rac1pub111 dbs]$ !sq


node 2

[oracle@rac2pub112 dbs]$ mkdir -p /u01/app/oracle/admin/PROD/adump                  [oracle@rac2pub112 dbs]$

[oracle@rac2pub112 dbs]$ vi initPROD2.ora
[oracle@rac2pub112 dbs]$ orapwd file=orapwPROD2 password=manager
[oracle@rac2pub112 dbs]$ export ORACLE_SID=PROD2
[oracle@rac2pub112 dbs]$ !sq
SQL> startup
ORACLE instance started.

Total System Global Area  263090176 bytes
Fixed Size                  2252256 bytes
Variable Size             205521440 bytes
Database Buffers           50331648 bytes
Redo Buffers                4984832 bytes
Database mounted.
Database opened.
SQL>

SQL>  select status, instance_name  from gv$instance;

STATUS       INSTANCE_NAME
------------ ----------------
OPEN         PROD2
OPEN         PROD1

SQL>


[oracle@rac2pub112 admin]$ pwd
/u01/app/oracle/product/11204/dbhome/rdbms/admin
[oracle@rac2pub112 admin]$ ll catc
catcapi.sql   catcdc.sql    catclust.sql  catcrc.sql
catcapit.sql  catchnf.sql   catcmprm.sql  catcrsc.sql
catcap.sql    catcio.sql    catcmp.sql    catcr.sql
[oracle@rac2pub112 admin]$ ll catclust.sql
-rw-r--r-- 1 oracle oinstall 30182 Aug 12 16:26 catclust.sql
[oracle@rac2pub112 admin]$

FRom node 1


SQL> @?/rdbms/admin/catclust.sql;
 Node 2


SQL> sho parameter remote_listener;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_listener                      string      rcscan:1521
SQL>


node 1

# Generated by Oracle configuration tools.

DEV =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rcscan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DEV)
    )
  )


PROD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rcscan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PROD)
    )
  )

[oracle@rac1pub112 admin]$

 node 2:

DEV =
(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rcscan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DEV)
    )
  )


PROD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rcscan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PROD)
    )
  )



node 1

alter system set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=192.168.1.113)(PORT=1521))' scope=both sid='PROD1' ;

alter system set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=192.168.1.114)(PORT=1521))' scope=both sid='PROD2' ;


SQL> alter system register;

System altered.

SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

From node 1 only:


[oracle@rac1pub111 u01]$ srvctl add database -d PROD -o /u01/app/oracle/product/11204/dbhome -y AUTOMATIC

[oracle@rac1pub111 u01]$ srvctl config database -d prod
Database unique name: PROD
Database name:
Oracle home: /u01/app/oracle/product/11204/dbhome
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: PROD
Database instances:
Disk Groups:
Mount point paths:
Services:
Type: RAC
Database is administrator managed

[oracle@rac1pub111 u01]$ srvctl modify database -d PROD -p '+DATA/prod/spfile/spfilePROD.ora' -s open

[oracle@rac1pub111 u01]$ srvctl add instance -d PROD -i PROD1 -n rac1pub111
[oracle@rac1pub111 u01]$ srvctl add instance -d PROD -i PROD2 -n rac2pub112

node 1:
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

node 2:

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

NODE 1:

[oracle@rac1pub111 u01]$ srvctl start database -d PROD
[oracle@rac1pub111 u01]$ srvctl status database -d PROD
Instance PROD1 is running on node rac1pub111
Instance PROD2 is running on node rac2pub112
[oracle@rac1pub111 u01]$


No comments:

Post a Comment

Featured post

Migrate OCR & vote from external to normal or High redundancy in ASM

How to Move OCR & Vote from external to Normal or high. 1)  Create New diskgroup(CRS) with suitable redundancy for OCR and Voting files....

Popular Posts