goryszewskig
1/1/2013 - 4:19 PM

10-install_binaries.sh

#!/bin/bash
set -e
. CONFIG

# Satisfy the prerequisites for Oracle 10g 10.2.0.1 and install the binaries

for i in oper dba oinstall; do groupadd $i; done
adduser -g oinstall -G dba,oper oracle

mkdir -p $ORACLE_BASE
chown -R oracle:oinstall /u01

cat <<EOF >> /etc/sysctl.conf
kernel.sem                    = 250 32000 100 128
kernel.shmall                 = 536870912
fs.file-max                   = 65536
net.ipv4.ip_local_port_range  = 1024 65000
net.core.rmem_default         = 262144
net.core.rmem_max             = 262144
net.core.wmem_default         = 262144
net.core.wmem_max             = 262144
EOF
sysctl -p

yum install -y compat-libstdc++-33 compat-db compat-gcc-34          \
  compat-gcc-34-c++ cpp elfutils-libelf elfutils-libelf-devel       \
  elfutils-libelf-devel-static gcc-4.1.2 gcc-c++ gdb glibc-devel    \
  glibc-headers kernel-headers libaio-devel libgomp libstdc++-devel \
  libtermcap-devel libxml2 libXp libxslt libXtst readline-devel     \
  sysstat unixODBC unixODBC-devel

service portmap start
mkdir $MNTPNT
mount -t nfs -o ro,async $MNTSRC $MNTPNT

sudo -u oracle $MNTPNT/runInstaller             \
  -responseFile $MNTPNT/response/enterprise.rsp \
  ORACLE_HOME=$ORACLE_HOME                      \
  ORACLE_HOME_NAME=$ORACLE_HOME_NAME            \
  INVENTORY_LOCATION=$ORACLE_BASE/oraInventory  \
  n_configurationOption=3                       \
  -silent

# Hack to wait for the installer to complete
until ! pgrep -f oracle.install >/dev/null; do sleep 5; done

umount $MNTPNT
rm -rf $MNTPNT
service portmap stop

$ORACLE_BASE/oraInventory/orainstRoot.sh
$ORACLE_HOME/root.sh -silent
#!/bin/bash
set -e
. CONFIG

# Configure ASM and create instance

localconfig reset
echo -e "/^h1:.*cssd/ m /^l2/\nwq" | ed /etc/inittab

# FIXME: need to describe how to get these RPMs easily
# wget http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html
ARCH=$(uname -i)
rpm -ihv \
  oracleasm-support-*.$ARCH.rpm \
  oracleasm-$(uname -r)-*.$ARCH.rpm    \
  oracleasmlib-*.$ARCH.rpm

oracleasm configure -l /dev/oracleasm -u oracle -g dba -s y -e -x dm
service oracleasm start

echo , | sfdisk $DISK
service oracleasm createdisk DISK1 ${DISK}1

sudo -u oracle dbca -silent \
  -configureASM             \
  -diskString "ORCL:*"      \
  -diskList "ORCL:DISK1"    \
  -diskGroupName $DISKGROUP \
  -redundancy EXTERNAL
#!/bin/bash
set -e
. CONFIG

# Create DB using ASM

sudo -u oracle dbca -silent              \
       -createDatabase                   \
       -templateName General_Purpose.dbc \
       -gdbName $SID                     \
       -sid $SID                         \
       -SysPassword $SYSPASSWD           \
       -SystemPassword $SYSPASSWD        \
       -emConfiguration NONE             \
       -storageType ASM                  \
         -diskGroupName $DISKGROUP       
#       -characterSet WE8ISO8859P15       \
#       -memoryPercentage 40
#!/bin/bash
set -e
. CONFIG

PROFILE=/etc/profile.d/oracle.sh
echo "export ORACLE_BASE=$ORACLE_BASE" > $PROFILE
echo "export ORACLE_HOME=${ORACLE_HOME/$ORACLE_BASE/\$ORACLE_BASE}" >> $PROFILE
echo "export PATH=\$PATH:\$ORACLE_HOME/bin" >> $PROFILE
echo "export ORACLE_SID=$SID" >> $PROFILE
chmod 755 $PROFILE
ORACLE_BASE=/u01/app/oracle 
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_HOME_NAME=OraDb10g_home1
PATH=$PATH:$ORACLE_HOME/bin

SID=ORCL
SYSPASSWD=manager

DISK=/dev/sdb
DISKGROUP=DG0

MNTSRC=10.112.24.110:/software/isos/Oracle/Oracle10g/Oracle_DataBase_10g_10.2.0.1.0_ForLinuxX86-64bits-DVD/database
MNTPNT=/tmp/mnt
This is a collection of scripts to automate the installation of Oracle 10g. Just download them and use "run-parts" as root:
# run-parts ./

Most of the options you're likely to want to change are in the CONFIG file, anything more major and you'll have to role up your sleeves and modify the scripts themselves - not that they are very complicated.

You will need to make sure the ASM RPMs are available in the same directory that you call run-parts from so that 20-create_asm.sh can installed them. For RHEL5 these are available from:
http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html

This series of blog posts has information about automating more of the Oracle installation process in a much more accessible form than the Oracle documentation:
http://www.pythian.com/news/1035/oracle-silent-mode-part-110-installation-of-102-and-111-databases/

As is normally the case, I only discovered it after working out which parts of the response file I needed to keep...