Subscribe to Posts by Email

Subscriber Count

    696

Disclaimer

All information is offered in good faith and in the hope that it may be of use for educational purpose and for Database community purpose, but is not guaranteed to be correct, up to date or suitable for any particular purpose. db.geeksinsight.com accepts no liability in respect of this information or its use. This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content and if notify any such I am happy to remove. Product and company names mentioned in this website may be the trademarks of their respective owners and published here for informational purpose only. This is my personal blog. The views expressed on these pages are mine and learnt from other blogs and bloggers and to enhance and support the DBA community and this web blog does not represent the thoughts, intentions, plans or strategies of my current employer nor the Oracle and its affiliates or any other companies. And this website does not offer or take profit for providing these content and this is purely non-profit and for educational purpose only. If you see any issues with Content and copy write issues, I am happy to remove if you notify me. Contact Geek DBA Team, via geeksinsights@gmail.com

Pages

Step by Step Migrating RAC Database to a new Cluster

Excellent step by step document from my colleague, Venkat, with his kind permission I am publishing the same for all benefit.

Please note the following can be done using Duplicate database from active database without moving any backups etc. But that is another variant.

###########################################################################################
Copy RAC database to another RAC Server
###########################################################################################


	Task: Copy RAC database to another RAC Server over ASM.

	----------------
	Source details:
	----------------

	Server 			: SourceDBNode1/SourceDBNode2
	Backup Location 	: /u01/backup/backup

	--------------------
	Destination details:
	--------------------

	Server 			: DestinationNode1/DestinationNode2
	Backup Location 	: /u01/sq/backup

	Database Name to be converted: RACDB

	Assumptions : All the database files are stored on +DATA01 ASM Diskgroup and same diskgroup name is available on Destination Server.
		      In case of different location, need to  use ( db_file_name_convert, log_file_name_convert on destination pfile/spfile )
	

###########################################################################################
Step 1 : Backup the Source database and generate PFILE and copy to Destination path
###########################################################################################

	export ORACLE_SID=RACDB1

	#!/usr/bin/ksh
	rman target /  < < eof
	run {
	SHOW ALL;
	CONFIGURE BACKUP OPTIMIZATION ON;
	backup as compressed backupset format '/u01/backup/backup/%d_DB_%U_%D_%M_%Y' database plus archivelog delete all input tag='${ORACLE_SID}';
	backup as compressed backupset format '/u01/backup/backup/%d_ARCH_%U_%D_%M_%Y' archivelog all delete input tag='${ORACLE_SID}';
	backup as compressed backupset format '/u01/backup/backup/%d_CTL_%U_%D_%M_%Y' current controlfile tag='${ORACLE_SID}' ;
	backup as compressed backupset format '/u01/backup/backup/%d_SPF_%U_%D_%M_%Y' spfile tag='${ORACLE_SID}';
	}
	eof
	exit

	******* Take backup of pfile from source database
	create pfile='/u01/backup/backup/init_&_connect_identifier.ora' from spfile;

	******* Transfer the rman backups and pfile to Destination server
	

###########################################################################################
Step 2 : ORACLE BASE ,PFILE and Configuration on Node 1 - DestinationNode1
###########################################################################################

	echo "RACDB:/u01/sq/ora_1/db/11.2.0.3:N" >> /etc/oratab
	echo "RACDB1:/u01/sq/ora_1/db/11.2.0.3:N" >> /etc/oratab

	export ORACLE_SID=RACDB1
	mkdir -p /u01/sq/admin/RACDB
	cd /u01/sq/admin/RACDB

	mkdir create pfile cdump adump bdump udump

	cd /u01/sq/admin/RACDB/pfile

	--> Copy the source pfile generated to /u01/sq/admin/RACDB/pfile/

	cp /u01/sq/backup/init_RACDB1ora initRACDB.ora

	export ORACLE_SID=RACDB1

	orapwd file=$ORACLE_HOME/dbs/orapwRACDB1 password= entries=10 force=y ignorecase=y
	

###########################################################################################
Step 3 : Append RAC Specific parameters to init.ora file - on Node 1 - DestinationNode1
###########################################################################################

	*.cluster_database=FALSE
	*.control_files='+DATA01/RACDB/controlfile/control01.ctl','+FRA01/RACDB/controlfile/control02.ctl'
	*.remote_listener=':51100'

	******* Remove the listener specific parameters at this step.

	e.g Please refer to /u01/sq/admin/RACDB/pfile/initRACDB.ora
	

###########################################################################################
Step 4 : DB Restore and Recover from Node 1 - DestinationNode1
###########################################################################################

	export ORACLE_SID=RACDB1
	echo $ORACLE_SID $ORACLE_HOME

	sqlplus '/as sysdba'
	startup nomount pfile='/u01/sq/admin/RACDB/pfile/initRACDB.ora';

	rman target /
	restore controlfile from '/u01/sq/backup/RACDB_CTL_1dod8e62_1_1_27_06_2013';
	alter database mount;
	catalog start with '/u01/sq/backup/';

	run
	{
	ALLOCATE CHANNEL d1 DEVICE TYPE DISK;
	ALLOCATE CHANNEL d2 DEVICE TYPE DISK;
	ALLOCATE CHANNEL d3 DEVICE TYPE DISK;
	ALLOCATE CHANNEL d4 DEVICE TYPE DISK;
	ALLOCATE CHANNEL d5 DEVICE TYPE DISK;
	ALLOCATE CHANNEL d6 DEVICE TYPE DISK;
	ALLOCATE CHANNEL d7 DEVICE TYPE DISK;
	ALLOCATE CHANNEL d8 DEVICE TYPE DISK;
	ALLOCATE CHANNEL d9 DEVICE TYPE DISK;
	ALLOCATE CHANNEL d10 DEVICE TYPE DISK;
	restore database;
	recover database;
	}

	alter database open resetlogs;
	shu immediate;
	startup pfile='/u01/sq/admin/RACDB/pfile/initRACDB.ora';
	

###########################################################################################
Step 5 : Update the tnsnames.ora in both the Nodes
###########################################################################################

	# Entries for RACDB begin here - Do not remove this comment

	RACDB =
	  (DESCRIPTION =
	    (ADDRESS_LIST =
	      (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 51100))
	    )
	    (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RACDB)
	      (FAILOVER_MODE =
		(TYPE = SELECT)
		(METHOD = BASIC)
		(RETRIES = 100)
		(DELAY = 20)
	      )
	    )
	  )

	LISTENER_RACDB1 =
	  (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1522))

	RACDB1 =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1522))
	    (CONNECT_DATA = (SERVICE_NAME = RACDB) (INSTANCE_NAME = RACDB1))
	  )

	LISTENER_RACDB2 =
	  (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1522))

	RACDB2 =
	  (DESCRIPTION =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1522))
	    (CONNECT_DATA = (SERVICE_NAME = RACDB) (INSTANCE_NAME = RACDB2))
	  )

	LISTENERS_RACDB =
	  (ADDRESS_LIST =
	    (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1522))
	    (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1522))
	  )
	# Entries for RACDB end here - Do not remove this comment
	

###########################################################################################
Step 6 : PFILE and SPFILE Configuration on Node 1 - DestinationNode1
###########################################################################################

	cd $ORACLE_HOME/dbs/
	ln -s /u01/sq/admin/RACDB/pfile/initRACDB.ora .

	vi initRACDB1.ora
	SPFILE='+DATA01/RACDB/spfileRACDB.ora'

	export ORACLE_SID=RACDB1
	create spfile='+DATA01/RACDB/spfileRACDB.ora' from pfile='/u01/sq/admin/RACDB/pfile/initRACDB.ora';

	cd $ORACLE_HOME/dbs
	scp initRACDB1.ora initRACDB.ora orapwRACDB1 DestinationNode2:/u01/sq/ora_1/db/11.2.0.3/dbs/
	

###########################################################################################
Step 7 : ORACLE BASE , PFILE and SPFILE Configuration on Node 2 - DestinationNode2
###########################################################################################

 
	echo "RACDB:/u01/sq/ora_1/db/11.2.0.3:N" >> /etc/oratab
	echo "RACDB2:/u01/sq/ora_1/db/11.2.0.3:N" >> /etc/oratab

	cd /u01/sq/ora_1/db/11.2.0.3/dbs/
	mv orapwRACDB1 orapwRACDB2
	mv initRACDB1.ora initRACDB2.ora

	mkdir -p /u01/sq/admin/RACDB
	cd /u01/sq/admin/RACDB
	mkdir create pfile cdump adump bdump udump

	cd /u01/sq/ora_1/db/11.2.0.3/dbs/
	cp /u01/sq/ora_1/db/11.2.0.3/dbs/initRACDB.ora /u01/sq/admin/RACDB/pfile/
	rm -rf initRACDB.ora
	ln -s /u01/sq/admin/RACDB/pfile/initRACDB.ora .
	

###########################################################################################
Step 8 : Enable cluster specific parameters from Node 1 - DestinationNode1
###########################################################################################

	export ORACLE_SID=RACDB1
	echo $ORACLE_SID $ORACLE_HOME

	sqlplus '/as sysdba'

	shu immediate;
	startup;
	show parameter pfile;
	alter system set cluster_database=true scope=spfile;
	alter system set local_listener='LISTENER_RACDB1' scope=spfile sid='RACDB1';
	alter system set local_listener='LISTENER_RACDB2' scope=spfile sid='RACDB2';
	alter system set remote_listener='LISTENERS_RACDB' scope=spfile;
	

###########################################################################################
Step 9 : Add instances to Cluster from Node 1 - DestinationNode1
###########################################################################################

	export CRS_HOME=/u01/gi/oragrid/grid/11.2.0.3
	$CRS_HOME/bin/srvctl add database -d RACDB -o /u01/sq/ora_1/db/11.2.0.3 -p '+DATA01/RACDB/spfileRACDB.ora'
	$CRS_HOME/bin/srvctl add instance -d RACDB -i RACDB1 -n DestinationNode1
	$CRS_HOME/bin/srvctl add instance -d RACDB -i RACDB2 -n DestinationNode2

	srvctl status database -d RACDB 
	srvctl start instance -d RACDB -i RACDB1
	srvctl status database -d RACDB
	srvctl start instance -d RACDB -i RACDB2
	srvctl status database -d RACDB

	srvctl stop database -d RACDB
	srvctl start database -d RACDB
	srvctl status database -d RACDB
	

Comments are closed.