Environment
Source :
DB Name: TESTDB
Hostname: rac1
DB Version : 11.2.0.4
Archive Log Mode : Yes
Database File Storage Type: File System
Target :
DB Name : TESTRAC
Nodes: rac1, rac2
instance names: testrac1,testrac2
DB Version : 11.2.0.4
Database File Storage Type: ASM
The migration is done in 3 phases
Phase 1: Duplicate data to ASM storage and start instance on Node 1
Phase 2: Enable Node 2
Phase 3: Register database in OCR
Phase 1: Duplicate data to ASM storage and start instance on Node 1
Step 1: Copy the source ORACLE_HOME to any directory for Target database ORACLE_HOME
Step 2: Create the directory structure in ASM Diskgroups to store database files and archive files of target RAC database
Set the grid environment as grid user and connect as sysasm to execute the below commands
Step 3: Take RMAN backup of source database, we use this backup to migrate data to ASM storage
- Create a directory /u01/oracle/TEST/rmanbkp for rman backup
- Configure RMAN in source database
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/oracle/TEST/rmanbkp/%F.ctl';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/u01/oracle/TEST/rmanbkp/%U.bkp';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/u01/oracle/TEST/rmanbkp/%U.bkp';
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/TEST/rmanbkp/snapcf_TESTDB.f';
- Execute the backup command
backup database plus archivelog;
- Ensure that backup was successfully completed
Step 4: Create a password file in source database
cd $ORACLE_HOME/dbs
orapwd file=orapw$ORACLE_SID
Copy the password file to target database at $ORACLE_HOME/dbs location and rename the file to orapwtestrac1
Step 5: Create an init file in target rac node1 and start the instance in nomount state
cd $ORACLE_HOME/dbs
vi inittestrac1.ora
db_name=TESTRAC
db_domain=charan.com
memory_target=1G
processes = 150
db_block_size=8192
diagnostic_dest=/u01/oracle/TEST/testracbase
open_cursors=300
remote_login_passwordfile=EXCLUSIVE
control_files = '+DATA/TESTDB/control01.ctl'
compatible =11.2.0
undo_tablespace=UNDOTS1
db_file_name_convert='/u01/oracle/TEST/testdata' '+DATA/TESTDB'
log_file_name_convert='/u01/oracle/TEST/testdata' '+DATA/TESTDB'
log_archive_dest='+DATA/TESTDB/ARCH'
Step 6: Configure Listener on rac node 1
cd $ORACLE_HOME/network/admin
vi listener.ora
lsnr_testrac1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.200)(PORT = 1522)) #RAC1VIP
)
)
)
SID_LIST_lsnr_testrac1 =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME =/u01/oracle/TESTRAC/11.2.0.4)
(SID_NAME = testrac1)
)
)
Step 7: Configure TNS names on source database to connect to rac1
cd $ORACLE_HOME/network/admin
vi tnsnames.ora
tns_testrac1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.200)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testrac1)
)
)
Step 8: Connect to source database and duplicate the database using RMAN
In my environment the rman backup is on the same directory structure on rac node1, hence the duplicate command picks the backup files from that directory else BACKUP LOCATION clause has to be specified on duplicate command
Ensure that the duplicate command completed successfully
Now we have storage migrated to ASM and database is open on node 1
Phase 2: Enable Node 2
Step 1: Shutdown the database on node1 and edit the init parameters to include all rac related parameters
[oracle@rac1 dbs]$ cat inittestrac1.ora.RAC
db_name=TESTRAC
db_domain=charan.com
processes = 150
db_block_size=8192
diagnostic_dest=/u01/oracle/TEST/testracbase
open_cursors=300
remote_login_passwordfile=EXCLUSIVE
control_files = '+DATA/TESTDB/control01.ctl'
compatible =11.2.0
db_file_name_convert='/u01/oracle/TEST/testdata' '+DATA/TESTDB'
log_file_name_convert='/u01/oracle/TEST/testdata' '+DATA/TESTDB'
log_archive_dest='+DATA/TESTDB/ARCH'
testrac1.undo_tablespace=UNDOTS
testrac2.undo_tablespace=UNDOTS2
testrac1.thread=1
testrac2.thread=2
testrac1.instance_number=1
testrac2.instance_number=2
cluster_database=true
cluster_database_instances=5
[oracle@rac1 dbs]$
Step 2: Create the spfile in shared storage
create spfile='+DATA/TESTDB/spfileTESTRAC.ora' from pfile;
Step 3: Edit the parameter file in node1 to include spfile and Start the database in node 1
[oracle@rac1 dbs]$ cat inittestrac1.ora
spfile='+DATA/TESTDB/spfileTESTRAC.ora'
[oracle@rac1 dbs]$
Step 4: Create undo tablespace, logfiles and enable node 2
Step 5: Copy the ORACLE_HOME from node1 to node2 and edit the init file to include global spfile and start the database on node2
mv inittestrac1.ora inittestrac2.ora
. testrac2.env
Phase 3: Register database in OCR
Step 1: shutdown the instances on both nodes
Step 2: As Oracle user execute the below commands
[oracle@rac1 ~]$ srvctl add database -d TESTRAC -o /u01/oracle/TESTRAC/11.2.0.4
[oracle@rac1 ~]$ srvctl add instance -d TESTRAC -i testrac1 -n rac1
[oracle@rac1 ~]$ srvctl add instance -d TESTRAC -i testrac2 -n rac2
[oracle@rac1 ~]$ srvctl start database -d TESTRAC
Check Status
crsctl stat res -t
That's it
Regards,
Charan