Tuesday, December 23, 2014

Oracle Database 12c Release 1 RAC On CentOS 6.4 Using VMWare Workstation


Resources:
https://gruffdba.wordpress.com/2013/07/10/oracle-12cr1-12-1-0-1-2-node-rac-on-centos-6-4-on-vmware-workstation-9-introduction/
http://oracle-base.com/articles/12c/oracle-db-12cr1-rac-installation-on-oracle-linux-6-using-virtualbox.php 
http://www.unixmen.com/dns-server-installation-step-by-step-using-centos-6-3/


             rac1                  rac2
        ----------------      --------------------
HDD        40GB                   40GB
eth0       1.0.2.5                1.0.2.6  vment2 Host-Only 
eth1       1.0.3.5                1.0.3.6  vmnet3 Host-Only
eth2       1.0.8.5                1.0.8.6  vmnet8 Nat


- install OS CentOS 6.4 64-bit

http://oracle-base.com/articles/linux/oracle-linux-6-installation.php
Desktop Environments > GNOME Desktop Environment
Applications > Editors
Applications > Graphical Internet
Development > Development Libraries
Development > Development Tools
Servers > Server Configuration Tools
Base System > Administration Tools
Base System > Base
Base System > System Tools
Base System > X Window System

- install VirtualBox additions
 

chmod +x ./VBoxLinuxAdditions.run
./VBoxLinuxAdditions.run


- install Packages using local yum repo
 

cd /etc/yum.repo.d/
mkdir oldrepo
mv ./* oldrepo
vim dvd.repo
[dvd]
name=dvd
baseurl=file:///media/CentOS_6.4_Final
gpgcheck=0
enabled=1
yum clean all
yum makecache
yum repolist


- install required packages for oracle RAC installation
 

yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
cd /
eject


- Amend the hostname in the "/etc/sysconfig/network" file.
 

vim /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=rac1.example.com


- Enter following data to “/ect/hosts”, comment rac-scan must be resolv by DNS server
 

vim /etc/hosts
127.0.0.1       localhost.localdomain   localhost

# Public
1.0.2.5   rac1.example.com   rac1
1.0.2.6   rac2.example.com   rac2

# Private
1.0.3.5   rac1-priv.example.com      rac1-priv
1.0.3.6   rac2-priv.example.com      rac2-priv

# Virtual
1.0.2.11   rac1-vip.example.com       rac1-vip
1.0.2.12   rac2-vip.example.com       rac2-vip

# SCAN
#1.0.2.15   rac-scan.example.com       rac-scan
#1.0.2.16   rac-scan.example.com       rac-scan
#1.0.2.17   rac-scan.example.com       rac-scan


- Edit "/etc/resolv.conf" file in clients in rac1, rac2
 

vim /etc/resolv.conf
nameserver 1.0.2.5
nameserver 1.0.2.6
nameserver 8.8.8.8
search example.com


- edit Network Additions for DNS Server in rac1, rac2ifcfg-eth2
 

vim /etc/sysconfig/network-scripts/ifcfg-eth0 >> PEERDNS=no
vim /etc/sysconfig/network-scripts/ifcfg-eth1 >> PEERDNS=no
vim /etc/sysconfig/network-scripts/ifcfg-eth2 >> PEERDNS=no


- Linux Kernel Parameters for Oracle 11gR2 on RHEL 5, Edit the /etc/sysctl.conf and add following lines:
 

vim /etc/sysctl.conf
# added for Oracle 12cR1
kernel.shmall = 2097152
kernel.shmmax = 3221225472
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

- Now execute “sysctl -p” command to apply the new settings:
 

/sbin/sysctl -p


- Edit the /etc/security/limits.conf file and add following lines:
 

vim /etc/security/limits.conf
# added for Oracle 12cR1
oracle              soft   nproc   2047
oracle              hard   nproc   16384
oracle              soft   nofile  1024
oracle              hard   nofile  65536
oracle              soft   stack   10240
oracle              hard   stack   10240


- Edit the /etc/pam.d/login file and add following line:
 

vim /etc/pam.d/login
# added for Oracle 12cR1
session    required     pam_limits.so


- To make the change permanent, modify the /etc/sysconfig/selinux change value of SELINUX variable to disabled:
 

vim  /etc/sysconfig/selinux
SELINUX=disabled


- To permanently disable the firewall we will disable the service:
 

service iptables stop
chkconfig iptables off


- create the user oracle account and the OS groups:
 

groupadd dba
groupadd oper
groupadd oinstall
groupadd asmdba
groupadd asmadmin
useradd -g oinstall -G dba,oper,asmdba,asmadmin oracle
passwd oracle


- Create the directories in which the Oracle software will be installed.
 

mkdir -p /u01/app/12102/grid
mkdir -p /u01/app/oracle/product/12102/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01/


- Login as the "oracle" user and add the following lines at the end of the "/home/oracle/.bash_profile" file.
 

vim /home/oracle/.bash_profile
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=rac1.example.com
export ORACLE_UNQNAME=cdbrac.example.com
export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=/u01/app/12102/grid
export DB_HOME=$ORACLE_BASE/product/12102/db_1
export ORACLE_HOME=$DB_HOME
export ORACLE_SID=cdbrac1
export ORACLE_TERM=xterm
export BASE_PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$BASE_PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

alias grid_env='. /home/oracle/grid_env'
alias db_env='. /home/oracle/db_env'


- Create a file called "/home/oracle/grid_env" with the following contents.
 

vim /home/oracle/grid_env
export ORACLE_SID=+ASM1
export ORACLE_HOME=$GRID_HOME
export PATH=$ORACLE_HOME/bin:$BASE_PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib


- Create a file called "/home/oracle/db_env" with the following contents.
 

vim /home/oracle/db_env
export ORACLE_SID=cdbrac1
export ORACLE_HOME=$DB_HOME
export PATH=$ORACLE_HOME/bin:$BASE_PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib



##################### clone Virtual Machine rac1 to rac2 #######################

- in rac1 after poweroff click Edit Virtual Machine Settings > Add > Hard Disk > SCSI >
- Create New Virtual Disk > Space 20 GB, Check Allocate All disk Space now ,
- Store Virtual Disks As Single file > Finish
- from settings > Advanced > select SCSI 1:0 Indepedent , Persisent > Close
- Add same disk to rac2
- edit .vmx file for rac1, rac2
 

- $ vim /data/vmware/rac121-node1/rac121-node1.vmx (in phyiscal machine)

disk.EnableUUID = "TRUE"
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
scsi1.sharedBus = "virtual"


after this line in .vmx file
 

replay.supported = "FALSE"


- $ vim /data/vmware/rac121-node2/rac121-node2.vmx (in phyiscal machine) add theses lines
 

disk.EnableUUID = "TRUE"
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
scsi1.sharedBus = "virtual"


after this line in .vmx file
 

replay.supported = "FALSE"


################ edit changes after clone rac1 to rac2 (in rac2) #################
- Amend the hostname in the "/etc/sysconfig/network" file.
 

vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=rac2.example.com


- Edit the "/etc/sysconfig/network-scripts/ifcfg-eth0, eth1 to change ip address for rac2
 

eth0    1.0.2.6       255.255.255.0           internal Network
eth1    1.0.3.6       255.255.255.0           internal Network
eth2    1.0.8.6       255.255.255.0    1.0.8.2    nat


- Edit the "/home/oracle/.bash_profile" file on the "rac2" node to correct the ORACLE_SID and ORACLE_HOSTNAME values.
 

ORACLE_SID=cdbrac2; export ORACLE_SID
ORACLE_HOSTNAME=rac2.example.com; export ORACLE_HOSTNAME


- Also, amend the ORACLE_SID setting in the "/home/oracle/db_env" and "/home/oracle/grid_env" files.
- Create a file called "/home/oracle/grid_env" with the following contents.
 

vim /home/oracle/grid_env
ORACLE_SID=+ASM2; export ORACLE_SID


- edit a file called "/home/oracle/db_env" with the following contents.
 

vim /home/oracle/db_env
ORACLE_SID=cdbrac2; export ORACLE_SID


############### Configure Shared Disks and UDEV rules ###############
-Use the "fdisk" command to partition the disks sdb to sde in rac1.
 

fdisk /dev/sdb > n > p > 1 > w


- 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.
 

/sbin/scsi_id -g -u -d /dev/sdb
36000c29552c32294599f95242522e11a


- Using these values above, edit the "/etc/udev/rules.d/99-oracleasm.rules" in rac1
 

vim /etc/udev/rules.d/99-oracleasm.rules
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="36000c29552c32294599f95242522e11a", NAME="asm-disk1", OWNER="oracle", GROUP="asmadmin", MODE="0660"



- start UDEV and list shared disks in rac1
 

/sbin/start_udev
ls -al /dev/asm*


- just refersh disk table and add rules in rac2
 

fdisk /dev/sdb > u > p > w


- Edit "/etc/udev/rules.d/99-oracleasm.rules" file
 

vim /etc/udev/rules.d/99-oracleasm.rules
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="36000c29552c32294599f95242522e11a", NAME="asm-disk1", OWNER="oracle", GROUP="asmadmin", MODE="0660"



- start UDEV and list shared disks in rac2
 

/sbin/start_udev
ls -al /dev/asm*



############ install NTP server #################
 

1.0.2.5       rac1.example.com    NTP Server
1.0.2.6       rac6.example.com    NTP Server


- NTP Server configure in rac1, rac2 same steps
 

chkconfig ntpd on


- Edit "/etc/ntp.conf" file
 

vim /etc/ntp.conf
restrict 1.0.2.0 mask 255.255.255.0 nomodify notrap
server  1.0.2.5
server  1.0.2.6
fudge   1.0.2.6 stratum 10
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
 

- Edit /etc/sysconfig/ntpd file:
 

vim /etc/sysconfig/ntpd
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid -g"
SYNC_HWCLOCK=no

chown ntp:ntp /etc/ntp

/etc/init.d/ntpd restart

ntpq -p

    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
rac1.example.co .INIT.          16 u    - 1024    0    0.000    0.000   0.000
rac2.example.co .INIT.          16 u  592 1024    0    0.000    0.000   0.000


############# DNS Master & Slave Server configuration #################
 

1.0.2.5       rac1.example.com    DNS Master
1.0.2.6       rac2.example.com    DNS Slave


############ DNS Master configuration (rac1) ################
 

yum install -y bind bind-libs bind-utils


- Edit main DNS file "named.conf"
 

vim /etc/named.conf
options {
       listen-on port 53 { 1.0.2.5; };
       directory       "/var/named";
       dump-file       "/var/named/data/cache_dump.db";
       statistics-file "/var/named/data/named_stats.txt";
       memstatistics-file "/var/named/data/named_mem_stats.txt";
       allow-query     { 1.0.2.0/24; };
       allow-transfer { 1.0.2.6;};
       recursion yes;

       dnssec-enable yes;
       dnssec-validation yes;
       dnssec-lookaside auto;

       bindkeys-file "/etc/named.iscdlv.key";
       managed-keys-directory "/var/named/dynamic";
};

logging {
       channel default_debug {
               file "data/named.run";
               severity dynamic;
       };
};

zone "." IN {
       type hint;
       file "named.ca";
};

zone "example.com." IN {
       type master;
       file "example.fwd";
       allow-update { none; };
};

zone "2.0.1.in-addr.arpa." IN {
       type master;
       file "example.rev";
       allow-update { none; };
};

include "/etc/named.root.key";


- Create "example.fwd" and "example.rev" files:
 

cd /var/named/
cp -v localdomain.zone example.fwd
cp -v named.local example.rev


- Edit "/var/named/example.fwd" to set forward zone
 

vim /var/named/example.fwd

$TTL 86400
@   IN  SOA     rac1.example.com. root.rac1.example.com. (
       2011071001  ;Serial
       3600        ;Refresh
       1800        ;Retry
       604800      ;Expire
       86400       ;Minimum TTL
)
@          IN NS   rac1.example.com.
@          IN NS   rac2.example.com.
@               IN A    1.0.2.5
@              IN A    1.0.2.6
@           IN A    1.0.2.11
@           IN A    1.0.2.12
@           IN A    1.0.2.15
@          IN A    1.0.2.16
@           IN A    1.0.2.17
rac1            IN A    1.0.2.5
rac2            IN A    1.0.2.6
rac1-vip        IN A    1.0.2.11
rac2-vip        IN A    1.0.2.12
rac-scan        IN A    1.0.2.15
rac-scan        IN A    1.0.2.16
rac-scan        IN A    1.0.2.17


- Edit "/var/named/example.rev" to set reverse zone
 

vim /var/named/example.rev
$TTL    86400
@       IN      SOA     rac1.example.com. root.rac1.example.com.  (
                                     1997022700 ; Serial
                                     28800      ; Refresh
                                     14400      ; Retry
                                     3600000    ; Expire
                                     86400 )    ; Minimum
@          IN NS   rac1.example.com.
@          IN NS   rac2.example.com.
@          IN PTR    example.com.
rac1            IN A    1.0.2.5
rac2            IN A    1.0.2.6
rac1-vip        IN A    1.0.2.11
rac2-vip        IN A    1.0.2.12
rac-scan        IN A    1.0.2.15
rac-scan        IN A    1.0.2.16
rac-scan        IN A    1.0.2.17
5          IN PTR  rac1.example.com.
6          IN PTR  rac2.example.com.
11         IN PTR  rac1-vip.example.com.
12         IN PTR  rac2-vip.example.com.
15            IN PTR  rac-scan.example.com.
16         IN PTR  rac-scan.example.com.
17         IN PTR  rac-scan.example.com.


- change chroot premission to "named" group
 

chgrp named /etc/named.conf
chgrp named /var/named/example.fwd
chgrp named /var/named/example.rev


- Test DNS configuration and zone files for any syntax errors
 

named-checkconf  /etc/named.conf
named-checkzone example.com /var/named/example.fwd
named-checkzone example.com /var/named/example.rev


############### Configure Slave DNS Server ##############
 

yum install -y bind bind-libs bind-utils


- Edit main DNS file "named.conf"
 

vim /var/named.conf
options {
       listen-on port 53 { 1.0.2.6; };
       directory       "/var/named";
       dump-file       "/var/named/data/cache_dump.db";
       statistics-file "/var/named/data/named_stats.txt";
       memstatistics-file "/var/named/data/named_mem_stats.txt";
       allow-query     { 1.0.2.0/24; };
       recursion yes;

       dnssec-enable yes;
       dnssec-validation yes;
       dnssec-lookaside auto;

       bindkeys-file "/etc/named.iscdlv.key";
       managed-keys-directory "/var/named/dynamic";
};

logging {
       channel default_debug {
               file "data/named.run";
               severity dynamic;
       };
};

zone "." IN {
       type hint;
       file "named.ca";
};

zone "example.com." IN {
       type slave;
       file "slaves/example.fwd";
       allow-update { none; };
       masters { 1.0.2.5; };
};
zone "2.0.1.in-addr.arpa." IN {
       type slave;
       file "slaves/example.rev";
       allow-update { none; };
       masters { 1.0.2.5; };
};

include "/etc/named.root.key";


- restart DNS server in rac1, rac2
 

/etc/init.d/named restart


- Verfiy DNS Server working in rac1, rac2
 

dig rac1.example.com
dig rac2.example.com
dig -x 1.0.2.5
dig -x 1.0.2.6
nslookup rac1
nslookup rac2
nslookup rac1-vip
nslookup rac2-vip
nslookup rac-scan


############### install grid software ##################
- Extract grid software to rac1 and extract it to gird as user oracle
 

[oracle@rac1 ~]$ cd /media/CDROM/
[oracle@rac1 ~]$ unzip -d /tmp/ ./linuxamd64_12102_grid_1of2.zip
[oracle@rac1 ~]$ unzip -d /tmp/ ./linuxamd64_12102_grid_2of2.zip
[oracle@rac1 ~]$ unzip -d /tmp/ ./linuxamd64_12102_database_1of2.zip
[oracle@rac1 ~]$ unzip -d /tmp/ ./linuxamd64_12102_database_2of2.zip


- set up password sharing:
 

cd /tmp/grid/sshsetup/
./sshUserSetup.sh -user oracle -hosts "rac1 rac2" -noPromptPassphrase -confirm -advanced

- runcluvfy.sh script is used to ensure your cluster is ready for the grid install
cd grid
./runcluvfy.sh stage -pre crsinst -n rac1,rac2
./runInstaller


################## install database software ##################
 

cd /tmp/database/
./runInstaller


################# Verify RAC installation ###################
 

srvctl config database -d cdbrac
srvctl status database -d cdbrac
srvctl status listener
srvctl status asm
sqlplus as sysdba
SELECT inst_name FROM v$active_instances;


################# shutdown RAC database ######################
 

srvctl stop database -d cdbrac
srvctl stop instance -d cdbrac -i cdbrac1,cdbrac2
srvctl stop asm -n rac1 -o immediate


No comments:

Post a Comment