quarta-feira, 6 de julho de 2016

Linux OEL 6 or OEL 7 Configuration for Oracle Single or RAC



# ------------------------------------------------------------------------
# Configuration ON Linux
# ------------------------------------------------------------------------
# Installation
# ------------------------------------------------------------------------
# Set parameters on /etc/hosts
# ------------------------------------------------------------------------
#
echo "# Public" >> /etc/hosts
echo "#" >> /etc/hosts
echo "10.0.1.21         srv01.dbnitro.net          srv01" >> /etc/hosts
echo "10.0.1.22         srv02.dbnitro.net          srv02" >> /etc/hosts
echo "10.0.1.23         srv03.dbnitro.net          srv03" >> /etc/hosts
echo "10.0.1.24         srv04.dbnitro.net          srv04" >> /etc/hosts
echo "# Private" >> /etc/hosts
echo "#" >> /etc/hosts
echo "192.168.2.21          srv01-priv.dbnitro.net          srv01-priv" >> /etc/hosts
echo "192.168.2.22          srv02-priv.dbnitro.net          srv02-priv" >> /etc/hosts
echo "192.168.2.23          srv03-priv.dbnitro.net          srv03-priv" >> /etc/hosts
echo "192.168.2.24          srv04-priv.dbnitro.net          srv04-priv" >> /etc/hosts
echo "# Virtual" >> /etc/hosts
echo "#" >> /etc/hosts
echo "10.0.1.31          srv01-vip.dbnitro.net          srv01-vip" >> /etc/hosts
echo "10.0.1.32          srv02-vip.dbnitro.net          srv02-vip" >> /etc/hosts
echo "10.0.1.33          srv03-vip.dbnitro.net          srv03-vip" >> /etc/hosts
echo "10.0.1.34          srv04-vip.dbnitro.net          srv04-vip" >> /etc/hosts
echo "# SCAN" >> /etc/hosts
echo "#" >> /etc/hosts
echo "10.0.1.41          production.dbnitro.net          production" >> /etc/hosts
echo "10.0.1.42          production.dbnitro.net          production" >> /etc/hosts
echo "10.0.1.43          production.dbnitro.net          production" >> /etc/hosts
# ------------------------------------------------------------------------
# ------------------------------------------------------------------------
# Disable SELINUX
# ------------------------------------------------------------------------
vim /etc/sysconfig/selinux
# ------------------------------------------------------------------------
echo "# This file controls the state of SELinux on the system."                  > /etc/sysconfig/selinux
echo "# SELINUX= can take one of these three values:"                          >> /etc/sysconfig/selinux
echo "#     enforcing - SELinux security policy is enforced."                    >> /etc/sysconfig/selinux
echo "#     permissive - SELinux prints warnings instead of enforcing."   >> /etc/sysconfig/selinux
echo "#     disabled - No SELinux policy is loaded."                                  >> /etc/sysconfig/selinux
echo "SELINUX=disabled"                                                                        >> /etc/sysconfig/selinux
echo "# SELINUXTYPE= can take one of these two values:"                   >> /etc/sysconfig/selinux
echo "#     targeted - Targeted processes are protected,"                             >> /etc/sysconfig/selinux
echo "#     mls - Multi Level Security protection."                                      >> /etc/sysconfig/selinux
echo "SELINUXTYPE=targeted"                                                               >> /etc/sysconfig/selinux
cat /etc/sysconfig/selinux
###################################################################################################
#REGRA BASICA
******************************
kernel.shmmax=(METADE DA MEMORIA TOTAL) (ALOCACAO MAXIMA)
kernel.shmmni=(MULTIPLOS DE 4) (BLOCO DE ALOCACAO MINIMA)
kernel.shmall=(1/4 da memoria total)
vm.nr_hugepages=(1/4 da memoria total)/1024 – (HUGE PAGES)
******************************
# ------------------------------------------------------------------------
# Sistemas 64-bit com 128GB de RAM:
echo "# ORACLE RAC PARAMETERS"                    >> /etc/sysctl.conf
echo "#"                                                                          >> /etc/sysctl.comf
echo "fs.aio-max-nr = 1048576"                                    >> /etc/sysctl.conf
echo "fs.file-max = 6815744"                                        >> /etc/sysctl.conf
echo "kernel.shmmni = 4096"                                       >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128"                       >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500"      >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144"                       >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304"                         >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144"                     >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586"                       >> /etc/sysctl.conf
echo "kernel.shmall = 33554432"                                 >> /etc/sysctl.conf
echo "kernel.shmmax = 68719476736"                        >> /etc/sysctl.conf
echo "###vm.nr_hugepages = 32768"                          >> /etc/sysctl.conf
/sbin/sysctl -p
# ------------------------------------------------------------------------
# Sistemas 64-bit com 96GB de RAM:
echo "# ORACLE RAC PARAMETERS"                        >> /etc/sysctl.conf
echo "#"                                              >> /etc/sysctl.comf
echo "fs.aio-max-nr = 1048576"                        >> /etc/sysctl.conf
echo "fs.file-max = 6815744"                          >> /etc/sysctl.conf
echo "kernel.shmmni = 4096"                           >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128"                 >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500"      >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304"                    >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586"                    >> /etc/sysctl.conf
echo "kernel.shmall = 25165824"                       >> /etc/sysctl.conf
echo "kernel.shmmax = 51539607552"                    >> /etc/sysctl.conf
echo "###vm.nr_hugepages = 32768"                     >> /etc/sysctl.conf
/sbin/sysctl -p
# ------------------------------------------------------------------------
# Sistemas 64-bit com 64GB de RAM:
echo "# ORACLE RAC PARAMETERS"                        >> /etc/sysctl.conf
echo "#"                                              >> /etc/sysctl.comf
echo "fs.aio-max-nr = 1048576"                        >> /etc/sysctl.conf
echo "fs.file-max = 6815744"                          >> /etc/sysctl.conf
echo "kernel.shmmni = 4096"                           >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128"                 >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500"      >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304"                    >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586"                    >> /etc/sysctl.conf
echo "kernel.shmall = 16777216"                       >> /etc/sysctl.conf
echo "kernel.shmmax = 34359738368"                    >> /etc/sysctl.conf
echo "###vm.nr_hugepages = 16384"                     >> /etc/sysctl.conf
/sbin/sysctl -p
# ------------------------------------------------------------------------
# Sistemas 64-bit com 32GB de RAM:
echo "# ORACLE RAC PARAMETERS"                        >> /etc/sysctl.conf
echo "#"                                              >> /etc/sysctl.comf
echo "fs.aio-max-nr = 1048576"                        >> /etc/sysctl.conf
echo "fs.file-max = 6815744"                          >> /etc/sysctl.conf
echo "kernel.shmmni = 4096"                           >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128"                 >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500"      >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304"                    >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586"                    >> /etc/sysctl.conf
echo "kernel.shmall = 8388608"                        >> /etc/sysctl.conf
echo "kernel.shmmax = 17179869184"                    >> /etc/sysctl.conf
echo "###vm.nr_hugepages = 8192"                      >> /etc/sysctl.conf
/sbin/sysctl -p
# ------------------------------------------------------------------------
# Sistemas 64-bit com 24GB de RAM:
echo "# ORACLE RAC PARAMETERS"                        >> /etc/sysctl.conf
echo "#"                                              >> /etc/sysctl.comf
echo "fs.aio-max-nr = 1048576"                        >> /etc/sysctl.conf
echo "fs.file-max = 6815744"                          >> /etc/sysctl.conf
echo "kernel.shmmni = 4096"                           >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128"                 >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500"      >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304"                    >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586"                    >> /etc/sysctl.conf
echo "kernel.shmall = 6291456"                        >> /etc/sysctl.conf
echo "kernel.shmmax = 12884901889"                    >> /etc/sysctl.conf
echo "###vm.nr_hugepages = 6144"                      >> /etc/sysctl.conf
/sbin/sysctl -p
# ------------------------------------------------------------------------
# Sistemas 64-bit com 16GB de RAM:
echo "# ORACLE RAC PARAMETERS"                        >> /etc/sysctl.conf
echo "#"                                              >> /etc/sysctl.comf
echo "fs.aio-max-nr = 1048576"                        >> /etc/sysctl.conf
echo "fs.file-max = 6815744"                          >> /etc/sysctl.conf
echo "kernel.shmmni = 4096"                           >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128"                 >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500"      >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304"                    >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586"                    >> /etc/sysctl.conf
echo "kernel.shmall = 4194304"                        >> /etc/sysctl.conf
echo "kernel.shmmax = 8589934592"                     >> /etc/sysctl.conf
echo "###vm.nr_hugepages = 4096"                      >> /etc/sysctl.conf
/sbin/sysctl -p
# ------------------------------------------------------------------------
# Sistemas 64-bit com 8GB de RAM:
echo "# ORACLE RAC PARAMETERS"                        >> /etc/sysctl.conf
echo "#"                                              >> /etc/sysctl.comf
echo "fs.aio-max-nr = 1048576"                        >> /etc/sysctl.conf
echo "fs.file-max = 6815744"                          >> /etc/sysctl.conf
echo "kernel.shmmni = 4096"                           >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128"                 >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500"      >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304"                    >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586"                    >> /etc/sysctl.conf
echo "kernel.shmall = 2097152"                        >> /etc/sysctl.conf
echo "kernel.shmmax = 4294967295"                     >> /etc/sysctl.conf
echo "###vm.nr_hugepages = 2048"                      >> /etc/sysctl.conf
/sbin/sysctl -p
# ------------------------------------------------------------------------
# Sistemas com 4GB de RAM:
echo "# ORACLE RAC PARAMETERS"                        >> /etc/sysctl.conf
echo "#"                                              >> /etc/sysctl.comf
echo "fs.aio-max-nr = 1048576"                        >> /etc/sysctl.conf
echo "fs.file-max = 6815744"                          >> /etc/sysctl.conf
echo "kernel.shmmni = 4096"                           >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128"                 >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500"      >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304"                    >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586"                    >> /etc/sysctl.conf
echo "kernel.shmall = 1048576"                        >> /etc/sysctl.conf
echo "kernel.shmmax = 2147483648"                     >> /etc/sysctl.conf
echo "###vm.nr_hugepages = 1024"                      >> /etc/sysctl.conf
/sbin/sysctl -p
# ------------------------------------------------------------------------
# Sistemas com 1GB of RAM:
echo "# ORACLE RAC PARAMETERS"                        >> /etc/sysctl.conf
echo "#"                                              >> /etc/sysctl.comf
echo "fs.aio-max-nr = 1048576"                        >> /etc/sysctl.conf
echo "fs.file-max = 6815744"                          >> /etc/sysctl.conf
echo "kernel.shmmni = 4096"                           >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128"                 >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500"      >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304"                    >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144"                 >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586"                    >> /etc/sysctl.conf
echo "kernel.shmall = 8388608"                        >> /etc/sysctl.conf
echo "kernel.shmmni = 4096"                           >> /etc/sysctl.conf
echo "kernel.shmall = 262144"                         >> /etc/sysctl.conf
echo "###vm.nr_hugepages = 1024"                      >> /etc/sysctl.conf
/sbin/sysctl -p
# ------------------------------------------------------------------------
# Configure limits.conf
# ------------------------------------------------------------------------
#
echo "* soft nproc 2047"           >> /etc/security/limits.conf
echo "* hard nproc 16384"          >> /etc/security/limits.conf
echo "* soft nofile 1024"          >> /etc/security/limits.conf
echo "* hard nofile 65536"         >> /etc/security/limits.conf
echo "* soft memlock 60397977"     >> /etc/security/limits.conf
echo "* hard memlock 60397977"     >> /etc/security/limits.conf
# ------------------------------------------------------------------------
# Configure the NTP service
# ------------------------------------------------------------------------
# OEL 6
# ------------------------------------------------------------------------
service ntpd stop
mv /etc/ntp.conf /etc/ntp.conf.org
# ------------------------------------------------------------------------
echo "OPTIONS=\"-x -u ntp:ntp -p /var/run/ntpd.pid\" " > /etc/sysconfig/ntpd
# ------------------------------------------------------------------------
service ntpd start
chkconfig ntpd on
service ntpd restart
# ------------------------------------------------------------------------
# OEL 7
# ------------------------------------------------------------------------
systemctl stop ntpd
mv /etc/ntp.conf /etc/ntp.conf.org
# ------------------------------------------------------------------------
echo "OPTIONS=\"-x -u ntp:ntp -p /var/run/ntpd.pid\" " > /etc/sysconfig/ntpd
# ------------------------------------------------------------------------
systemctl start ntpd
systemctl enable ntpd
systemctl restart ntpd
systemctl status ntpd
# ------------------------------------------------------------------------
# ------------------------------------------------------------------------
# Create the Groups and Users
# ------------------------------------------------------------------------
# ODA Environment
----------------------------------------------------------------------------------------------------------------------
Groups      Group Name      Group ID      Grid is a member        Oracle is a member
----------- --------------- ------------- ----------------------- ----------------------
oinstall    oinstall        1001          yes (primary group)     yes (primary group)
osdba       dba             1002          no                      yes
osoper      racoper         1003          yes                     yes
osdba       asmdba          1004          yes                     yes
osoper      asmoper         1005          yes                     no
osasm       asmadmin        1006          yes                     no
--------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------
# Groups ( yum -y install system-config-users )
# ------------------------------------------------------------------------
/usr/sbin/groupadd -g 54421 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 asmdba
/usr/sbin/groupadd -g 54326 dgdba
/usr/sbin/groupadd -g 54327 kmdba
/usr/sbin/groupadd -g 54328 asmadmin
/usr/sbin/groupadd -g 54329 asmoper
/usr/sbin/groupadd -g 54330 asm
/usr/sbin/groupadd -g 54331 grid
# ------------------------------------------------------------------------
# Create Users
# ------------------------------------------------------------------------
/usr/sbin/useradd -u 54321 -g asmadmin -G asm,asmdba,oinstall,asmadmin,asmoper,backupdba,dgdba,kmdba,oper,grid grid
/usr/sbin/useradd -u 54322 -g oinstall -G dba,asmdba,oinstall,backupdba,dgdba,kmdba,oper,grid oracle
# ------------------------------------------------------------------------
# Modify Users
# ------------------------------------------------------------------------
/usr/sbin/usermod -u 54321 -g asmadmin -G asm,asmdba,asmadmin,oinstall,asmoper,backupdba,dgdba,kmdba,oper,grid grid
/usr/sbin/usermod -u 54322 -g oinstall -G dba,asmdba,oinstall,backupdba,dgdba,kmdba,oper,grid oracle
# ------------------------------------------------------------------------
# ------------------------------------------------------------------------
# Password
passwd grid
passwd oracle
# ------------------------------------------------------------------------
# ------------------------------------------------------------------------
# Create the folders to Grid and Database
# Change the permission to GRID (verify if is necessary re-run this part of the script after Grid installation)
# ------------------------------------------------------------------------
# Grid (Verify this configuration before the Grid Installation)
# ------------------------------------------------------------------------
mount -t tmpfs shmfs -o size=10g /dev/shm
echo "shmfs          /dev/shm          tmpfs          size=10g          0" >> /etc/fstab
cat /etc/fstab
# ------------------------------------------------------------------------

Nenhum comentário:

Postar um comentário