Oracle/Database/Oracle 11g RHEL5 Install

From Omnia
Revision as of 16:30, 15 April 2015 by Kenneth (talk | contribs) (→‎Oracle Power Script)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Oracle 11g RHEL5 Install

Installation Guides:

kickstart

/etc/yum.repos.d/oeey-rhel.repo:

cat > /etc/yum.repos.d/oeey-rhel.repo << "EOF"

[oeey-rhel5.1]
name=RHEL-$releasever - Server Base
baseurl=http://repo/rhel/$releasever/$basearch/Server/
gpgcheck=1
gpgkey=http://repo/rhel/RPM-GPG-KEY-redhat-release

EOF
cat > /etc/yum.repos.d/oeey-rhel.repo << "EOF"

[ken-rhel5.3-server]
name=RHEL-$releasever - Server Base
baseurl=http://10.0.1.150/yum/rhel/rhel53x86/Server
gpgcheck=1
gpgkey=http://10.0.1.150/yum/rhel/rhel53x86/RPM-GPG-KEY-redhat-release

EOF

You will need to rebuild repodata to get this to work:

createrepo .

Disable RHN:

sed -i 's/enabled = 1/enabled=0/' /etc/yum/pluginconf.d/rhnplugin.conf
#vi /etc/yum/pluginconf.d/rhnplugin.conf
# enabled = 0

Install dependencies:

yum install compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-devel \
  glibc-common gcc-4.1.1 gcc-c++-4.1.1 kernel-headers libgcc-4.1.1 libaio libaio-devel \
  libstdc++ libstdc++-devel unixODBC unixODBC-devel sysstat binutils make

Missing from kickstart:

# i386
yum install libaio-devel sysstat unixODBC unixODBC-devel
# x86_64
yum install libaio-devel.x86_64 sysstat.x86_64 unixODBC.x86_64 unixODBC-devel.x86_64

Hosts

cp /etc/hosts /etc/hosts.original
echo -e "127.0.0.1\t\tlocalhost.localdomain localhost" > /etc/hosts
echo -e "`ifconfig | grep "inet addr" | head -n 1 | cut -f 2 -d ":" | cut -f 1 -d " "`\t\t`hostname` `hostname | cut -f 1 -d '.'`" >> /etc/hosts

The /etc/hosts file must contain a fully qualified name for the server:

127.0.0.1		localhost.localdomain localhost
::1			localhost6.localdomain6 localhost6
216.119.194.130		ws-194-130.applabs.com ws-194-130

WARNING: If during the precheck you get a "not executed" instead of a "success" or "warning" your hosts file is wrong!

Kernel Parameters

Add the following lines to the /etc/sysctl.conf file -

cat >> /etc/sysctl.conf <<EOF

# Oracle Settings
#
# Only change default kernel.shmall and kernel.shmmax if pre-existing values
#   are lower then listed below:
# kernel.shmall = 2097152
# kernel.shmmax = 536870912
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
# memory settings
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144

EOF

Run the following command to change the current kernel parameters:

/sbin/sysctl -p

limits

Add the following lines to the /etc/security/limits.conf file:

cat >> /etc/security/limits.conf <<EOF


# Oracle Settings
*               soft    nproc   	2047
*               hard    nproc   	16384
*               soft    nofile  	1024
*               hard    nofile  	65536

EOF

Add the following line to the /etc/pam.d/login file, if it does not already exist:

cat >> /etc/pam.d/login <<EOF

# Oracle Settings
session    required     pam_limits.so

EOF

Users and Groups

Create the new groups and users and set password:

groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
# give password to oracle user 'test12'
# passwd oracle
echo "test12" | passwd --stdin oracle

Create the directories in which the Oracle software and database files will be stored:

mkdir -p /opt/oracle
chown -R oracle.oinstall /opt/oracle
mkdir /opt/oraInventory
chown -R oracle.oinstall /opt/oraInventory

Add the following lines at the end of the Oracle user's .bash_profile file:

cat >> /home/oracle/.bash_profile <<"EOF"

# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

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

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

EOF

VNC

Add to the /etc/sysconfig/vncservers file

cat >> /etc/sysconfig/vncservers <<EOF

VNCSERVERS="2:oracle"
VNCSERVERARGS[2]="-geometry 800x600"

EOF

Log into the oracle user and create VNC Password

#su - oracle
# give vnc login a password 'test12'
#vncpasswd ; exit
#
# generated from "vncpasswd ; cat /home/oracle/.vnc/passwd | xxd -p -"
mkdir -p /home/oracle/.vnc
echo "de2e2c59eda77881" | xxd -p -r - /home/oracle/.vnc/passwd
chmod 600 /home/oracle/.vnc/passwd
chown -R oracle:oinstall /home/oracle/.vnc

Enable VNC persistent desktops at boot and start service

chkconfig vncserver on
service vncserver start

Remove # from /home/oracle/.vnc/xstartup to enable full desktop

sed -i 's%# unset SESSION_MANAGER%unset SESSION_MANAGER%g' /home/oracle/.vnc/xstartup
sed -i 's%# exec /etc/X11/xinit/xinitrc%exec /etc/X11/xinit/xinitrc%g' /home/oracle/.vnc/xstartup
# restart vncserver to take effect:
service vncserver restart

Note: This will result in: /home/oracle/.vnc/xstartup:

#  Uncomment the following two lines for normal desktop:
  unset SESSION_MANAGER
  exec /etc/X11/xinit/xinitrc

VNC to system:

vncviewer [SYSTEM]:2

Install Oracle

# copy oracle install local

# 32bit:
unzip linux_11gR1_database_1013.zip

# 64bit:
unzip linux.x64_11gR1_database_1013.zip

cd database
./runInstaller

Basic Installation: (defaults + password)

Oracle Base Location: /opt/oracle
Oracle Home Location: /opt/oracle/product/11.1/db_1
Installation Type: Enterprise Edition (3.3GB)
UNIX DBA Group: dba
[x] Create Starter Database (additional 1482MB)
  Global Database Name: orcl
  Database Password: test12
    * Used for SYS, SYSTEM, SYSMAN, and DBSNMP accounts

Specify Inventory directory and credentials: (defaults)

Full path of the inventory directory: /opt/oraInventory
Operating system group name: oinstall

x86 Required packages:

  • Checking for make-3.80; found make-1:3.81-3.el5-i386. Passed
  • Checking for binutils-2.15.92.0.2; found binutils-2.17.50.0.6-12.el5-i386. Passed
  • Checking for gcc-3.4.5; found gcc-4.1.2-46.el5-i386. Passed
  • Checking for libaio-0.3.105; found libaio-0.3.106-3.2-i386. Passed
  • Checking for libaio-devel-0.3.105; found libaio-devel-0.3.106-3.2-i386. Passed
    • *** Checking for libaio-devel-0.3.105; Not found. Failed <<<<
  • Checking for libstdc++-3.4.5; found libstdc++-4.1.2-46.el5-i386. Passed
  • Checking for elfutils-libelf-devel-0.97; found elfutils-libelf-devel-0.137-3.el5-i386. Passed
  • Checking for sysstat-5.0.5; found sysstat-7.0.2-3.el5-i386. Passed
    • *** Checking for sysstat-5.0.5; Not found. Failed <<<<
  • Checking for libgcc-3.4.5; found libgcc-4.1.2-46.el5-i386. Passed
  • Checking for libstdc++-devel-3.4.5; found libstdc++-devel-4.1.2-46.el5-i386. Passed
  • Checking for unixODBC-2.2.11; found unixODBC-2.2.11-7.1-i386. Passed
    • *** Checking for unixODBC-2.2.11; Not found. Failed <<<<
  • Checking for unixODBC-devel-2.2.11; found unixODBC-devel-2.2.11-7.1-i386. Passed
    • *** Checking for unixODBC-devel-2.2.11; Not found. Failed <<<<

x64 Required packages:

  • Checking for make-3.80; found make-1:3.81-3.el5-x86_64. Passed
  • Checking for binutils-2.15.92.0.2; found binutils-2.17.50.0.6-12.el5-x86_64. Passed
  • Checking for gcc-3.4.5; found gcc-4.1.2-46.el5-x86_64. Passed
  • Checking for libaio-0.3.105-i386; found libaio-0.3.106-3.2-i386. Passed
  • Checking for libaio-0.3.105-x86_64; found libaio-0.3.106-3.2-x86_64. Passed
  • Checking for libaio-devel-0.3.105; found libaio-devel-0.3.106-3.2-x86_64. Passed
    • *** Checking for libaio-devel-0.3.105; Not found. Failed <<<<
  • Checking for libstdc++-3.4.5-i386; found libstdc++-4.1.2-46.el5-i386. Passed
  • Checking for libstdc++-3.4.5-x86_64; found libstdc++-4.1.2-46.el5-x86_64. Passed
  • Checking for libstdc++-devel-3.4.5; found libstdc++-devel-4.1.2-46.el5-x86_64. Passed
  • Checking for sysstat-5.0.5; found sysstat-7.0.2-3.el5-x86_64. Passed
    • *** Checking for sysstat-5.0.5; Not found. Failed <<<<
  • Checking for libgcc-3.4.5-i386; found libgcc-4.1.2-46.el5-i386. Passed
  • Checking for libgcc-3.4.5-x86_64; found libgcc-4.1.2-46.el5-x86_64. Passed
  • Checking for elfutils-libelf-0.97; found elfutils-libelf-0.137-3.el5-x86_64. Passed
  • Checking for elfutils-libelf-devel-0.97; found elfutils-libelf-devel-0.137-3.el5-x86_64. Passed
  • Checking for glibc-common-2.3.4; found glibc-common-2.5-42-x86_64. Passed
  • Checking for glibc-devel-2.3.4-i386; found glibc-devel-2.5-42-i386. Passed
  • Checking for glibc-devel-2.3.4-x86_64; found glibc-devel-2.5-42-x86_64. Passed
  • Checking for gcc-c++-3.4.5; found gcc-c++-4.1.2-46.el5-x86_64. Passed
  • Checking for compat-libstdc++-33-3.2.3-i386; found compat-libstdc++-33-3.2.3-61-i386. Passed
  • Checking for compat-libstdc++-33-3.2.3-x86_64; found compat-libstdc++-33-3.2.3-61-x86_64. Passed


During the prerequisite check you should only have the following issues:

  • swap - warning
  • network - warning
Configure Security Updates
  * Email (Oracle Support email): leave blank
  * deselect I wish to receive security updates
Create and configure a database:
 * Desktop Class or Server Class
 	Server Class
Grid Options:
 Single instance database installation
Install Type:
 Typical Install

Oracle Configuration Manager Registration:
 [ ] Enable Oracle Configuration Manager
 * Skip this step
Typical Installation:
 Oracle base: /opt/oracle
 Software location: /opt/oracle/product/11.1/db_1
 Storage Type: File System
 Database file location: /opt/oracle/oradata
 Database edition: Enterprise Edition (3.95GB)
 OSDBA group: dba
 Global database name: orcl.lab
 * administrative password: test12

Create Inventory:
 Inventory Directory: /opt/oraInventory
 oraInventory Group Name: oinstall

If the network has "not run" check your hosts file. If anything else is error or warned, you have problems.

root

Near the end of the install it will ask you to run the following root:

/opt/oraInventory/orainstRoot.sh
/opt/oracle/product/11.1/db_1/root.sh

Enterprise Manager

Enterprise Manager Database Control URL - (orcl):

  • https://[HOSTNAME]:1158/em

oracle init.d script

NOTE: Make sure to set the auto start flag for the database (/etc/oratab), or this will not work!

#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
#
# Note: make sure to modify /etc/oratab start
# parameter from 'N' to 'Y'
#

ORA_HOME=/opt/oracle/product/11.1/db_1
ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ]
then
    echo "Oracle startup: cannot start"
    exit
fi

case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
        su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"
        su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
        ;;
esac
cat > /etc/init.d/oracle <<EOF
...
EOF
chmod u+x /etc/init.d/oracle
chkconfig oracle on
sed -i "s#/N$#/Y#" /etc/oratab

Check Oracle Status

As root or oracle user:

$ORACLE_HOME/bin/lsnrctl status

Change Hostname

If you change the system hostname, this will break oracle.

To correctly change your system hostname:

  1. Set hostname (using 'hostname')
    • hostname NEWNAME
  2. Set hostname on reboot in /etc/sysconfig/network:
    • HOSTNAME=NEWNAME
  3. Set hostname lookup in /etc/hosts:
    • 10.10.10.100  NEWNAME
  4. Change Oracle listner.ora:
    • $ vi $ORACLE_HOME/network/admin/listener.ora
      
      # listener.ora Network Configuration File: /opt/oracle/product/11.1/db_1/network
      /admin/listener.ora
      # Generated by Oracle configuration tools.
      
      LISTENER =
        (DESCRIPTION_LIST =
          (DESCRIPTION =
            (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
            (ADDRESS = (PROTOCOL = TCP)(HOST = NEWNAME)(PORT = 1521))
          )
        )
      
  5. Change Oracle tnsnames.ora:
    • $ vi $ORACLE_HOME/network/admin/tnsnames.ora
      
      # tnsnames.ora Network Configuration File: /opt/oracle/product/11.1/db_1/network
      /admin/tnsnames.ora
      # Generated by Oracle configuration tools.
      
      ORCL =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = NEWNAME)(PORT = 1521))
          (CONNECT_DATA =
            (SERVER = DEDICATED)
            (SERVICE_NAME = orcl)
          )
        )
      
  6. Restart oracle
    • service oracle stop ; service oracle start

Oracle Power Script

See Oracle/Database/Oracle Power Install Script (Oracle 11g - RHEL 5)

Issues

error while loading shared libraries

If you try to run the oracle startup script and see the following:

/opt/oracle/product/11.1/db_1/bin/lsnrctl: error while loading shared libraries: /opt/oracle/product/11.1/db_1/lib/libnnz11.so: cannot restore segment prot after reloc: Permission denied
/opt/oracle/product/11.1/db_1/bin/lsnrctl: error while loading shared libraries: /opt/oracle/product/11.1/db_1/lib/libnnz11.so: cannot restore segment prot after reloc: Permission denied
Processing Database instance "orcl": log file /opt/oracle/product/11.1/db_1/startup.log

heck to see if see selinux has been disabled

TNS:no listener

If you try and start or stop the oracle server and see the following:

Processing Database instance "orcl": log file /opt/oracle/product/11.1/db_1/shutdown.log

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 22-JUL-2010 12:53:38

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

Check that the '(HOST=localhost.localdomain)' matches '$ hostname' and '/etc/hosts'.

keywords

oracle