Created
July 20, 2011 10:18
-
-
Save jbarber/1094722 to your computer and use it in GitHub Desktop.
Quick Oracle 11g install on RHEL5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
. CONFIG | |
# Satisfy the prerequisites for Oracle 11g and install the binaries | |
for i in oinstall dba oper asmadmin asmdba asmoper; do groupadd $i; done | |
useradd -g oinstall -G dba,oper,asmdba oracle | |
useradd -g oinstall -G asmadmin,asmdba,asmoper grid | |
mkdir -p $GRID_HOME | |
mkdir -p $GRID_BASE | |
mkdir -p $ORACLE_HOME | |
chown -R oracle:oinstall $MP | |
chown -R grid:oinstall $GRID_HOME | |
chown -R grid:oinstall $GRID_BASE | |
chmod -R 775 $MP | |
mkdir -p $ORACLE_BASE | |
chown oracle:oinstall /u01/app/oracle | |
chown :oinstall /u01/app | |
chmod g+wrx /u01/app | |
cat <<EOF | column -t >> /etc/security/limits.conf | |
oracle soft nproc 2047 | |
oracle hard nproc 16384 | |
oracle soft nofile 1024 | |
oracle hard nofile 65536 | |
oracle soft stack 10240 | |
grid soft nproc 2047 | |
grid hard nproc 16384 | |
grid soft nofile 1024 | |
grid hard nofile 65536 | |
grid soft stack 10240 | |
EOF | |
cat <<EOF | column -t >> /etc/sysctl.conf | |
kernel.sem = 250 32000 100 128 | |
kernel.shmall = 536870912 | |
fs.file-max = 6815744 | |
net.ipv4.ip_local_port_range = 9000 65500 | |
net.core.rmem_default = 262144 | |
net.core.rmem_max = 4194304 | |
net.core.wmem_default = 262144 | |
net.core.wmem_max = 1048576 | |
fs.aio-max-nr = 1048576 | |
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 | |
# Metalink ID 1062929.1 | |
cat <<EOF > /etc/oraInst.loc | |
inventory_loc=$MP/app/oraInventory | |
inst_group=oinstall | |
EOF | |
sudo -u oracle $MNTPNT/runInstaller \ | |
-silent \ | |
-responseFile $MNTPNT/response/db_install.rsp \ | |
ORACLE_BASE=$ORACLE_BASE \ | |
ORACLE_HOME=$ORACLE_HOME \ | |
ORACLE_HOME_NAME=$ORACLE_HOME_NAME \ | |
oracle.install.db.InstallEdition=EE \ | |
oracle.install.db.isCustomInstall=false \ | |
oracle.install.db.DBA_GROUP=dba \ | |
oracle.install.db.OPER_GROUP=dba \ | |
DECLINE_SECURITY_UPDATES=true \ | |
UNIX_GROUP_NAME=oinstall \ | |
oracle.install.option=INSTALL_DB_SWONLY | |
## Hack to wait for the installer to complete | |
until ! pgrep -f oracle.install >/dev/null; do sleep 5; done | |
$ORACLE_HOME/root.sh -silent | |
rm -rf /tmp/OraInstall* /tmp/CVU* | |
# Fix the broken permissions | |
find /u01/app/oraInventory/ -type f -exec chmod g+w {} \; | |
umount $MNTPNT | |
rm -rf $MNTPNT | |
service portmap stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
set -e | |
. CONFIG | |
service portmap start | |
[ -d $MNTPNT ] || mkdir $MNTPNT | |
# FIXME: need to describe how to get these RPMs easily | |
# wget http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html | |
mount -t nfs -o ro,async $ASMRPMSRC $MNTPNT | |
( | |
cd $MNTPNT | |
ARCH=$(uname -i) | |
rpm -ihv \ | |
oracleasm-support-*.$ARCH.rpm \ | |
oracleasm-$(uname -r)-*.$ARCH.rpm \ | |
oracleasmlib-*.$ARCH.rpm | |
) | |
umount $MNTPNT | |
oracleasm configure -l /dev/oracleasm -u grid -g asmdba -s y -e -x dm | |
service oracleasm start | |
echo , | sfdisk $DISK | |
service oracleasm createdisk $DISKNAME ${DISK}1 | |
mount -t nfs -o ro,async $GRIDSRC $MNTPNT | |
sudo -u grid $MNTPNT/runInstaller \ | |
-silent \ | |
ORACLE_BASE=$GRID_BASE \ | |
ORACLE_HOME=$GRID_HOME \ | |
oracle.install.asm.OSDBA=asmdba \ | |
oracle.install.asm.OSOPER=asmoper \ | |
oracle.install.asm.OSASM=asmadmin \ | |
oracle.install.asm.SYSASMPassword=$SYSPASSWD \ | |
oracle.install.asm.monitorPassword=$SYSPASSWD \ | |
oracle.install.asm.diskGroup.name=$DISKGROUP \ | |
oracle.install.asm.diskGroup.redundancy=EXTERNAL \ | |
oracle.install.asm.diskGroup.disks=ORCL:$DISKNAME \ | |
oracle.install.option=HA_CONFIG \ | |
-responseFile $MNTPNT/response/crs_install.rsp -noconfig | |
# oracle.install.asm.diskGroup.disks=/dev/oracleasm/disks/DISK1 | |
until ! pgrep -f oracle.install >/dev/null; do sleep 5; done | |
$GRID_HOME/root.sh | |
# configToolAllCommands doesn't seem to work for ASM, so configure ASM manually | |
sudo -u grid $GRID_HOME/cfgtoollogs/configToolAllCommands | |
sudo -u grid $GRID_HOME/bin/asmca -silent \ | |
-oui_internal \ | |
-configureASM \ | |
-diskGroupName $DISKGROUP \ | |
-diskList ORCL:$DISKNAME \ | |
-redundancy EXTERNAL \ | |
-sysAsmPassword $SYSPASSWD \ | |
-asmsnmpPassword $SYSPASSWD | |
rm -rf /tmp/OraInstall* /tmp/CVU* | |
umount $MNTPNT | |
rm -rf $MNTPNT | |
service portmap stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is an uncomplete collection of scripts to automate the installation of Oracle 11g and ASM. At the moment it will install the binaries for Oracle and Grid, but for some reason it won't create a startable database (I suspect a problem with the Grid installation process). | |
Let me take a moment to say that the Oracle installation documentation is particulary poor for 11g and has lead to a lot of teeth gnashing, with often contradictory information offered by different parts of the docs. The fact that the silent installation methods seem to be prone to bugs is another source of annoyance. | |
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... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See Appendix D of E11882_01 (Oracle Database | |
# Installation Guide for Linux) for OFA details - but | |
# they conflict with the suggested installation paths | |
# for the DB in the same document! | |
MP=/u01 | |
ORACLE_BASE=$MP/app/oracle | |
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 | |
ORACLE_HOME_NAME=OraDb11g_home1 | |
GRID_BASE=$MP/app/grid | |
GRID_HOME=$MP/app/11.2.0/grid | |
ORACLE_HOME_NAME=OraDb11g_home1 | |
PATH=$PATH:$ORACLE_HOME/bin | |
SID=ORCL | |
SYSPASSWD=manager | |
DISK=/dev/sdb | |
DISKGROUP=DG0 | |
DISKNAME=DISK1 | |
ASMRPMSRC=10.112.24.110:/software/isos/Oracle/Oracle11g/ASM-rpms | |
GRIDSRC=10.112.24.110:/software/isos/Oracle/Oracle11g/grid | |
MNTSRC=10.112.24.110:/software/isos/Oracle/Oracle11g/database | |
MNTPNT=/tmp/mnt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment