Oracle/Database/Oracle 11gR2 RHEL6 Install

From Omnia
Jump to navigation Jump to search

Oracle 11gR2 RHEL 6.0 Install

These instructions use Oracle Database 11g Release 2 on RHEL 6.0


Oracle

Oracle Download - http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

Requirements

  • 1 GB of RAM
  • Swap space equal to ram (min size 2GB - max size 16GB)
  • 2-5GB of free disk space (depending on version)
  • Statically assigned IP address

Yum

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

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

[keylabs]
name=oeey Repo for $releasever $basearch
baseurl=http://yum.oeey.com/rhel/6.0/x86/Server/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
# baseurl=file:///opt/yum/
# gpgcheck=1
EOF

Dependencies

For VNC:

yum install tigervnc-server xterm twm xorg-x11-utils

Install dependencies:

yum install make binutils gcc libaio libaio-devel libstdc++ elfutils-libelf-devel gcc-c++ ksh \
  compat-libstdc++-33 libgcc libstdc++-devel libaio-devel sysstat unixODBC unixODBC-devel

Hosts

NOTE: May not be needed, as Network manager appears to already do this... (oh... only if using Network Manager and dhcp)

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

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

127.0.0.1		localhost.localdomain localhost
216.119.194.130		ws-194-130.oeey.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 = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
# memory settings
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

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

OS Version:

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.0 (Santiago)

Dependencies commonly missed:

yum install libaio-devel unixODBC-devel ksh

Extract Oracle

Extract:

mkdir installer
cd installer
# for x64: unzip ../linux.x64_11gR2_database_1of2.zip ; unzip ../linux.x64_11gR2_database_1of2.zip
unzip ../linux_11gR2_database_1of2.zip ; unzip ../linux_11gR2_database_2of2.zip
cd database

Install:

./runInstaller

System check:

* Temp space greater than 80 MB.
* Swap space greater than 150 MB.
* Colors greater than 256

GUI Portion

VMware Note: It appears that the installer needs a minimum of 1024x768 resolution for installation. The GUI installer has positioning issues with the bottom task bar even at this resolution. This only happens with with VMware console. VNC does not have this issue, and can be installed at 800x600.

Installation Steps:

  1. Configure Security Updates:
    • ignore and click Next, Next (default)
  2. Installation Option:
    • Create and configure a database (default)
  3. System Class
    • Desktop Class (default)
  4. Typical Installation
    • Database edition: Enterprise (default)
    • Enter Administrative password: test12
  5. Create Inventory
  6. Prerequisite Checks

Note: shows pdksh error which has to be ignored. [1]

Typical Installation: (defaults without oracle user modifications)

Oracle base: /home/oracle/app/oracle
Software location: /home/oracle/app/oracle/product/11.2.0/dbhome_1
Database file location: /home/oracle/app/oracle/oradata
Database edition: Enterprise Edition (3.95 GB)
Character Set: Default (WE8MSWIN1252)
OSDBA Group: oracle
Global database name: orcl.oeey.com
Administrative password: test12
Confirm Password: test12

Create Inventory:

Inventory Directory: /home/oracle/app/oraInventory
oraInventory Group Name: oracle

This is a prerequisite condition to test whether the package "pdksh-5.2.14" is available on the system.

[X] Ignore All

root step

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

If using defaults:

/home/oracle/app/oraInventory/orainstRoot.sh
/home/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh

If using oracle mod:

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

Enterprise Manager

Enterprise Manager Database Control URL - (orcl):

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.2.0/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.2.0/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.2.0/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 Power Install Script (Oracle 11g - RHEL 5)

Note: will need to be modified for RHEL 6 slightly

Notes

RHEL 6 and Oracle 11g:


Not RHEL 6, but interesting:

Issues

Remote Connection

$ sqlplus sysman/test12@216.119.194.200

ERROR:
ORA-12541: TNS:no listener

By default, Oracle only listens on the localhost address.

Modify $ORACLE_HOME//network/admin/

# 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 = localhost)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /opt/oracle

Replace 'localhost' with the FQDN of the host.

Restart oracle:

service oracle stop
service oracle start

listener not given the SERVICE_NAME

ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

Kickstart

Default system

# Kickstart file automatically generated by anaconda.

#version=RHEL6
install
url --url=http://216.119.202.5/dvd/rhel/6.0/x86
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
rootpw  --iscrypted $6$wsjkZEKVUht.DOqu$figLkkbukpBOIe9GZ90O8HsIy/jM2mtY2RSCbfEG6Ar5zgGEAhN7Q6AZbQfcaR04SLpSNZwjc53vY5zjjJ5PT/
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
selinux --enforcing
timezone --utc America/New_York
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux --drives=sda

#part /boot --fstype=ext4 --size=500
#part pv.BxsFXn-JAUP-HTFR-FKxL-sZsZ-R4m9-P9C91u --grow --size=1

#volgroup vg_ws194121 --pesize=4096 pv.BxsFXn-JAUP-HTFR-FKxL-sZsZ-R4m9-P9C91u
#logvol / --fstype=ext4 --name=lv_root --vgname=vg_ws194121 --grow --size=1024 --maxsize=51200
#logvol swap --name=lv_swap --vgname=vg_ws194121 --grow --size=2032 --maxsize=4064
repo --name="Red Hat Enterprise Linux"  --baseurl=http://216.119.202.5/dvd/rhel/6.0/x86/ --cost=100

%packages
@base
@console-internet
@core
@debugging
@directory-client
@hardware-monitoring
@java-platform
@large-systems
@network-file-system-client
@performance
@perl-runtime
@server-platform
@server-policy
pax
python-dmidecode
oddjob
sgpio
certmonger
pam_krb5
krb5-workstation
nscd
pam_ldap
nss-pam-ldapd
perl-DBD-SQLite
%end

Full system

anaconda-ks.cfg:

# Kickstart file automatically generated by anaconda.

#version=RHEL6
install
url --url=http://216.119.202.5/dvd/rhel/6.0/x86/
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
rootpw  --iscrypted $6$D.cfKhh9D2yQmRYI$WGb5LU172IuAfnDONblTORFNiSBqxKxqj4QbGbJ6eqjY7eLPCTLSClwWcwZlDvM9nxf8eVXPHivb3lJgjuCKq1
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
selinux --enforcing
timezone --utc America/New_York
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux --drives=sda

#part /boot --fstype=ext4 --size=500
#part pv.0eC2O2-zBd7-3gib-35ff-Mv56-yl76-1YmxEH --grow --size=1

#volgroup vg_ws194122 --pesize=4096 pv.0eC2O2-zBd7-3gib-35ff-Mv56-yl76-1YmxEH
#logvol / --fstype=ext4 --name=lv_root --vgname=vg_ws194122 --grow --size=1024 --maxsize=51200
#logvol swap --name=lv_swap --vgname=vg_ws194122 --grow --size=2032 --maxsize=4064
repo --name="Red Hat Enterprise Linux"  --baseurl=http://216.119.202.5/dvd/rhel/6.0/x86/ --cost=100

%packages
@additional-devel
@backup-client
@backup-server
@base
@cifs-file-server
@compat-libraries
@console-internet
@core
@debugging
@basic-desktop
@desktop-debugging
@desktop-platform
@desktop-platform-devel
@development
@dial-up
@directory-client
@directory-server
@mail-server
@eclipse
@emacs
@storage-client-fcoe
@ftp-server
@fonts
@general-desktop
@graphical-admin-tools
@graphics
@hardware-monitoring
@input-methods
@internet-browser
@java-platform
@kde-desktop
@large-systems
@legacy-unix
@legacy-x
@mainframe-access
@system-management-messaging-client
@mysql-client
@mysql
@nfs-file-server
@network-server
@storage-server
@network-file-system-client
@network-tools
@php
@performance
@perl-runtime
@postgresql-client
@postgresql
@print-server
@print-client
@remote-desktop-clients
@scientific
@security-tools
@server-platform
@server-platform-devel
@server-policy
@smart-card
@storage-client-multipath
@system-management
@system-admin-tools
@tex
@technical-writing
@web-server
@web-servlet
@system-management-wbem
@x11
@storage-client-iscsi
libXinerama-devel
xorg-x11-proto-devel
startup-notification-devel
libgnomeui-devel
libbonobo-devel
junit
libXau-devel
libgcrypt-devel
popt-devel
libdrm-devel
libXrandr-devel
libxslt-devel
libglade2-devel
gnutls-devel
mtools
pax
python-dmidecode
oddjob
sgpio
genisoimage
wodim
abrt-gui
qt-mysql
desktop-file-utils
ant
rpmdevtools
jpackage-utils
rpmlint
certmonger
pam_krb5
krb5-workstation
nscd
pam_ldap
nss-pam-ldapd
samba
netpbm-progs
ImageMagick
tcp_wrappers
xterm
xorg-x11-xdm
libXmu
perl-DBD-MySQL
dnsmasq
perl-DBD-SQLite
rdesktop
tigervnc
atlas
numpy
hmaccalc
crypto-utils
certmonger
tog-pegasus
%end

keywords

oracle