Tuesday, February 6, 2018

Oracle Database 12c Release 1 (12.1) RAC GRID Infrastructure installation

This is a step by step installation of Oracle 12cR1 RAC grid infrastructure on Virtual box.

Below are the high level steps

The network settings has to be adjusted accordingly






                                                                                                                                                                      Ram selected for both the nodes- 4 gb each

I have not covered the OS installation and creating the mounts as this is available in numerous blogs. You can create the virtual machine nodes accordingly.


Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.
Default user to own the driver interface [oracle]: oracle
Default group to own the driver interface [dba]: oinstall
Start Oracle ASM library driver on boot (y/n) [y]: y
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
[root@ebs1 ~]#
[root@ebs1 ~]# mkdir -p /u01/app/12.1.0/grid_1
[root@ebs1 ~]# mkdir -p /u01/app/oracle
[root@ebs1 ~]# chown -R oracle:oinstall /u01
[root@ebs1 ~]# chown oracle:oinstall /u01/app/oracle
[root@ebs1 ~]# chmod -R 775 /u01/
[root@ebs1 ~]#


Disable secure linux by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.

SELINUX=disabled


Either configure NTP, or make sure it is not configured so the Oracle Cluster Time Synchronization Service (ctssd) can synchronize the times of the RAC nodes. In this case we will deconfigure NTP.
# service ntpd stop
Shutting down ntpd:                                        [FAILED]
# chkconfig ntpd off






add the below in /etc/hosts file
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
#192.168.56.2   ebs1.oracle.com          ebs1
#192.168.56.4   rac2.localdomain          rac2
#192.168.56.3   ebs2.oracle.com           ebs2
#public
192.168.56.2   rac1.localdomain          rac1
192.168.56.3   rac2.localdomain          rac2
#private
192.168.100.101 rac1-priv.localdomain     rac1-priv
192.168.100.102  rac2-priv.localdomain     rac2-priv
#virtual
192.168.56.108  rac1-vip.localdomain    rac1-vip
192.168.56.109  rac2-vip.localdomain    rac2-vip
#Scan
192.168.56.105  rac-scan.localdomain    rac-scan
192.168.56.106  rac-scan.localdomain    rac-scan
192.168.56.107  rac-scan.localdomain    rac-scan

***************
Note-SCAN(started from 11g R2) provides a single domain name via DNS), allowing and-users to address a RAC cluster as-if it were a single IP address. SCAN works by replacing a hostname or IP list with virtual IP addresses (VIP).
Because SCAN determines the actual node and listener which accepts the connection, SCAN provides location independence for the databases.  A SCAN database connection does not require any details about a particular node on instance.  SCAN is part of the 11g release 2 movement toward "RAC Virtualization"

QA session:-

Does scan actually performs connection load balancing?

Yes, it does. The LREG process of each instance registers the database service with the local listener as well as all the SCAN listeners (typically they are specified by the parameter: REMOTE_LISTENER). When a connection request gets routed to a particular SCAN listener, then the SCAN listener does a quick calculation to find out the least loaded node, and once it gets that information, it sends the address of the local listener on that node back to the client to establish the connection. That is how load balancing is done by the SCAN listeners.

For clients connecting using SCAN, three IP addresses will be received by the client by resolving the SCAN name through DNS as discussed. The client will then go through the list it receives from the DNS and try connecting through one of the IPs received. If the client receives an error, it will try the other addresses before returning an error to the user or application. This is similar to how client connection failover works in previous releases when an address list is provided in the client connection string.
When a SCAN Listener receives a connection request, the SCAN Listener will check for the least loaded instance providing the requested service. It will then re-direct the connection request to the local listener on the node where the least loaded instance is running. Subsequently, the client will
be given the address of the local listener. The local listener will finally create the connection to the database instance


Difference between local listener and remote listener?

LOCAL_LISTENER on each node should point to the listener on that node. REMOTE_LISTENER should point to all listeners on all nodes if you want server side load balancing, otherwise don’t set REMOTE_LISTENER.
the purpose of REMOTE_LISTENER is to connect all instances with all listeners so the instances can propagate their load balance advisories to all listeners. if you connect to a listener, this listener uses the advisories to decide who should service your connect. if the listener decides its local instance(s) are least loaded and should service your connect it passes your connect to the local instance. if the node you connected to is overloaded,
the listener can use TNS redirect to redirect your connect a less loaded instance.

****************
As i am using 3 interfaces, i need to activate them.

First Node
1st ethernet is set to automatic and DHCP.
second ethernet is set to static 192.168.56.2 subnet mas-255.255.255.0  gateway-192.168.56.1
third ethernet is set to static 192.168.100.101 and subnet mask 255.255.255.0 and gateway blank

Second node(has to be done after clone)
eth0 - DHCP
eth1- 192.168.56.3, 255.255.255.0 192.168.56.1
eth2  - 192.168.100.102, 255.255.255.0 and gateway as blank




enable  PermitRootLogin to yes in  /etc/ssh/sshd_config.
[root@rac1 ~]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
[root@rac1 ~]#


[root@rac1 ~]# groupadd -g 54321 oinstall
groupadd: group oinstall exists--In my case it was already present
[root@rac1 ~]# groupadd -g 54322 dba
groupadd: group dba exists--In my case it was already present
[root@rac1 ~]# groupadd -g 54323 oper
[root@rac1 ~]# groupadd -g 54325 asmdba
[root@rac1 ~]# groupadd -g 54328 asmadmin
[root@rac1 ~]# groupadd -g 54329 asmoper

[root@rac1 ~]# /usr/sbin/useradd -u 54322 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
[root@rac1 ~]# useradd -u 54321 -g oinstall -G dba,asmdba,oper,asmadmin oracle
useradd: user oracle exists--In my case it was already present
[root@rac1 ~]#


Please modify below files to make compatible for RAC installation

/etc/selinux/config
SELINUX= permissive
/etc/systemd/logind.conf
RemoveIPC=no
/etc/sysconfig/network
NOZEROCONF=yes


Disable firewall services

systemctl stop firewalld.service
systemctl disable firewalld.service

Please add following entry in /etc/pam.d/login

session required /lib64/security/pam_limits.so
session required pam_limits.so

Please create following directory and change the permissions

[root@rac1 ~]# mkdir -p /u01/app/grid
[root@rac1 ~]# mkdir -p /u01/app/product
[root@rac1 ~]# mkdir -p /u01/app/oraInventory
[root@rac1 ~]# mkdir -p /u01/app/oracle
[root@rac1 ~]# chown -R oracle:oinstall /u01
[root@rac1 ~]# chown -R grid:oinstall /u01/app/oraInventory
[root@rac1 ~]# chown -R grid:oinstall /u01/app/grid
[root@rac1 ~]# chmod -R 775 /u01/
[root@rac1 ~]# chmod -R 770 /u01/app/oraInventory
[root@rac1 ~]# chown -R oracle:oinstall /u01
[root@rac1 ~]# chown -R grid:oinstall /u01/app/oraInventory
[root@rac1 ~]# chown -R grid:oinstall /u01/app/grid
[root@rac1 ~]# chmod -R 775 /u01/
[root@rac1 ~]# chmod -R 770 /u01/app/oraInventory

Please add/modify .bash_profile under oracle user in /home/oracle
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/12c/db_1
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH_64=$ORACLE_HOME/lib
export ORACLE_BASE ORACLE_HOME LD_LIBRARY_PATH LD_LIBRARY_PATH_64

TNS_ADMIN=$ORACLE_HOME/network/admin
LIB_PATH=$ORACLE_HOME/lib
SQLPATH=$ORACLE_HOME/lib
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export ORACLE_PROCDIR ORACLE_PATH ORACLE_PROC ORA_NLS10 NLS_LANG TNS_ADMIN LIB_PATH SQLPATH CLASSPATH

PATH=$PATH:$ORACLE_HOME/bin:/usr/ccs/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/sbin:/usr/ucb/bin:/usr/local/bin/:/usr/sfw/bin
export PATH

have not added ORACLE_SID as of now.

Please add/modify .bash_profile under grid user in /home/grid

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

export ORACLE_BASE=/u01/app/grid
ORACLE_HOME=$ORACLE_BASE/product/grid
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH_64=$ORACLE_HOME/lib
export ORACLE_BASE ORACLE_HOME LD_LIBRARY_PATH LD_LIBRARY_PATH_64


TNS_ADMIN=$ORACLE_HOME/network/admin
LIB_PATH=$ORACLE_HOME/lib
SQLPATH=$ORACLE_HOME/lib
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export ORACLE_PROCDIR ORACLE_PATH ORACLE_PROC ORA_NLS10 NLS_LANG TNS_ADMIN LIB_PATH SQLPATH CLASSPATH


PATH=$PATH:$ORACLE_HOME/bin:/usr/ccs/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/sbin:/usr/ucb/bin:/usr/local/bin/:/usr/sfw/bin
export PATH


I will use a single raw disks(/dev/sdd1) for creating a ASM diskgroup of 60 Gb size.

Please add following entry to enable SCSI

Add the following to the “/etc/scsi_id.config” file to configure SCSI devices as trusted. Create the file if it doesn’t already exist.
options=-g


Please identify SCSI ID using following command for each individual disk of ASM which is added and shared.
[root@rac1]# /usr/lib/udev/scsi_id -g -u -d /dev/sdd

1ATA_VBOX_HARDDISK_VB7a401c0f-c528452b

Now you need to use partprobe to refresh new partitions

[root@rac1 /]# /sbin/partprobe /dev/sdd1


clone the rac1 machine and make it rac2 in hostname. And intiaialize all the ethernet ips one by one


eth0 DHCP
eth1- 192.168.56.3, 255.255.255.0 192.168.56.1
eth2  - 192.168.100.102, 255.255.255.0 and gateway as blank

ping rac1 and rac2 from each of them

[root@rac1 ~]# oracleasm createdisk DISK1 /dev/sdd1
Writing disk header: done
Instantiating disk: done
[root@rac1 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@rac1 ~]# oracleasm listdisks
DISK1
login as: root
root@192.168.56.3's password:
Last login: Thu Jan 11 11:08:25 2018
[root@rac2 ~]#  oracleasm listdisks
[root@rac2 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "DISK1"
[root@rac2 ~]#  oracleasm listdisks
DISK1
[root@rac2 ~]#



==========================
Invoke the run installer now

Oracle Universal Installer has to run from Grid User 








Click on add



Click on SSh connectivity and click on setup.

















[grid@rac2 u01]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.asm
               ONLINE  ONLINE       rac1                     Started,STABLE
               ONLINE  ONLINE       rac2                     Started,STABLE
ora.net1.network
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.ons
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                     STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       rac1                     169.254.123.173 192.
                                                             168.100.101,STABLE
ora.cvu
      1        ONLINE  ONLINE       rac1                     STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       rac1                     Open,STABLE
ora.oc4j
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                     STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
--------------------------------------------------------------------------------
[grid@rac2 u01]$
Check the status of running clusterware. On rac1 as root user:
[root@rac1 grid]# crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.asm
               ONLINE  ONLINE       rac1                     Started,STABLE
               ONLINE  ONLINE       rac2                     Started,STABLE
ora.net1.network
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
ora.ons
               ONLINE  ONLINE       rac1                     STABLE
               ONLINE  ONLINE       rac2                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                     STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       rac1                     169.254.123.173 192.
                                                             168.100.101,STABLE
ora.cvu
      1        ONLINE  ONLINE       rac1                     STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       rac1                     Open,STABLE
ora.oc4j
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                     STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                     STABLE
--------------------------------------------------------------------------------
[root@rac1 grid]#


Now I will proceed for Oracle 12 database binary installation:-This will be done using Oracle user.
Login as Oracle user and invoke the installer
























lets check the status of the database
[oracle@rac1 bin]$ ps -ef|grep pmon
oracle   17755 14437  0 23:06 pts/2    00:00:00 grep pmon
grid     22615     1  0 18:55 ?        00:00:01 asm_pmon_+ASM1
grid     24307     1  0 18:57 ?        00:00:00 mdb_pmon_-MGMTDB
oracle   31684     1  0 22:09 ?        00:00:00 ora_pmon_PROD1

export ORACLE_SID=PROD1

[oracle@rac1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Fri Feb 2 00:39:08 2018

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> SELECT inst_name FROM v$active_instances;

INST_NAME
------------------------------------------------------------
rac1.localdomain:PROD1
rac2.localdomain:PROD2


[oracle@rac1 dbs]$ srvctl status database -d PROD
Instance PROD1 is running on node rac1
Instance PROD2 is running on node rac2

































No comments:

Post a Comment