Create Manual oracle11g RAC Database

My Existing RAC Environment

Linux : RHEL 5.5 RAW DISK
Oracle11g R2 Version: 11.2.0.1.0 Two Node GRID/Cluster

Interconnect : Cross Over Cable

Shared Storage : Linux NFS Server

All Database Sharing Single NFS Directory: /u01/oradata

Existing Network Configuration

-bash-3.2$ cat /etc/hosts
#Public Ips
192.168.1.246 myrac1
192.168.1.247 myrac2
#Private Ips
10.10.0.1 myrac1-priv
10.10.0.2 myrac2-priv
#Virtual Ips
192.168.1.251 my1-vip
192.168.1.252 my2-vip
# SCAN Ip
192.168.1.244 rac-scan
#NFS IP
192.168.1.245 racnas

Created the shared NFS Directory
/u01/oradata/DEMO
/u01/oradata/DEMO/CONTROLFILE

Create the local Directory Directory in both the rac nodes

/u01/app/oracle/admin/DEMO

Step-1 Create the Initialization Parameter file

DEMOinit1.ora

*.control_files='/u01/oradata/DEMO/CONTROLFILE/control01.ctl'
*.audit_file_dest='/u01/app/oracle/admin/DEMO/adump'
*.diagnostic_dest='/u01/app/oracle'
*.compatible='11.2.0.0.0'
*.core_dump_dest='/u01/app/oracle/admin/DEMO/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='DEMO'
*.sga_target = 250M
*.job_queue_processes=10
*.log_checkpoints_to_alert=TRUE
*.processes=100
*.remote_listener='LISTENERS_DEMO'
*.remote_login_passwordfile='exclusive'
*.sessions=200
*.undo_management='AUTO'
DEMO1.instance_name = DEMO1

Step-2 Create the Single Instance Database

vi createDB_DEMO.sql

CREATE DATABASE DEMO
MAXINSTANCES 8
MAXLOGHISTORY 100
MAXLOGFILES 64
MAXLOGMEMBERS 3
MAXDATAFILES 150
DATAFILE '/u01/oradata/DEMO/system01.dbf' SIZE 300M AUTOEXTEND ON NEXT 10240K MAXSIZE 1024M EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/oradata/DEMO/sysaux01.dbf' SIZE 200M AUTOEXTEND ON NEXT 10240K MAXSIZE 800M
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/oradata/DEMO/temp01.dbf' SIZE 200M AUTOEXTEND ON NEXT 10M MAXSIZE 1000M EXTENT MANAGEMENT LOCAL
UNDO TABLESPACE UNDOTBS1 DATAFILE '/u01/oradata/DEMO/undotbs01.dbf' SIZE 200M AUTOEXTEND ON NEXT 10M MAXSIZE 1000M
LOGFILE
GROUP 1 ('/u01/oradata/DEMO/redo01.log') SIZE 10M,
GROUP 2 ('/u01/oradata/DEMO/redo02.log') SIZE 10M,
GROUP 3 ('/u01/oradata/DEMO/redo03.log') SIZE 10M;

export ORACLE_SID=DEMO1
-bash-3.2$ sqlplus ‘/as sysdba’

SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 9 18:09:44 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> startup nomount PFILE=’$ORACLE_HOME/dbs/initDEMO.ora’
ORACLE instance started.

Total System Global Area 264241152 bytes
Fixed Size 1218868 bytes
Variable Size 88082124 bytes
Database Buffers 171966464 bytes
Redo Buffers 2973696 bytes

SQL> @createDB_DEMO.sql
Note:
You should create a user tablespace and make it the database default tablespace to avoid objects “accidentally” stored
in SYSTEM or SYSAUX.

SQL> CREATE TABLESPACE USERS DATAFILE '/u01/oradata/DEMO/users01.dbf' SIZE 5M;
SQL> ALTER DATABASE DEFAULT TABLESPACE USERS;

===============================================================================================================
Step-3 Convert your single instance to a RAC database

Note: A few more steps are now necessary to convert your single instance to a RAC database. Edit initDEMO1.ora and add
the cluster parameters:
*.cluster_database_instances=2
*.cluster_database=true
DEMO1.instance_number=1
DEMO2.instance_number=2
DEMO2.thread=2
DEMO1.thread=1
*.undo_management=’AUTO’
DEMO1.undo_tablespace=’UNDOTBS1′
DEMO2.undo_tablespace=’UNDOTBS2′
DEMO1.instance_name = DEMO1
DEMO1.instance_name = DEMO2

SQL> CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE '/u01/oradata/DEMO/undotbs2.dbf' SIZE 200M;

SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 4 ('/u01/oradata/DEMO/redo4.0') SIZE 50M;
SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 5 ('/u01/oradata/DEMO/redo5.0') SIZE 10M;
SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 6 ('/u01/oradata/DEMO/redo6.0') SIZE 10M;

vi $ORACLE_HOME/dbs/initDEMO1.ora

*.control_files=’/u01/oradata/DEMO/CONTROLFILE/control01.ctl’
*.audit_file_dest=’/u01/app/oracle/admin/DEMO/adump’
*.diagnostic_dest=’/u01/app/oracle’
*.compatible=’11.2.0.0.0′
*.core_dump_dest=’/u01/app/oracle/admin/DEMO/cdump’
*.db_block_size=8192
*.db_domain=”
*.db_file_multiblock_read_count=16
*.db_name=’DEMO’
*.sga_target = 250M
*.job_queue_processes=10
*.log_checkpoints_to_alert=TRUE
*.processes=100
*.remote_listener=’LISTENERS_DEMO’
*.remote_login_passwordfile=’exclusive’
*.sessions=200
DEMO1.undo_management=’AUTO’
DEMO1.instance_name = DEMO1

*.cluster_database_instances=2
*.cluster_database=true
DEMO1.instance_number=1
DEMO2.instance_number=2
DEMO2.thread=2
DEMO1.thread=1
DEMO2.undo_management=’AUTO’
DEMO1.undo_tablespace=’UNDOTBS1′
DEMO2.undo_tablespace=’UNDOTBS2′
DEMO1.instance_name = DEMO1
DEMO1.instance_name = DEMO2

#Copy the Parameter file to second rac node
scp initDEMO1.ora oracle@rac2:$ORACLE_HOME/dbs/initDEMO2.ora

Note:
Issue a “shutdown immediate” now, then start the instance. It should come up ok, you’ll find additional information in the alert.log about RAC specifics. The important bit is the message stating that the database is mounted in shared mode
(CLUSTER_DATABASE=TRUE).

[oracle@rac1 ~]$

SQL> SHUT IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP PFILE='$ORACLE_HOME/dbs/initDEMO1.ora'
ORACLE instance started.

Total System Global Area 264241152 bytes
Fixed Size 1218868 bytes
Variable Size 88082124 bytes
Database Buffers 171966464 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database open.

SQL> SELECT NAME FROM V$CONTROLFILE;

NAME
--------------------------------------------------------------------------------
+DATA/demo/controlfile/control01.ctl

SQL> SHOW PARAMETER CLUSTER_DATABASE;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
SQL> ALTER DATABASE OPEN;

Database altered.

SQL> ALTER DATABASE ENABLE PUBLIC THREAD 2;

Database altered.

SQL> SELECT INSTANCE_NAME FROM gv$instance;

INSTANCE_NAME
----------------
DEMO1
DEMO2

SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Current log sequence 1
SQL>

[oracle@rac2 ~]$ export ORACLE_SID=DEMO2

[oracle@rac2 ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 9 18:09:44 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup PFILE='$ORACLE_HOME/dbs/initDEMO2.ora
ORACLE instance started.

Total System Global Area 264241152 bytes
Fixed Size 1218868 bytes
Variable Size 88082124 bytes
Database Buffers 171966464 bytes
Redo Buffers 2973696 bytes
Database mounted
Database open

SQL> select instance_name from gv$instance;

INSTANCE_NAME
----------------
DEMO1
DEMO2

SQL>

I don't recmmend running RAC with pfiles, that never has been a good idea. Rather, I'd create the spfile in ASM:

SQL> create spfile='/u01/oradata/DEMO/spfiledemo.ora' from pfile;

File created.

Note:
rac node1

vi $ORACLE_HOME/dbs/initDEMO1.ora
SPFILE=’/u01/oradata/DEMO/spfiledemo.ora’

rac node2
vi $ORACLE_HOME/dbs/initDEMO2.ora
SPFILE=’/u01/oradata/DEMO/spfiledemo.ora’

Step-4 Configure the listener and tnsnames

DEMO =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = demo)
)
)

DEMO2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = my2-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = demo)
(INSTANCE_NAME = DEMO2)
)
)

DEMO1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = my1-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = demo)
(INSTANCE_NAME = DEMO1)
)
)

Step-5 Create the Password file

rac node-1

orapwd file=/u01/app/oracle/product/11.2.0/db_1/dbs/orapwDEMO1 password=oracle entries=5

rac node-2
orapwd file=/u01/app/oracle/product/11.2.0/db_1/dbs/orapwDEMO2 password=oracle entries=5

Step-6 Run Data Dictionary Scripts:

@$ORACLE_HOME/rdbms/admin/catalog.sql
@$ORACLE_HOME/rdbms/admin/catproc.sql
@$ORACLE_HOME/rdbms/admin/catclust.sql
@$ORACLE_HOME/rdbms/admin/utlrp.sql

Step-7 Register the database and its instances with Clusterware as oracle

Shut down both instances next and register the database and its instances with Clusterware as oracle:

-bash-3.2$ srvctl add database -d DEMO -o $ORACLE_HOME
-bash-3.2$ srvctl add instance -d DEMO -i DEMO1 -n myrac1
-bash-3.2$ srvctl add instance -d DEMO -i DEMO2 -n myrac2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.