Pages

Monday, 29 July 2013

NON RAC to RAC Cloning

Clone from NON RAC to RAC DATABASE/Convert Standalone database to RAC

Source:-

Server: prodserver
DBname: Prod

Targert:-

Server: testserver:
DBname: test

Note: Even though cloning from non RAC to RAC database. Carry out steps on one node and later make it as RAC database.


1. Clone the database from source server to target server using RMAN active clone.
2. Convert single instance database to RAC database.


 Step1:

Clone the database from source server to target server using RMAN active clone.

Pre-requisite steps:
a.    Create a pfile that contains the db_name entry

*.audit_file_dest='/u01/app/oracle/product/admin/test/adump'
*.audit_trail='db'
*.cell_offload_processing=FALSE
*.compatible='11.1.0.0.0'
*.control_files='+DG1/test/controlfile/Current.7957.805542455'
*.db_block_size=16384
*.db_create_file_dest='+DG1'
*.db_domain=''
*.db_name='test'
*.db_unique_name='test'
*.diagnostic_dest='/u01/app/oracle/product'
#*.log_archive_dest_1='LOCATION=+DG1/'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=1220542464
*.processes=600
*.remote_login_passwordfile='exclusive'
*.sessions=665
*.sga_target=1610612736
*.db_recovery_file_dest=+DG1
*.db_recovery_file_dest_size=50g
*.db_file_name_convert='+DG1','+DG1'
*.log_file_name_convert='+DG1','+DG1'

b.    Create a password file in the Oracle Home with the same sys password as the source database sys password

orapwd file=orapwtest password=password ignorecase=y

Make sure both prod and test password files are available in O_H/dbs directory of source and target
prodserver: /u01/app/oracle/product/11.1.0.7/dbs
$ scp orapwprod oracle@testserver:/u01/app/oracle/product/11.1.0/db_2/dbs
orapwprod                                                                                                                        100% 1536     1.5KB/s   00:00
prodserver: /u01/app/oracle/product/11.1.0.7/dbs
$ scp orapwtest oracle@testserver:/u01/app/oracle/product/11.1.0/db_2/dbs
orapwtest                                                                                                                         100% 1536     1.5KB/s   00:00

c.    Start the duplicate instance in nomount state

startup nomount;

d.    Configure listener on target as we have already on source

Go to grid home listener.ora add the below entry

SID_LIST_LISTENER =
        (SID_LIST =        
        (SID_DESC =              
        (GLOBAL_DBNAME = test)              
        (SID_NAME = test)                
         (ORACLE_HOME =/u01/app/oracle/product/11.1.0/db_2)
                (UR=A)
                )  
        )

lsnrctl reload listener

lsnrctl check status

e.    Create tns entries on both source and target
 Go to database instance oracle home and the below entries

test_tgt =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = testserver)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = test)
    )
  )

prod_sr =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = prodserver)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = prod)
    )
  )

f.     Check the connectivity to sqlplus on both source and target using password file.

sqlplus sys@test_tgt as sysdba
sqlplus sys@prod1_sr as sysdba

Start clone:

Connect to rman from target:

rman target sys/oracle@prodp_sr auxiliary sys/oracle@test_tgt log=/home/oracle/active_clone_test.log 
DUPLICATE TARGET DATABASE TO test FROM ACTIVE DATABASE nofilenamecheck;
run
{
  ALLOCATE CHANNEL ch1 DEVICE TYPE disk;
  ALLOCATE CHANNEL ch2 DEVICE TYPE disk;
  ALLOCATE CHANNEL ch3 DEVICE TYPE disk;
  ALLOCATE CHANNEL ch4 DEVICE TYPE disk;
  ALLOCATE CHANNEL ch5 DEVICE TYPE disk;
  ALLOCATE AUXILIARY CHANNEL ach1 DEVICE TYPE disk format '+DG1';
  ALLOCATE AUXILIARY CHANNEL ach2 DEVICE TYPE disk format '+DG1';
  ALLOCATE AUXILIARY CHANNEL ach3 DEVICE TYPE disk format '+DG1';
  ALLOCATE AUXILIARY CHANNEL ach4 DEVICE TYPE disk format '+DG1';
  ALLOCATE AUXILIARY CHANNEL ach5 DEVICE TYPE disk format '+DG1';
duplicate target database to test from active database nofilenamecheck;
}


Convert single instance database to RAC database

On target:

Update controlfile file in the pfile.

Make sure Cluster database is TRUE.

Add/Modify parameters related to instances

ALTER DATABASE ADD LOGFILE THREAD 2
 GROUP 5  SIZE 52428800,
 GROUP 6  SIZE 52428800;

alter database enable public thread 2;

Create undo tablespace UNDOTBS3 datafile size 3000M;

Create spfile centralized spfile

create spfile='+DG1/test/spfiletest.ora' from pfile;

Create pfile in other node

Vi inittest2.ora
SPFILE='+DG1/test/spfiletest.ora'

Perform a precheck before starting the database with srvctl

Start the db manually in all nodes. Shut database in all nodes.

Register the database with cluster

srvctl add database -d test -o /u01/app/oracle/product/11.2.0.3.0/db_1

srvctl add instance -d test -i test1 -n testserver

srvctl add instance -d test -i test2 -n testserver

srvctl add service -d test -s test_srv -r "test1,test2 "

srvctl start database -d test  
    
srvctl status service –d test_srv

srvctl status service –d test


No comments:

Post a Comment