User:Mrjazzman/OracleBase

From FAIWiki
< User:Mrjazzman
Revision as of 12:10, 18 April 2006 by Mrjazzman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Oracle Base System Installation

Unfortunatly i have not got the actual oracle installers going but this will setup the base system so that the oracle installer should go through without issues.


Package Configs

Firstly you need a copy of libaio. You can google for the deb package. I installed this on my private debian mirror

package_config/ORACLE

PACKAGES install
binutils
libdb2
libdb3
libdb4.1
libdb1-compat
cpp-3.3
gcc-3.3
libstdc++5-3.3-dev
libstdc++2.10-glibc2.2
base-files
netbase
libc6
libc6-dev
make
vncserver
libaio
gcc

Scripting

The following is used to setup the various parts of the system so that the oracle installer will work without problems.

scripts/ORACLE/10-setup

#!/bin/bash

#
#
#
# Configure a server to run Oracle
# Create Users
echo "dba:x:900:oracle" >> ${target}/etc/group
echo "dba:x:900:oracle" >> ${target}/etc/group-
echo "oinstall:x:901:"  >> ${target}/etc/group
echo "oinstall:x:901:"  >> ${target}/etc/group-
echo "oinstall:!::" >> ${target}/etc/gshadow
echo "oinstall:!::" >> ${target}/etc/gshadow-
echo "dba:!::oracle" >> ${target}/etc/gshadow
echo "dba:!::oracle" >> ${target}/etc/gshadow-
echo "oracle:x:1000:901::/home/oracle:/bin/bash" >> ${target}/etc/passwd
echo "oracle:$1$LgAZMIrX$63LaKC66qMXeLS/xj/PFv1:13230:0:99999:7:::" >> ${target}/etc/shadow
echo "nobody:x:1800:" >> ${target}/etc/group
echo "nobody:!::" >> ${target}/etc/gshadow

#
# Create Directories

mkdir -p ${target}/u01/app/oracle
mkdir -p ${target}/u01/oradata   
mkdir    ${target}/home/oracle
chown -R 1000:901 ${target}/home/oracle
chown -R 1000:901 ${target}/u01   
chmod -R 775 ${target}/u01

#
# Fix System Details
cat >> ${target}/etc/sysctl.conf << EOF
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
EOF


cat >> ${target}/etc/security/limits.conf << EOF
*               soft    nproc   2047
*               hard    nproc   16384
*               soft    nofile  1024
*               hard    nofile  65536
EOF

cat >> ${target}/etc/profile << EOF
# For Oracle
if [ \$USER = "oracle" ]; then
   if [ \$SHELL = "/bin/ksh" ]; then
      ulimit -p 16384
      ulimit -n 65536
   else
      ulimit -u 16384 -n 65536
   fi
fi
EOF

# 
# Fake Being Redhat
echo "Red Hat Enterprise Linux AS release 3 (Taroon)" > ${target}/etc/redhat-release


#
# Setup defaults for the oracle user.
cat >> ${target}/home/oracle/.bash_profile << EOF
umask 022
ORACLE_BASE=/u01/app/oracle
ORACLE_SID=\${HOSTNAME}
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1/
export ORACLE_BASE ORACLE_SID ORACLE_HOME
export LD_LIBRARY_PATH=/usr/lib:\$ORACLE_HOME/lib
unset TNS_ADMIN
EOF

#
# Setup the init scripts
fcopy /etc/init.d/oracle


Init Script

The init script is copy'd using fcopy during the script phase of the installation. Below is the init script used to start oracle

files/etc/init.d/oracle/ORACLE

#!/bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
# chkconfig: 345 91 19
# description: Startup/Shutdown Oracle listener and instance

ORA_HOME="/u01/app/oracle/product/10.2.0/db_1"
ORA_OWNR="oracle"

# if the executables do not exist -- display error

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

# depending on parameter -- startup, shutdown, restart 
# of the instance and listener or usage display 

case "$1" in
    start)
        # Oracle listener and instance startup
        echo -n "Starting Oracle: "
        su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl start"
        su - $ORA_OWNR -c $ORA_HOME/bin/dbstart
        touch /var/lock/subsys/oracle
        echo "OK"
        ;;
    stop)
        # Oracle listener and instance shutdown
        echo -n "Shutdown Oracle: "
        su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl stop"
        su - $ORA_OWNR -c $ORA_HOME/bin/dbshut
        rm -f /var/lock/subsys/oracle
        echo "OK"
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: $0 start|stop|restart|reload"
        exit 1
esac
exit 0