Oracle Install Tips

Oracle Install Tips - 10g on RHEL5

 
Install requisite packages

yum -y install setarch-2*

yum -y install make-3*
yum -y install glibc-2*
yum -y install libaio-0*
yum -y install compat-libstdc++-33-3*
yum -y install compat-gcc-34-3*
yum -y install compat-gcc-34-c++-3*
yum -y install gcc-4*
yum -y install libXp-1*
yum -y install openmotif-2*
yum -y install compat-db-4*


Base X
Binutils, compat-db, compat-gcc-34, compat-gcc-34-c++, compat-libstdc+
  +-33, elfutils-libelf-devel, gdd, gdd-c++, gdb, gdbm, glibc, glibc-
  common, glibc-devel, ksh, libXp, libXtst, libaio, libaio-devel, libgcc,
  libgnome, libstdc++, libstdc++-devel, make, setarch, sysstat,
  unixODBC, unixODBC-devel, util-linux, xorg-x11-xinit, compat-libstdc+
  +-296
32 bit packages for 64 bit installation: glibc-devel, libaio, glibc, libgcc,
  compat-libstdc++, openssl, libXp, libXtst

Update /etc/hosts with correct servername
        10.1.4.200     oracle.sysxperts.com oracle
 
Determine hugepages requirement (database should be running for this)
#!/bin/bash
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`
# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`
# Start from 1 pages to be on the safe side and guarantee 1 free HugePage
NUM_PG=1
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | awk '{print $5}' | grep "[0-9][0-9]*"`
do
  MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
  if [ $MIN_PG -gt 0 ]; then
     NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
  fi
done
# Finish with results
case $KERN in
  '2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
        echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
  '2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
   *) echo "Unrecognized kernel version $KERN. Exiting." ;;
esac

Backup and Update /etc/security/limits.conf
    cp /etc/security/limits.conf{,.orig} #to backup

oracle soft nproc 15360

oracle hard  nproc  16384
oracle soft  nofile 64512
oracle hard  nofile 65536

oracle soft memlock  <Memlock is calculated by the number of huge pages allocated * 1024 *2>

oracle hard memlock <see above>

Create users and groups
groupadd dba
useradd -g dba oracle; echo "mypass" |passwd --stdin oracle
Create directories and chown for oracle

 mkdir -p /u01/app/oracle/product/10.2.0/db_1

 chown -R oracle.dba /u01

Make sure SELINUX is disabled in /etc/selinux/config and reboot if it was enabled:
            SELINUX=disabled
 
Determine best settings for kernel parameters in sysctl.conf:
    cp /etc/sysctl.conf{,.orig} #to backup file
Obtain the total memory from the system
     mem=$(free|grep Mem|awk '{print$2}')
Convert the value of $mem to bytes
     totmem=$(echo "$mem*1024"|bc)
Get the Hugepagesize from /proc/meminfo
     huge=$(grep Hugepagesize /proc/meminfo|awk '{print $2}')
Calculate what 75% of the total memory on the system for SHMMAX
     max=$(echo "$totmem*75/100"|bc)
Divide the SHMMAX value by the Hugepagesize to get SHMALL
     all=$(echo "$max/$huge"|bc)
Set the SHMMAX value in the /etc/sysctl.conf file
     echo "kernel.shmmax = $max" >> /etc/sysctl.conf
Set the SHMALL value in the /etc/sysctl.conf file
     echo "kernel.shmall = $all" >> /etc/sysctl.conf

Update /etc/sysctl.conf with:
# Controls the maximum shared segment size, in bytes  - see kernel and hugepages info
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
kernel.sem = 250 32000 100 142
fs.file-max = 104032
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_intvl = 60
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_syn_retries = 2
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 4194304
net.ipv4.tcp_rmem = 4096 262144 4194304
net.ipv4.tcp_wmem = 4096 262144 4194304
vm.swappiness = 0
vm.overcommit_memory = 2
vm.dirty_background_ratio = 3
vm.dirty_ratio = 15
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
dev.rtc.max-user-freq = 1024

 

run sysctl -p  #activates new kernel parameters  
vm.overcommit_memory settings #for VM's:
    0 =  kernel estimates amount of free memory left when userspace requests more
    1 =  kernel pretends there is always enough until it runs out
    2 =  never overcommit
 
Check dirty pages and adjust vm.dirty_background_ratio and vm.dirty_ration on a VM accordingly
    grep -A 1 dirty /proc/vmstat  #the lower the numbers the better
 
To mount an NFS share for backups:
nas.sysxperts.com:/Archive    /archive_fs     nfs     hard,nolock,vers=3,proto=tcp,bg,rsize=32768,wsize=32768,timeo=600,intr 0 0
nas.sysxperts.com:/Brchive    /backup_fs     nfs     hard,nolock,vers=3,proto=tcp,bg,rsize=32768,wsize=32768,timeo=600,intr 0 0
 
Update readahead on block devices
    blockdev --setra  32768 /dev/rootvg/u01lv
 
Red Hat Enterprise Linux 5 kernel supports four I/O schedulers:
- cfq (Completely Fair Queuing)
- deadline
- noop
- anticipatory
Some recommended kernel options to add to grub.conf #elevator=deadline should also be compared for performance
     elevator=noop
 
Edit the oracle users ~/.bash_profile 
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TEST; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

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

if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi 

 

Start vncserver with (install with yum -y install vnc-server if necessary):

    vncserver

    vncpasswd

 

Establish vnc session and run
    xhost + #as root
 

Extract cpio with:

cpio -idmv < 10201_database_linux_x86_64.cpio

 

cd to directory where cpio command was run

 

./database/runInstaller

 

download latest patch and unzip

./Disk1/runInstaller

 

To uninstall run the deinstaller from the latest patch Disk1/runInstaller

 

Edit /etc/oratab and set restart flag for TEST instance
    TEST:/u01/app/oracle/product/10.2.0/db_1:Y

sar and dstat is useful for stats on server - yum -y install sysstat dstat
ls -lattr /var/log/sa  and choose the filename with the date you want to see stats for then
    sar -A /var/log/sa/saXX

man sar and dstat are your friends

 
See oracle automated startup for init setup

Network:
HOSTNAME=$(grep HOSTNAME /etc/sysconfig/network|awk -F= '{print $2}')
hostname $HOSTNAME
GATEWAY=$(ip route list |grep default |awk '{print $3}')
echo "GATEWAY=$GATEWAY" >> /etc/sysconfig/network
DEFDEV=$(ip route list|grep default|awk '{FS=" "; print $5}')
IPADDR=$(ip addr show $DEFDEV |grep inet |grep -v inet6|awk '{print $2}'|awk -F/
  '{print $1}')
echo "IPADDR=$IPADDR" >> /etc/sysconfig/network-scripts/ifcfg-$DEFDEV
sed -i 's/dhcp/static/' /etc/sysconfig/network-scripts/ifcfg-$DEFDEV
BCAST=$(ip addr show eth0 |grep inet |grep -v inet6|awk '{print $4}')
echo "BROADCAST=$BCAST" >> /etc/sysconfig/network-scripts/ifcfg-$DEFDEV
echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-$DEFDEV



No comments: