18 June 2018

Convert single instance database to a clustered database

Clusterize the database

oh; cd dbs
cp initDBNAME.ora initDBNAME.ora.singleinstance

create pfile='/oracle/DBNAME/121/dbs/initDBNAME.ora' from spfile;

vi initDBNAME.ora
Add:
*.cluster_database = TRUE
*.remote_listener='scanename:xxx'
DBNAME1.instance_number=1
DBNAME2.instance_number=2
DBNAME1.thread=1
DBNAME2.thread=2
DBNAME1.undo_tablespace='UNDO1'
DBNAME2.undo_tablespace='UNDO2'
If you see andy DBNAME.__ parameters, change them to DBNAME1 and DBNAME2. Example:
DBNAME1__db_cache_size=1895825408
DBNAME2__db_cache_size=1895825408
Important: Remove *.undo_tablespace parameter

create undo tablespace PUNDO1 datafile '+ORADATA3' SIZE 2G AUTOEXTEND ON MAXSIZE 5G;
create undo tablespace PUNDO2 datafile '+ORADATA3' SIZE 2G AUTOEXTEND ON MAXSIZE 5G;

Add log files for thread 2

List log files from v$logfile;

#Add as many groups as you have in thread1, with the same size.
Example:
alter database add logfile thread 2 group 31 size 200M;
alter database add logfile thread 2 group 32 size 200M;
alter database add logfile thread 2 group 33 size 200M;
...
alter database enable public thread 2;

oh; cd dbs
cp initDBNAME.ora initDBNAME1.ora
cp initDBNAME.ora initDBNAME2.ora
cp orapwDBNAME orapwDBNAME1
cp orapwDBNAME orapwDBNAME2
vi ../network/admin/tnsnames.ora
Change DBNAME now to be:
DBNAME=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scanname)(PORT = xxxx))
    (CONNECT_DATA =  (SERVER = DEDICATED)  (SERVICE_NAME = DBNAME)  ) )

Start the new cluster database

shutdown immediate
#Start the both instance individually
export ORACLE_SID=DBNAME2
startup nomount pfile='/oracle/DBNAME/121/dbs/initDBNAME.ora'
create spfile='+ORADATA3/DBNAME/spfileDBNAME.ora' from pfile='/oracle/DBNAME/121/dbs/initDBNAME.ora';
shutdown immediate
startup pfile='/oracle/DBNAME/121/dbs/initDBNAME2.ora'

ssh to other node
export ORACLE_SID=DBNAME1
startup pfile='/oracle/DBNAME/121/dbs/initDBNAME1.ora'
!! shutdown immediate on BOTH nodes !!

srvctl add database -d DBNAME -o /oracle/DBNAME/121
srvctl add instance -d DBNAME -i DBNAME1 -n node1
srvctl add instance -d DBNAME -i DBNAME2 -n node2
srvctl modify database -d DBNAME -p '+ORADATA3/DBNAME/spfileDBNAME.ora'
srvctl config database -d DBNAME

srvctl start instance -i DBNAME2 -d DBNAME
srvctl start instance -i DBNAME1 -d DBNAME
srvctl stop database -d DBNAME
srvctl start database -d DBNAME

Voila!

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?