Additional material
Attention: Linux commands that are running as root are prefixed with # in this appendix.
This book refers to additional material that can be downloaded from the Internet as described in the following sections.
Locating the Web material
The Web material that is associated with this book is available in softcopy on the Internet from the IBM Redbooks Web server, which is available at this website:
Alternatively, you can go to the IBM Redbooks website at:
Select Additional materials and open the directory that corresponds with the IBM Redbooks form number, SG24-8104.
Using the Web material
The additional Web material that accompanies this book includes the following file:
File name Description
SG248104.tgz Code samples in a compressed tar file
System requirements for downloading the Web material
The Web material requires the following system configuration:
Hard disk space: ~22 KB
Operating System: Red Hat Enterprise Linux (RHEL) 6.2
Memory: 256 MB
Downloading and extracting the Web material
Create a subdirectory on a Linux or Windows system. For Windows, there are many archive or extraction tools that recognize a compressed .tar file. For Linux, copy the .tar file to a directory and use the tar xvf command to extract the following contents:
# tar xzvf SG248104.tgz
oracleRedbook-SG248104/
oracleRedbook-SG248104/README.txt
oracleRedbook-SG248104/disclaimer.txt
oracleRedbook-SG248104/vm/
oracleRedbook-SG248104/vm/clone.exec
oracleRedbook-SG248104/linux/
oracleRedbook-SG248104/linux/boot.oracle
oracleRedbook-SG248104/linux/boot.onetime
oracleRedbook-SG248104/linux/database.rsp
This creates one directory, oracleRedbook-SG248104/, with subdirectories linux/ for Linux files and vm/ for the one z/VM file.
The CLONE EXEC is copied to the MAINT 191 disk. The Linux files are copied to the golden image, as shown in Table D-1.
Table D-1 Linux files copied to the golden image
File
Location
Description
boot.onetime
/etc/init.d/
First boot script for setting network values
boot.oracle
/etc/init.d/
First boot script to prepare for Oracle
database.rsp
/tmp/
Oracle response file for database silent install
For more information about how to use these files, see Chapter 10, “Automating Oracle on System z” on page 199.
Source code listings
The following source code listings are used in this section:
CLONE EXEC
The following CLONE EXEC attempts to use FLASHCOPY then falls back to DDR if that does not succeed. This clones a Linux on z/VM, which assumes minidisks 100 (Linux), 101 (Oracle), and 302 (swap):
/*+------------------------------------------------------------------+*/
/* EXEC to clone minidisks 100 101 and 302 using FLASHCOPY */
/*+------------------------------------------------------------------+*/
Parse Arg sourceID targetID .
If sourceID = '' | sourceID = '?' | targetID = '' Then Do
say 'Syntax is:'
say 'CLONE sourceID targetID'
exit 1
End
 
/* verify that the source ID is logged off */
'CP QUERY' sourceID
If rc <> 45 Then Do
Say sourceID 'does not exist or is not logged off?'
exit 2
End
 
Say 'Are you sure you want to overwrite disks on' targetID '(y/n)?'
Parse upper pull answer .
If answer <> 'Y' then
exit 3
 
/* FLASHCOY the 100, 101 and 302 disks from sourceID to targetID */
call copyDisk sourceID '100 1100' targetID '100 2100'
call copyDisk sourceID '101 1101' targetID '101 2101'
call copyDisk sourceID '302 1302' targetID '302 2302'
 
/* start the target virtual machine */
say "Starting new clone" targetID
'CP XAUTOLOG' targetID
exit
 
/*+------------------------------------------------------------------+*/
copyDisk:
/* copy a minidisk by linking the source R/O and the target R/W then */
/* try FLASHCOPY - if it fails, fall back to DDR */
/* Parm 1: source user ID */
/* Parm 2: rdev of the minidisk to copy from R/O */
/* Parm 3: temporary rdev of the source disk */
/*+------------------------------------------------------------------+*/
Arg sourceID vdev1 vdev2 targetID vdev3 vdev4 .
 
/* Link source disk read-only then target disk read-write */
'CP LINK' sourceID vdev1 vdev2 'RR'
If rc <> 0 Then Do
say 'CP LINK' sourceID vdev1 vdev2 'RR failed with' rc
exit 4
End
'CP LINK' targetID vdev3 vdev4 'MR'
If rc <> 0 Then Do
say 'CP LINK' targetID vdev3 vdev4 'MR failed with' rc
exit 5
End
 
Say 'Trying FLASHCOPY of' vdev2 'to' vdev4 '...'
'CP FLASHCOPY' vdev2 '0 END' vdev4 '0 END'
If (rc <> 0) Then Do /* Fallback to DDR */
Say 'FLASHCOPY failed, falling back to DDR ...'
/* Queue up DDR commands */
Queue 'SYSPRINT CONS' /* Don't print to file */
Queue 'PROMPTS OFF' /* Don't ask 'Are you sure?' */
Queue 'IN' vdev2 '3390' /* Input minidisk */
Queue 'OUT' vdev4 '3390' /* Output minidisk */
Queue 'COPY ALL' /* Copy all contents */
Queue ' ' /* Empty record ends DDR */
'DDR'
retVal = rc
End
Else retVal = rc
 
/* Detach the source and target disks */
'CP DETACH' vdev2
'CP DETACH' vdev4
If retVal <> 0 Then
Say 'Return value from COPYDISK' source target '=' retVal
boot.onetime script
The following boot.onetime script sets the IP address and host name for a newly cloned Linux at first boot:
#!/bin/bash
#
# /etc/init.d/boot.onetime
#
# chkconfig: 345 01 99
### BEGIN INIT INFO
# Provides: boot.onetime
# Description: upon first boot find/modify IP@ + hostname, gen SSH keys
### END INIT INFO
#
# This script requires two RHEL 5 parameter files to exist on the user ID's
# 191 disk: (1) the file RH62GOLD PARM-RH5 - the parameter file of the
# golden image and (2) $userid PARM-RHr6 - parameter file of the clone where
# $userid is the ID of the user that is running the script. It then modifies
# the IP address, Host name and fully qualified domain name in three
# configuration files that contain this info. It also regenerates SSH keys
# and checks the SOFTWARE variable to determine if additional scripts need be
# Copied. Finally it turns itself off via "chkconfig" so it only runs once.
#
# IBM DOES NOT WARRANT OR REPRESENT THAT THE CODE PROVIDED IS COMPLETE
# OR UP-TO-DATE. IBM DOES NOT WARRANT, REPRESENT OR IMPLY RELIABILITY,
# SERVICEABILITY OR FUNCTION OF THE CODE. IBM IS UNDER NO OBLIGATION TO
# UPDATE CONTENT NOR PROVIDE FURTHER SUPPORT.
# ALL CODE IS PROVIDED "AS IS," WITH NO WARRANTIES OR GUARANTEES WHATSOEVER.
# IBM EXPRESSLY DISCLAIMS TO THE FULLEST EXTENT PERMITTED BY LAW ALL EXPRESS,
# IMPLIED, STATUTORY AND OTHER WARRANTIES, GUARANTEES, OR REPRESENTATIONS,
# INCLUDING, WITHOUT LIMITATION, THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR
# A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF PROPRIETARY AND INTELLECTUAL
# PROPERTY RIGHTS. YOU UNDERSTAND AND AGREE THAT YOU USE THESE MATERIALS,
# INFORMATION, PRODUCTS, SOFTWARE, PROGRAMS, AND SERVICES, AT YOUR OWN
# DISCRETION AND RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGES
# THAT MAY RESULT, INCLUDING LOSS OF DATA OR DAMAGE TO YOUR COMPUTER SYSTEM.
# IN NO EVENT WILL IBM BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES OF ANY TYPE
# WHATSOEVER RELATED TO OR ARISING FROM USE OF THE CODE FOUND HEREIN, WITHOUT
# LIMITATION, ANY LOST PROFITS, BUSINESS INTERRUPTION, LOST SAVINGS, LOSS OF
# PROGRAMS OR OTHER DATA, EVEN IF IBM IS EXPRESSLY ADVISED OF THE POSSIBILITY
# OF SUCH DAMAGES. THIS EXCLUSION AND WAIVER OF LIABILITY APPLIES TO ALL
# CAUSES OF ACTION, WHETHER BASED ON CONTRACT, WARRANTY, TORT OR ANY OTHER
# LEGAL THEORIES.
#
#+--------------------------------------------------------------------------+
function msg()
# A wrapper around echo that also sends output to the output file in /tmp
# Args: text to echo
#+--------------------------------------------------------------------------+
{
echo "$this: $@"
echo "$@" >> $outFile
} # msg()
 
#+--------------------------------------------------------------------------+
function enable191disk()
# Enable the 191 disk and set the global variable disk191
#+--------------------------------------------------------------------------+
{
local devLine
local diskName
 
msg "Enabling the 191 disk"
chccwdev -e 191 > /dev/null 2>&1
rc=$?
if [ $rc != 0 ]; then # unable to enable 191 disk
echo "$this: Unable to enable 191, rc from chccwdev = $rc"
exit 1
fi
sleep 1 # wait a second for disk to be ready
udevadm settle
 
local devLine=`grep "^0.0.0191" /proc/dasd/devices` # the line with 191
if [ $? = 0 ]; then
diskName=`echo $devLine | sed -e 's/.* is //g' | awk '{print $1}'`
disk191="/dev/$diskName"
else
msg "Error: 191 disk not found in /proc/dasd/devices"
exit 2
fi
} # enable191disk()
 
#+--------------------------------------------------------------------------+
function initialize()
# set up for customizing new clone
#+--------------------------------------------------------------------------+
{
this=`basename $0`
echo "$this - starting at `date`" > $outFile
thisID=$(cat /proc/sysinfo | grep "VM00 Name" | awk '{print $3}')
if [ $thisID = "RH62GOLD" ]; then # don't do anything on this ID
msg "Warning: on golden image RH62GOLD - exiting"
exit
fi
msg "this userID = $thisID"
enable191disk
} # initialize()
 
#+--------------------------------------------------------------------------+
function findSourceIP()
# Get the source IP address and hostName
# Args: none
#+--------------------------------------------------------------------------+
{
sourceConf="$sourceID.$confType"
cmsfslst -d $disk191 | grep $sourceID | grep $confType > /dev/null
rc=$?
if [ $rc != 0 ]; then
echo "$0: $sourceConf not found on 191 minidisk. Exiting"
exit 2
fi
export local $(cmsfscat -a -d $disk191 $sourceConf)
# set global variable names escaping any dots (.) in the strings
sourceName=$(echo "$HOSTNAME" | sed -e 's:.:\.:g')
sourceHost=${HOSTNAME%%.*} # Chop domain name off to leave host name
msg "source host name = $sourceHost"
sourceIP=$(echo "$IPADDR" | sed -e 's:.:\.:g')
msg "source IP address = $sourceIP"
sourceIP2=$(echo "$IPADDR2" | sed -e 's:.:\.:g')
msg "source IP address 2 = $sourceIP2"
} # findSourceIP()
 
#+--------------------------------------------------------------------------+
function findTargetIP()
# Get my new IP address and hostname
# Args: none
#+--------------------------------------------------------------------------+
{
targetParm="$thisID.$confType"
msg "targetParm = $targetParm"
cmsfslst -d $disk191 | grep $thisID | grep $confType > /dev/null
rc=$?
if [ $rc != 0 ]; then
echo "$0: $targetParm not found on 191 minidisk. Exiting"
exit 3
fi
export local $(cmsfscat -a -d $disk191 $targetParm)
targetName=$HOSTNAME
targetHost=${HOSTNAME%%.*} # Chop domain name off to leave host name
msg "target host name = $targetHost"
targetIP=$IPADDR
msg "target IP address = $targetIP"
targetIP2=$IPADDR2
msg "target IP address 2 = $targetIP2"
} # findTargetIP()
 
#+--------------------------------------------------------------------------+
function modifyIP()
# Modify IP address and host name in /etc/hosts, /etc/sysconfig/network and
# /etc/sysconfig/network-scripts/ifcfg-eth0
# Args: none
#+--------------------------------------------------------------------------+
{
# TODO: this function should also modify, DNS, Gateway, broadcast, etc.
eth0file="/etc/sysconfig/network-scripts/ifcfg-eth0"
eth1file="/etc/sysconfig/network-scripts/ifcfg-eth1"
msg "Modifying network values"
sed --in-place -e "s/$sourceName/$targetName/g" /etc/hosts
sed --in-place -e "s/$sourceHost/$targetHost/g" /etc/hosts
sed --in-place -e "s/$sourceIP/$targetIP/g" /etc/hosts
sed --in-place -e "s/$sourceHost/$targetHost/g" /etc/sysconfig/network
sed --in-place -e "s/$sourceIP/$targetIP/g" $eth0file
sed --in-place -e "s/$sourceIP2/$targetIP2/g" $eth1file
hostname $targetHost
 
# change the hostname in the two Oracle response files
msg "Modifying values in Oracle response files"
sed --in-place -e "s/HOSTNAME=xxxx/HOSTNAME=$targetName/g" /tmp/database.rsp
} # modifyIP()
 
#+--------------------------------------------------------------------------+
function rmSSHkeys()
# Remove the host SSH keys - when sshd starts they will be recreated
# Args: none
#+--------------------------------------------------------------------------+
{
rm /etc/ssh/ssh_host_*
} # rmSSHkeys()
 
#+--------------------------------------------------------------------------+
# global variables
disk191="" # device file name of the 191 disk
sourceID="RH62GOLD" # VM user ID where first Linux was installed
confType="CONF-RH6" # File type of configuration file on 191 disk
outFile="/tmp/boot.onetime.out" # the output file
this="" # the name of this command
 
# main()
if [ "$1" = "start" ]; then # configure the system
initialize "$@"
findSourceIP
findTargetIP
modifyIP
rmSSHkeys
chkconfig boot.onetime off # run only once => turn self off
fi
boot.oracle script
The following boot.oracle script prepares a newly cloned RHEL 6.2 Linux system for an installation of Oracle stand-alone or grid software:
#!/bin/bash
#
# boot.oracle Configure this virtual machine for Oracle standalone or grid
#
# chkconfig: 345 98 2
#
# IBM DOES NOT WARRANT OR REPRESENT THAT THE CODE PROVIDED IS COMPLETE
# OR UP-TO-DATE. IBM DOES NOT WARRANT, REPRESENT OR IMPLY RELIABILITY,
# SERVICEABILITY OR FUNCTION OF THE CODE. IBM IS UNDER NO OBLIGATION TO
# UPDATE CONTENT NOR PROVIDE FURTHER SUPPORT.
# ALL CODE IS PROVIDED "AS IS," WITH NO WARRANTIES OR GUARANTEES WHATSOEVER.
# IBM EXPRESSLY DISCLAIMS TO THE FULLEST EXTENT PERMITTED BY LAW ALL EXPRESS,
# IMPLIED, STATUTORY AND OTHER WARRANTIES, GUARANTEES, OR REPRESENTATIONS,
# INCLUDING, WITHOUT LIMITATION, THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR
# A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF PROPRIETARY AND INTELLECTUAL
# PROPERTY RIGHTS. YOU UNDERSTAND AND AGREE THAT YOU USE THESE MATERIALS,
# INFORMATION, PRODUCTS, SOFTWARE, PROGRAMS, AND SERVICES, AT YOUR OWN
# DISCRETION AND RISK AND THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGES
# THAT MAY RESULT, INCLUDING LOSS OF DATA OR DAMAGE TO YOUR COMPUTER SYSTEM.
# IN NO EVENT WILL IBM BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES OF ANY TYPE
# WHATSOEVER RELATED TO OR ARISING FROM USE OF THE CODE FOUND HEREIN, WITHOUT
# LIMITATION, ANY LOST PROFITS, BUSINESS INTERRUPTION, LOST SAVINGS, LOSS OF
# PROGRAMS OR OTHER DATA, EVEN IF IBM IS EXPRESSLY ADVISED OF THE POSSIBILITY
# OF SUCH DAMAGES. THIS EXCLUSION AND WAIVER OF LIABILITY APPLIES TO ALL
# CAUSES OF ACTION, WHETHER BASED ON CONTRACT, WARRANTY, TORT OR ANY OTHER
# LEGAL THEORIES.
#
#+--------------------------------------------------------------------------+
function msg()
# A wrapper to send messages to console and to the output file
# Args: text to echo
#+--------------------------------------------------------------------------+
{
echo "$this: $@"
echo "$@" >> $outFile
} # msg()
 
#+--------------------------------------------------------------------------+
function section()
# A wrapper to send messages for the start of a new section
# Args: text to echo
#+--------------------------------------------------------------------------+
{
echo "" >> $outFile
echo "--------------------------------------------------------" >> $outFile
echo "$this: $@"
echo "$@" >> $outFile
echo "--------------------------------------------------------" >> $outFile
} # msg()
 
#+--------------------------------------------------------------------------+
function enable191disk()
# Enable the 191 disk and set the global variable disk191
# Args: none
#+--------------------------------------------------------------------------+
{
local devLine
local diskName
 
# disable and enable the 191 disk to pick up any changes
chccwdev -d 191 > /dev/null 2>&1
chccwdev -e 191 > /dev/null 2>&1
rc=$?
if [ $rc != 0 ]; then # unable to enable 191 disk
echo "$this: Unable to enable 191, rc from chccwdev = $rc"
exit 1
fi
sleep 1 # wait a second for disk to be ready
udevadm settle
 
local devLine=`grep "^0.0.0191" /proc/dasd/devices` # the line with 191
if [ $? = 0 ]; then
diskName=`echo $devLine | sed -e 's/.* is //g' | awk '{print $1}'`
disk191="/dev/$diskName"
else
msg "Error: 191 disk not found in /proc/dasd/devices"
exit 2
fi
} # enable191disk()
 
#+--------------------------------------------------------------------------+
function getSoftwareVar()
# Get the value of the SOFTWARE variable in the <userID>.CONF-RH6 file
# If it is either "OracleStandalone" or "OracleGrid" then configure the server
# Args: none
#+--------------------------------------------------------------------------+
{
local userID=`cat /proc/sysinfo | grep "VM00 Name" | awk '{print $3}'`
if [ "$userID" = "$goldenID" ]; then # we're on the golden image - exit
msg "Warning: running on golden image $goldenID - exiting"
exit 3
fi
parmFile="$userID.$confType"
section "Searching for SOFTWARE variable in parameter file $parmFile"
cmsfslst -d $disk191 | grep $userID | grep $confType > /dev/null
if [ $? != 0 ]; then
msg "Error: $parmFile not found on 191 minidisk"
exit 4
fi
export local $(cmsfscat -a -d $disk191 $parmFile)
msg "SOFTWARE variable = $SOFTWARE"
} # getSoftwareVar()
 
#+--------------------------------------------------------------------------+
function initialize()
# basic initialization - set variables this and outFile and start the output
# file
#+--------------------------------------------------------------------------+
{
this=`basename $0`
# save one copy of the output file
if [ -f $outFile ]; then # file exists - make a backup copy
cp $outFile $outFile.orig
fi
echo "$this - starting at `date`" > $outFile
enable191disk # enable the CMS 191 disk
getSoftwareVar # check if this is an Oracle server
}
 
#+--------------------------------------------------------------------------+
function exitNow()
# Exit the script now with a code and a message
# Arg 1: Exit code
# Remaining args: Command to issue
#+--------------------------------------------------------------------------+
{
local exitVal=$1
shift
msg="$@"
msg "Severe error: $msg"
msg "Exiting with $exitVal"
chkconfig $this off
exit $exitVal
} # exitNow()
 
#+--------------------------------------------------------------------------+
function warnCmd()
# Issue a command, check return code and issue warning if non-zero
# Args: Command to issue
#+--------------------------------------------------------------------------+
{
cmd="$@"
msg "cmd: $cmd"
$cmd >> $outFile 2>&1
rc=$?
if [ "$rc" != 0 ]; then # issue warning
msg "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
msg "Warning: $cmd returned $rc"
msg "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
fi
return $rc
} # warnCmd()
 
#+--------------------------------------------------------------------------+
function exitCmd()
# Issue a command, check return code and abort if non-zero
# Arg 1: Exit code
# Remaining args: Command to issue
#+--------------------------------------------------------------------------+
{
local exitVal=$1
shift
cmd="$@"
msg "running: $cmd"
$cmd
rc=$?
if [ "$rc" != 0 ]; then # issue message and abort
msg "Severe error: $cmd returned $rc"
msg "Exiting with $exitVal"
chkconfig $this off
exit $exitVal
fi
return $rc
} # exitCmd()
 
#+--------------------------------------------------------------------------+
function checkForRPMs()
# Check for co-requisite Oracle RPMs
# Arg 1: "ora" or "grid"
#+--------------------------------------------------------------------------+
{
local type=$1
 
if [ ! -f "$oravalRPM" ]; then # co-req RPM not found => error
msg "Error: $oravalRPM not found - exiting with 5"
exit 5
fi
if [ "$type" = "grid" -a ! -f "$cvuqdiskRPM" ]; then # error
msg "Error: $cvuqdiskRPM not found - exiting with 6"
exit 6
fi
 
} # checkForRPMs()
 
#+--------------------------------------------------------------------------+
function yumInstallRPMs()
# Install s390 and s390x RPMs for Oracle in the global variable "allRPMs"
# Also install "ksh" which only has a s390x flavor. Finally, install the
# Oracle RPM that tests co-reqs: ora-val-rpm-EL6-DB-11.2.0.3-1.s390x.rpm
# Arg 1: "ora" or "grid"
#+--------------------------------------------------------------------------+
{
local type=$1
local nextRPM
 
section "Installing all RPMs with yum"
for nextRPM in $allRPMs; do # install this RPM
warnCmd yum -y -q install $nextRPM.s390
warnCmd yum -y -q install $nextRPM.s390x
done
 
# install the ksh RPM which only has an s390x flavor
warnCmd yum -y -q install ksh
 
# install the Oracle RPM that tests co-reqs
section "Installing RPM $oravalRPM to test co-reqs"
warnCmd rpm -i $oravalRPM
# for grid servers, also install the cvuqdisk RPM
if [ "$type" = "grid" ]; then # also install the cvuqdisk RPM
warnCmd rpm -i $cvuqdiskRPM
fi
} # yumInstallRPMs()
 
#+--------------------------------------------------------------------------+
function createGroup()
# Create a group if it doesn't already exist
# Arg 1: The group name
# Arg 2: The group ID
#+--------------------------------------------------------------------------+
{
# set the three required parameters
local theGroup=$1
local gid=$2
 
# check if the group exists
grep "^$theGroup" /etc/group > /dev/null 2>&1
if [ $? = 0 ]; then # group exists => issue warning message
msg "group $theGroup already exists"
else # group doesn't exist => create it
warnCmd groupadd -g $gid $theGroup
fi
} # createGroup()
 
#+--------------------------------------------------------------------------+
function createUser()
# Create one user if it doesn't already exist
# Arg 1: The user name
# Arg 2: The user ID
# Arg 3: The primary group
# Arg 4: Additional groups separated by commas
#+--------------------------------------------------------------------------+
{
# set the three required parameters
local user=$1
local uid=$2
local mainGrp=$3
local suppGrps
local ksh="/bin/ksh"
 
# check if the user exists
id $user > /dev/null 2>&1
if [ $? = 0 ]; then # user exists => issue warning message
msg "user $user already exists"
else # user doesn't exist => create it
if [ ${#4} = 0 ]; then # there are no additional groups
suppGrps=""
else # 4th arg is additional groups
suppGrps="-G $4"
fi
warnCmd useradd -u $uid -g $mainGrp $suppGrps -m -d /home/$user -s $ksh $user
warnCmd chown $user.$mainGrp /home/$user
fi
} # createUser()
 
#+--------------------------------------------------------------------------+
function createGroupsUsers()
# Set up Oracle users and groups
# Args: none
#+--------------------------------------------------------------------------+
{
section "Creating Oracle groups and users"
createGroup oinstall 501
createGroup dba 502
createGroup asmadmin 503
createUser grid 501 oinstall asmadmin,dba
createUser oracle 502 oinstall asmadmin,dba
} # createGroupsUsers()
 
#+--------------------------------------------------------------------------+
function setNTP()
# Modify the /etc/sysconfig/ntpd file for Oracle
# Args: none
#+--------------------------------------------------------------------------+
{
local NTPfile="/etc/sysconfig/ntpd"
 
section "Modifying file $NTPfile"
warnCmd /bin/cp $NTPfile /tmp/ntpd.orig
msg "cmd: sed -i -e 's/-u ntp:ntp/-x -u ntp:ntp/g' $NTPfile"
sed -i -e 's/-u ntp:ntp/-x -u ntp:ntp/g' $NTPfile
rc=$?
if [ "$rc" != 0 ]; then
msg "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
msg "Warning: sed command to /etc/sysconfig/ntp returned $rc"
msg "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
fi
warnCmd chkconfig ntpd on
} # setNTP()
 
#+--------------------------------------------------------------------------+
function setKernelParms()
# Set kernel parameters needed for Oracle
# Arg 1: "ora" or "grid"
#+--------------------------------------------------------------------------+
{
local type=$1
 
section "Setting kernel parameters in /etc/sysctl.conf"
warnCmd /bin/cp /etc/sysctl.conf /tmp/sysctl.conf.orig
echo "#" >> /etc/sysctl.conf
echo "# Oracle kernel specific parameters" >> /etc/sysctl.conf
echo "#" >> /etc/sysctl.conf
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmax = 4218210304" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048576" >> /etc/sysctl.conf
echo "kernel.spin_retry = 2000" >> /etc/sysctl.conf
echo "#vm.nr_hugepages = 4000 # for large SGAs > 10 GB" >> /etc/sysctl.conf
 
# run sysctl -p so the settings take effect immediately
warnCmd "sysctl -p" > /dev/null 2>&1
} # setKernelParms()
 
#+--------------------------------------------------------------------------+
function setLimitsDotConf()
# Configure the /etc/security/limits.conf file
# Args: none
#+--------------------------------------------------------------------------+
{
local limitsFile="/etc/security/limits.conf"
 
section "Setting limits in $limitsFile"
warnCmd /bin/cp $limitsFile /tmp/limits.conf.orig
echo "# Settings for Oracle:" >> $limitsFile
echo "grid soft nofile 1024" >> $limitsFile
echo "grid hard nofile 65536" >> $limitsFile
echo "grid soft nproc 2047" >> $limitsFile
echo "grid hard nproc 16384" >> $limitsFile
echo "#" >> $limitsFile
echo "oracle soft nofile 1024" >> $limitsFile
echo "oracle hard nofile 65536" >> $limitsFile
echo "oracle soft nproc 2047" >> $limitsFile
echo "oracle hard nproc 16384" >> $limitsFile
echo "#" >> $limitsFile
echo "# Use memlock for Huge Pages support" >> $limitsFile
echo "#* soft memlock 3145728" >> $limitsFile
echo "#* hard memlock 3145728" >> $limitsFile
} # setLimitsDotConf()
 
#+--------------------------------------------------------------------------+
function setUlimits()
# Set two ulimits for a user
# Arg 1: "ora" or "grid"
#+--------------------------------------------------------------------------+
{
local profile
user=$1
 
if [ "$user" = "ora" ]; then # use oracle global var
profile=$oraProfile
else
profile=$gridProfile
fi
echo 'ulimit -n 65536' >> $profile
echo 'ulimit -u 16384' >> $profile
} # setUlimits()
 
#+--------------------------------------------------------------------------+
function createOraProfile()
# Set environment variables and PATH variable in oracle's .profile
# Args: none
#+--------------------------------------------------------------------------+
{
if [ ! -d /home/oracle ]; then
msg "Error: /home/oracle does not exist"
exit 7
fi
 
# set environment variables for the oracle user
echo "export ORACLE_HOME=/opt/oracle/11.2" > $oraProfile
echo "export ORACLE_BASE=/opt/oracle" >> $oraProfile
echo "export ORACLE_SID=orcl" >> $oraProfile
echo 'export PATH=$PATH:$ORACLE_HOME/bin' >> $oraProfile
chown oracle.oinstall $oraProfile
 
# add ulimit commands
setUlimits oracle
} # createOraProfile()
 
#+--------------------------------------------------------------------------+
function createGridProfile()
# Set environment variables and PATH variable in grid's .profile
# Args: none
#+--------------------------------------------------------------------------+
{
if [ ! -d /home/grid ]; then
msg "Error: /home/grid does not exist"
exit 8
fi
 
# set environment variables for the grid user
echo "export GRID_HOME=/opt/grid/??" > $gridProfile
echo "export GRID_BASE=/opt/grid" >> $gridProfile
echo 'export PATH=$PATH:$GRID_HOME/bin' >> $gridProfile
chown grid.oinstall $gridProfile
 
# add ulimit commands
setUlimits grid
} # createGridProfile()
 
#+--------------------------------------------------------------------------+
function enableLUNs()
# Create the config file /etc/zfcp.conf and run zfcpconf.sh which onlines LUNs
# Args: none
# return: 0 = success
# 1 = one of 4 FCP variables not set
#+--------------------------------------------------------------------------+
{
if [ ${#FCP400WWPN} = 0 ]; then
msg "Warning: FCP400WWPN is not set in $parmFile"
return 1
fi
if [ ${#FCP500WWPN} = 0 ]; then
msg "Warning: FCP500WWPN is not set in $parmFile"
return 1
fi
if [ ${#FCPLUN1} = 0 ]; then
msg "Warning: FCPLUN1 is not set in $parmFile"
return 1
fi
if [ ${#FCPLUN2} = 0 ]; then
msg "Warning: FCPLUN2 is not set in $parmFile"
return 1
fi
 
# export the variables in the CONF file and create 4 LUNs in /etc/zfcp.conf
section "Enabling LUNs in /etc/zfcp.conf with zfcpconf.sh"
echo "0.0.0400 $FCP400WWPN $FCPLUN1" >> /etc/zfcp.conf
echo "0.0.0400 $FCP400WWPN $FCPLUN2" >> /etc/zfcp.conf
echo "0.0.0500 $FCP500WWPN $FCPLUN1" >> /etc/zfcp.conf
echo "0.0.0500 $FCP500WWPN $FCPLUN2" >> /etc/zfcp.conf
 
# run zfcpconf.sh to configure LUNs which reads /etc/zfcp.conf
msg "cmd: /sbin/zfcpconf.sh"
/sbin/zfcpconf.sh # can't check rc as it always returns 1
} # enableLUNs()
 
#+--------------------------------------------------------------------------+
function mkLogicalVolume()
# Make a logical volume named from the partitions passed in with the
# following characteristics:
# Number of stripes = num partitions (-i $numPartitions)
# Stripe size = 64 KB (-I 64)
# Read ahead = off (-r 0)
# Use all space (-l 100%VG)
# LV name = oradata_lv (-n oradata_lv) - set in the dataName global var
# Args: partitions from which to make the logical volume
#+--------------------------------------------------------------------------+
{
local allPartitions="$@"
local numPartitions="$#"
 
# make physical volumes of each of the partitions
section "Creating logical volume for data"
for nextPartition in $allPartition; do
msg "Making partition on $nextPartition"
exitCmd 9 pvcreate $nextPartition
done
 
# make a volume group named $dataName_vg of the physical volumes
msg "Creating volume group ${dataName}_vg"
warnCmd vgcreate ${dataName}_vg $allPartitions
 
# make the logical volume
msg "Creating logical volume ${dataName}_lv"
LVargs="-i $numPartitions -I 64 -r 0 -l 100%VG -n ${dataName}_lv"
warnCmd "lvcreate $LVargs ${dataName}_vg"
warnCmd udevadm settle
} # mkLogicalVolume()
 
#+--------------------------------------------------------------------------+
function mountLogicalVolume()
# Mount the logical volume
# Arg 1: logical volume to mount
# Arg 2: mount point
#+--------------------------------------------------------------------------+
{
local lv=$1
local mountPt=$2
 
# make the mount point if it doesn't exist
section "Mounting the logical volume /dev/${dataName}_vg/${dataName}_lv"
if [ ! -d $mountPt ]; then # mount point does not exist => create it
warnCmd mkdir $mountPt
fi
 
# add the file system and LV to /etc/fstab if not already there
grep "^/dev/mapper/${dataName}_vg-${dataName}_lv" /etc/fstab > /dev/null 2>&1
if [ $? != 0 ]; then # LV name not in fstab => append it
local fstabLine="/dev/mapper/${dataName}_vg-${dataName}_lv /${dataName} ext4 defaults 0 0"
warnCmd cp /etc/fstab /tmp/fstab.orig
echo "$fstabLine" >> /etc/fstab
fi
 
# make a file system on the logical volume
msg "Making an ext4 file system on $lv"
warnCmd mkfs.ext4 $lv
 
# make oracle the owner of the data mount point
msg "Making oracle the owner of $mountPt"
warnCmd chown oracle.oinstall $mountPt
 
# mount the LV over the mount point
msg "Mounting $lv over $mountPt"
warnCmd mount $lv $mountPt
} # mountLogicalVolume()
 
#+--------------------------------------------------------------------------+
function setFCPdevices()
# Given two FCP devices (400 and 500) and two LUNs, set the LUNs online,
# make an LVM out of them and mount it over /oradata
# Further assumptions are that there are two LUNs and one WWPN for each
# of the 400 and 500 FCP devices. The values are set in variables:
# FCP<device>WWPN, FCP<device>LUN1 and FCP<device>LUN2
# Arg 1: "ora" or "grid"
# return: 0 = success
# 1 = enableLUNs() failed
#+--------------------------------------------------------------------------+
{
local type=$1
 
# enable the two LUNs over two channel paths
enableLUNs
if [ $? != 0 ]; then # unable to enable LUNs
msg "Warning: enableLUNs() failed - not setting up LUNs"
return 2
fi
# start the multipathd service
exitCmd 10 service multipathd start
warnCmd sleep 1
warnCmd udevadm settle
 
# stop and start multipathing
msg "stopping multipathd"
warnCmd service multipathd stop # stop the service
msg "Running: multipath -F" # issue a message
multipath -F # flush the cache
warnCmd chkconfig multipathd on # start multipath service at boot
warnCmd service multipathd start # start the service now
warnCmd multipath # run multipath one time
 
# for Oracle standalone, make a logical volume of the LUNs then mount it
if [ "$type" = "ora" ]; then # make LV and mount it
mkLogicalVolume /dev/mapper/mpatha /dev/mapper/mpathb
mountLogicalVolume /dev/${dataName}_vg/${dataName}_lv /$dataName
else # voting disks and data FCP LUNs will be controlled by ASM
setDiskOwnership
fi
} # setFCPdevices()
 
#+--------------------------------------------------------------------------+
function mkDirectories()
# Make HOME and BASE directories for oracle and grid
# Arg 1: "ora" or "grid"
#+--------------------------------------------------------------------------+
{
local type=$1
 
# make the data directory first
warnCmd mkdir /$dataName
warnCmd chown oracle.oinstall /$dataName
 
# make the inventory directory
warnCmd mkdir /opt/oraInventory
warnCmd chown oracle.oinstall /opt/oraInventory
 
# make the directories for binaries
warnCmd mkdir $baseDir/oracle
warnCmd mkdir $baseDir/oracle/11.2
if [ "$type" = "grid" ]; then # also create grid directories
warnCmd mkdir /opt/gridInventory
warnCmd chown grid.oinstall /opt/gridInventory
warnCmd mkdir $baseDir/grid
warnCmd mkdir $baseDir/grid/base
warnCmd mkdir $baseDir/grid/11.2
warnCmd chown -R grid.oinstall $baseDir/grid
fi
warnCmd chown -R oracle.oinstall $baseDir/oracle
warnCmd chmod -R 775 $baseDir
} # mkDirectories()
 
#+--------------------------------------------------------------------------+
function mkResponseFile()
# Copy a response file in /tmp and modify certain settings based on i
# variables in the CONF file:
# PASSWORD - A common password to be used (ora and grid)
# SCANNAME - The scanName and clusterName variables (grid only)
# NODELIST - the nodeList varaible (grid only)
# Arg 1: "ora" or "grid"
#+--------------------------------------------------------------------------+
{
local type=$1
 
# make a database.rsp file in the oracle home directory
cat /tmp/database.rsp | sed
-e "s/Password=xxxx/Password=$PASSWORD/g"
-e "s/clusterNodes=xxxx/clusterNodes=xxxx$NODELIST/g"
-e "s/ALL=xxxx/ALL=$PASSWORD/g" > /home/oracle/database.rsp
chown oracle.oinstall /home/oracle/database.rsp
} # mkResponseFile()
 
#+--------------------------------------------------------------------------+
function setDiskOwnership()
# Add rules the a new file, 99-udev-oracle.rules, for three voting disks 200-202
# Args: none
#+--------------------------------------------------------------------------+
{
udevFile=/etc/udev/rules.d/99-udev-oracle.rules
rcFile=/etc/rc.d/rc.local
 
# enable the three voting disks
for vdev in 200 201 202; do
warnCmd "chccwdev -e $vdev"
done
# set the ownership of the three voting disks with udev rules
echo '# change ownership of disks for Oracle ASM' > $udevFile
echo 'KERNEL=="dasd*1",ID=="0.0.0200",OWNER="grid",GROUP="dba",MODE="0660"' >> $udevFile
echo 'KERNEL=="dasd*1",ID=="0.0.0201",OWNER="grid",GROUP="dba",MODE="0660"' >> $udevFile
echo 'KERNEL=="dasd*1",ID=="0.0.0202",OWNER="grid",GROUP="dba",MODE="0660"' >> $udevFile
 
# set the ownership of the two data disks with the /etc/init.d/rc.local file
echo "" >> $rcFile
echo "# Set ownership of two data disks for Oracle ASM" >> $rcFile
echo "chown oracle:asmadmin /dev/mapper/mpatha" >> $rcFile
echo "chown oracle:asmadmin /dev/mapper/mpathb" >> $rcFile
} # setDiskOwnership()
 
#+--------------------------------------------------------------------------+
function configureOracle()
# Configure a new Linux system for Oracle either standalone database or grid
# cluster
# Args: none
#+--------------------------------------------------------------------------+
{
if [ "$SOFTWARE" = "OracleStandalone" ]; then # Oracle standalone server
msg "Preparing for Oracle standalone installation"
checkForRPMs ora # check for Oracle RPMs
createGroupsUsers ora # define users and groups
yumInstallRPMs ora # add RPMs necessary for Oracle with yum
setNTP # configure the NTP service
setLimitsDotConf # configure limits.conf file
createOraProfile # set up .profile for oracle user
setKernelParms ora # configure kernel parameters
setFCPdevices ora # set FCP devices online
mkDirectories ora # make directories for Oracle standalone
mkResponseFile ora # customize the database response file
elif [ "$SOFTWARE" = "OracleGrid" ]; then # Oracle CRS cluster server
msg "Preparing for Oracle grid installation"
checkForRPMs grid # check for Oracle RPMs
createGroupsUsers grid # define users and groups
yumInstallRPMs grid # add RPMs necessary for Oracle with yum
setNTP # configure the NTP service
setLimitsDotConf # configure limits.conf file
createOraProfile # set up .profile for the oracle user
createGridProfile # set up .profile for the grid user
setKernelParms grid # configure kernel parameters
setFCPdevices grid # set FCP devices online
mkDirectories grid # make directories for Oracle grid
mkResponseFile grid # customize the grid response file
else # not an Oracle system
msg "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
msg "SOFTWARE varaiable not set to 'OracleStandalone' or 'OracleGrid' - exiting"
msg "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
exit 11
fi
} # configureOracle()
 
#+--------------------------------------------------------------------------+
function successMsg()
# Issue a success message
# Args: none
#+--------------------------------------------------------------------------+
{
msg "*"
msg "********************************************************"
msg "Sucessfully completed!"
msg "********************************************************"
} # successMsg()
 
#+--------------------------------------------------------------------------+
# global variables
allRPMs="compat-libcap1 compat-libstdc++-33 elfutils-libelf-devel libaio-devel"
confType="CONF-RH6" # File type of configuration file
dataName="oradata" # Oracle data mount point, vg name, etc
baseDir="/opt" # directory with LV for Oracle binaries
disk191="" # device file name of the 191 disk
goldenID="RH62GOLD" # user ID of the golden image
outFile="/tmp/boot.oracle.out" # the output file
gridProfile=/home/grid/.profile # the grid user's profile
oraProfile=/home/oracle/.profile # the oracle user's profile
cvuqdiskRPM="/tmp/cvuqdisk-1.0.9-1.rpm" # two required Oracle RPMs
oravalRPM="/tmp/ora-val-rpm-EL6-DB-11.2.0.3-1.s390x.rpm"
parmFile="" # the CMS parameter file
this="" # the name of this command
 
# main()
if [ "$1" = "start" ]; then # configure the system
initialize # set up
configureOracle # do the real work
chkconfig boot.oracle off # turn self off so runs just once
successMsg # success if we fall through to here
fi
database.rsp response file
The following database.rsp response file is used to silently install Oracle database:
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_AND_CONFIG
ORACLE_HOSTNAME=xxxx
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/opt/oraInventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/opt/oracle/11.2
ORACLE_BASE=/opt/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.3.0,oracle.oraolap:11.2.0.3.0,oracle.rdbms.dm:11.2.0.3.0,oracle.rdbms.dv:11.2.0.3.0,oracle.rdbms.lbac:11.2.0.3.0,oracle.rdbms.rat:11.2.0.3.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.isRACOneInstall=false
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=rac.us.oracle.com
oracle.install.db.config.starterdb.SID=rac
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=2000
oracle.install.db.config.starterdb.installExampleSchemas=true
oracle.install.db.config.starterdb.enableSecuritySettings=false
oracle.install.db.config.starterdb.password.ALL=xxxx
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/oradata
oracle.install.db.config.asm.ASMSNMPPassword=xxxx
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
oracle.installer.autoupdates.option=SKIP_UPDATES
Sample script for preoracle.sh
The sample shell preporacle.sh script file is used for the first time to customize a Linux environment for Oracle.
The script is used in a second step to start the Oracle runInstaller program.
Because it updates the Linux system configuration files, such as, sysctl.conf, limits.conf, or ssh scripts, the file must be carefully tested before it is implemented in a production, as shown in the following example:
 
#!/bin/sh
#
# preporacle.sh
#
# Script shell used to prepare Oracle Single Instance environment on Linux System z
# for Oracle 11G Release and launch a silent installation
# C. Noirault - A. Cheve
# 2012, September 17th
# Must be carefully tested before implementing in a production.
#
# First section must be configured with your variables.
# Second section performs:
# Groups and Users Creation
# Update the Oracle profile
# Copies the silent install script
# Test and create if needed /usr/local/bin
# Create directories needed to install Oracle
# Update kernel parameters in /etc/sysctl.conf
# Update /etc/limits.conf
# Update /etc/pam.d/sshd
# Install rpms for Oracle
# Prepare a vncserver to avoid being prompted when starting vncserver before Oracle Install
# Third section launches Silent runInstaller
#
# The mounted NFS server should contain unzipped Oracle code packages:
# Oracle code in /mnt/database
# Custom Admin scripts in /mnt/script, including silent install and rpms
#
# Customize below with your own names, group and paths
#######################################################
# Oracle user definitions
#set -x
ORACLE_INSTALL_UID=1100
ORACLE_INSTALL_USER=oracle
ORACLE_INSTALL_GROUP=oinstall
# Groups definitions
ORACLE_INSTALL_GID=1100
ORACLE_DBA_GID=1101
ORACLE_OPER_GID=1102
# Directories definitions
ORACLE_USER_HOME=/home/$ORACLE_INSTALL_USER
ORACLE_ROOT=/u01/oracle
ORACLE_INVENTORY=/u01/oraInventory
ORACLE_SOURCE_NFS=l5ntcdom.mop.ibm.com:/drivers
ORACLE_INSTALL_MNT=/mnt
ORACLE_SI_SCRIPT=db-install-11.2.0.3-SLES11SP1.rsp
ORACLE_DATA=/$ORACLE_ROOT/oradata
ORAOUTPUT=/tmp/preporacle.out
#######################################################
echo "Starting Oracle Environment Customization" > $ORAOUTPUT
echo "################################################################################" >> $ORAOUTPUT
echo "Setting the environment with the variables below:" >> $ORAOUTPUT
echo "Oracle UserId = " $ORACLE_INSTALL_UID >> $ORAOUTPUT
echo "Oracle Name = " $ORACLE_INSTALL_USER >> $ORAOUTPUT
echo "Oracle Group Name = " $ORACLE_INSTALL_GROUP >> $ORAOUTPUT
echo "Oracle GroupId = " $ORACLE_INSTALL_GID >> $ORAOUTPUT
echo "DBA GroupId = " $ORACLE_DBA_GID >> $ORAOUTPUT
echo "OPERATOR GroupId= " $ORACLE_OPER_GID >> $ORAOUTPUT
echo "Oracle Linux Home Directory = " $ORACLE_USER_HOME >> $ORAOUTPUT
echo "Oracle Installation Base Directory = " $ORACLE_ROOT >> $ORAOUTPUT
echo "Oracle Inventory Referential Directory = " $ORACLE_INVENTORY >> $ORAOUTPUT
echo "Oracle RAC Home Directory = " $ORACLE_RAC >> $ORAOUTPUT
#######################################################
#
# Unmount/mount nfs source directory
#
#######################################################
cd /
umount /mnt 1>/dev/null 2>&1
mount -t nfs $ORACLE_SOURCE_NFS /mnt >> $ORAOUTPUT
vmount=`ls -l /mnt | wc -l`
if [ $vmount -lt 2 ] ; then
echo "Oracle Source Mounted Filesystem is empty !" >> $ORAOUTPUT
#return -1
else
#######################################################
#
# Groups creation
# oracle
vgroup=`cat /etc/group | grep oinstall | wc -l `
if [ $vgroup -ne 1 ] ; then
echo "creation du groupe oinstall" >> $ORAOUTPUT
groupadd -g $ORACLE_INSTALL_GID $ORACLE_INSTALL_GROUP
fi
echo "group oinstall OK" >> $ORAOUTPUT
# oracle dba
vgroup=`cat /etc/group | grep dba | wc -l `
if [ $vgroup -ne 1 ] ; then
echo "creation du groupe oinstall" >> $ORAOUTPUT
groupadd -g $ORACLE_DBA_GID dba
fi
echo "group dba OK" >> $ORAOUTPUT
# oracle operator
vgroup=`cat /etc/group | grep oper | wc -l `
if [ $vgroup -ne 1 ] ; then
echo "creation du groupe oper" >> $ORAOUTPUT
groupadd -g $ORACLE_OPER_GID oper
fi
echo "group oper OK" >> $ORAOUTPUT
#
# Test the oracle user existence. Add oracle user if not there
USERORACLE=`cat /etc/passwd | grep $ORACLE_INSTALL_USER | wc -l`
echo " cat /etc/passwd | grep $ORACLE_INSTALL_USER | wc -l =>"$USERORACLE"<=" >> $ORAOUTPUT
if [ $USERORACLE -ne 1 ] ; then
useradd -u $ORACLE_INSTALL_UID -g $ORACLE_INSTALL_GID -G oinstall,dba,oper -s /bin/ksh -m $ORACLE_INSTALL_USER
if [ ! -d $ORACLE_USER_HOME ]; then
# Create the oracle user home directory and change directory permission bits
echo "Creating "$ORACLE_USER_HOME >> $ORAOUTPUT
mkdir $ORACLE_USER_HOME
chown -R $ORACLE_INSTALL_USER":"$ORACLE_INSTALL_GROUP $ORACLE_USER_HOME
fi
fi
#
# Update oracle user .profile
cd $ORACLE_USER_HOME
echo "Saving "$ORACLE_USER_HOME"/.profile into "$ORACLE_USER_HOME"/.profile.back" >> $ORAOUTPUT
cp .profile .profile.back
echo "# oracle " >>.profile
echo "export TMP=/tmp" >>.profile
echo "export TMPDIR="$TMP >>.profile
echo "export ORACLE_HOSTNAME=$HOSTNAME" >>.profile
echo "export ORACLE_BASE="$ORACLE_ROOT >>.profile
echo "export DB_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1" >>.profile
echo "export ORACLE_HOME=$DB_HOME" >>.profile
echo "export PATH=$PATH:$ORACLE_HOME/bin" >>.profile
echo "export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib" >>.profile
echo "#export ORACLE_SID=RAC1" >>.profile
echo "#export ORACLE_TERM=xterm" >>.profile
 
# DISPLAY
echo "export DISPLAY=:1.0" >>.profile
# set hard limits for Oracle
echo "ulimit -n 65535" >>.profile
echo "ulimit -u 16384" >>.profile
echo "ulimit -s 32768" >>.profile
echo "# End oracle " >>.profile
chown -R $ORACLE_INSTALL_USER":"$ORACLE_INSTALL_GROUP $ORACLE_USER_HOME
#
# Change Oracle user password
echo "oracle user is created. Change oracle password please"
#passwd oracle
#
# Copy script to Oracle home
cp $ORACLE_INSTALL_MNT/script/$ORACLE_SI_SCRIPT $ORACLE_USER_HOME
echo "cp "$ORACLE_INSTALL_MNT/script/$ORACLE_SI_SCRIPT $ORACLE_USER_HOME >> $ORAOUTPUT
# Customize the script contents with new system hostname
echo "s/ORACLE_HOSTNAME=.*/ORACLE_HOSTNAME=`hostname --long`/" > /tmp/silentscript1.tmp
cat /tmp/silentscript1.tmp >> $ORAOUTPUT
sed -f "/tmp/silentscript1.tmp" "$ORACLE_INSTALL_MNT/script/$ORACLE_SI_SCRIPT" > /tmp/silentscript2.tmp
grep "ORACLE_HOSTNAME" /tmp/silentscript2.tmp >> $ORAOUTPUT
mv /tmp/silentscript2.tmp $ORACLE_USER_HOME/$ORACLE_SI_SCRIPT >> $ORAOUTPUT
rm /tmp/silentscript1.tmp >> $ORAOUTPUT
# Change script permission bits
chown $ORACLE_INSTALL_USER":"$ORACLE_INSTALL_GROUP $ORACLE_USER_HOME/$ORACLE_SI_SCRIPT
echo "chown "$ORACLE_INSTALL_USER":"$ORACLE_INSTALL_GROUP $ORACLE_USER_HOME/$ORACLE_SI_SCRIPT >> $ORAOUTPUT
#
# Test and create if needed /usr/local/bin
# Change /usr/local/bin directory permission bits to avoid being prompted by Oracle install program
if [ ! -d /usr/local/bin ]; then
echo "creation /usr/local" >> $ORAOUTPUT
mkdir /usr/local
mkdir /usr/local/bin
chmod 777 /usr/local/bin
chown bin /usr/local/bin
chgrp bin /usr/local/bin
fi
#
#cp /usr/bin/ssh-keygen /usr/local/bin/ssh-keygen
#cp /usr/bin/ssh /usr/local/bin/ssh
#
# Create /u01/oracle directory to handle Oracle product
if [ ! -d $ORACLE_ROOT ] ; then
mkdir -p $ORACLE_ROOT
chown -R $ORACLE_INSTALL_USER":"$ORACLE_INSTALL_GROUP $ORACLE_ROOT
fi
# Create /u01/oraInventory directory to handle Oracle referentiel
if [ ! -d $ORACLE_INVENTORY ] ; then
mkdir -p $ORACLE_INVENTORY
chown -R $ORACLE_INSTALL_USER":"$ORACLE_INSTALL_GROUP $ORACLE_INVENTORY
fi
# Create /u01/oracle/oradata directory for DB installation
if [ ! -d $ORACLE_DATA ] ; then
mkdir -p $ORACLE_DATA
chown -R $ORACLE_INSTALL_USER":"$ORACLE_INSTALL_GROUP $ORACLE_DATA
fi
#
# Update kernel parameters in /etc/sysctl.conf
echo "# Oracle Kernel Specific parameters" >> /etc/sysctl.conf
echo "Saving /etc/sysctl.conf into /etc/sysctls.conf.back" >> $ORAOUTPUT
cp /etc/sysctl.conf /etc/sysctl.conf.back
# On SUSE Linux Enterprise Server systems only, you must enter the GID of the oinstall group as the value for the parameter /proc/sys/vm/hugetlb_shm_ group. Doing this grants members of oinstall a group permission to create shared memory segments.
#
echo $ORACLE_INSTALL_GID > /proc/sys/vm/hugetlb_shm_group
#
echo 'BEGIN {' >/tmp/sysctl.txt
echo 'vkernelsem=0 ' >>/tmp/sysctl.txt
echo 'vkernelshmall=0 ' >>/tmp/sysctl.txt
echo 'vkernelsem=0 ' >>/tmp/sysctl.txt
echo 'vkernelshmall=0 ' >>/tmp/sysctl.txt
echo 'vkernelshmmax=0 ' >>/tmp/sysctl.txt
echo 'vkernelshmmni=0 ' >>/tmp/sysctl.txt
echo 'vfsfilemax=0 ' >>/tmp/sysctl.txt
echo 'vfsaiomaxnr=0 ' >>/tmp/sysctl.txt
echo 'vnetipv4iplocalportrange=0 ' >>/tmp/sysctl.txt
echo 'vnetcorermemdefault=0 ' >>/tmp/sysctl.txt
echo 'vnetcorermemmax=0 ' >>/tmp/sysctl.txt
echo 'vnetcorewmemdefault=0 ' >>/tmp/sysctl.txt
echo 'vnetcorewmemmax=0 ' >>/tmp/sysctl.txt
echo 'vkernelspinretry=0 ' >>/tmp/sysctl.txt
echo 'vmhugetlbshmgroup=0 ' >>/tmp/sysctl.txt
echo '} ' >>/tmp/sysctl.txt
#
echo '{' >> /tmp/sysctl.txt
echo 'vline=$0' >> /tmp/sysctl.txt
echo 'vOra_kernel=$1 " " $2' >> /tmp/sysctl.txt
echo 'if ( $1 ~ /^kernel.sem/ ) {' >> /tmp/sysctl.txt
echo 'if ( $3 > 250 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 250 }' >> /tmp/sysctl.txt
echo ' if ( $4 > 32000 ) { vOra_kernel = vOra_kernel " " $4 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 32000 }' >> /tmp/sysctl.txt
echo ' if ( $5 > 100 ) { vOra_kernel = vOra_kernel " " $5 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 100 }' >> /tmp/sysctl.txt
echo ' if ( $6 > 128 ) { vOra_kernel = vOra_kernel " " $6 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 128 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vkernelsem=1 ' >> /tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^kernel.shmall/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 2097152 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 2097152 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vkernelshmall=1 ' >> /tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^kernel.shmmax/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 4218210304 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 4218210304 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vkernelshmmax=1 ' >> /tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^kernel.shmmni/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 4096 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 4096 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vkernelshmmni=1 ' >>/tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^fs.file-max/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 6815744 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 6815744 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vfsfilemax=1 ' >>/tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^fs.aio-max-nr/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 1048576 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 1048576 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vfsaiomaxnr=1 ' >>/tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^net.ipv4.ip_local_port_range/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 9000 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 9000 }' >> /tmp/sysctl.txt
echo ' if ( $4 > 65500 ) { vOra_kernel = vOra_kernel " " $4 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 65500 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vnetipv4iplocalportrange=1 ' >>/tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^net.core.rmem_default/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 262144 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 262144 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vnetcorermemdefault=1 ' >>/tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^net.core.rmem_max/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 4194304 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 4194304 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vnetcorermemmax=1 ' >>/tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^net.core.wmem_default/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 262144 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 262144 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vnetcorewmemdefault=1 ' >>/tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^net.core.wmem_max/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 1048576 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 1048576 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vnetcorewmemmax=1 ' >>/tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^kernel.spin_retry/ ) {' >> /tmp/sysctl.txt
echo ' if ( $3 > 2000 ) { vOra_kernel = vOra_kernel " " $3 }' >> /tmp/sysctl.txt
echo ' else { vOra_kernel = vOra_kernel " " 2000 }' >> /tmp/sysctl.txt
echo ' vline=vOra_kernel' >> /tmp/sysctl.txt
echo ' vkernelspinretry=1 ' >>/tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
#
echo 'if ( $1 ~ /^vm.hugetlb_shm_group/ ) {' >> /tmp/sysctl.txt
echo ' vline = "vm.hugetlb_shm_group = "' $ORACLE_INSTALL_GID >> /tmp/sysctl.txt
echo ' vmhugetlbshmgroup=1 ' >>/tmp/sysctl.txt
echo ' }' >> /tmp/sysctl.txt
 
echo 'print vline' >> /tmp/sysctl.txt
echo '}' >> /tmp/sysctl.txt
echo 'END { ' >> /tmp/sysctl.txt
echo ' print "# Oracle parameters"; ' >> /tmp/sysctl.txt
echo ' if ( vkernelsem=0 ) { print "kernel.sem = 250 32000 100 128" } ' >> /tmp/sysctl.txt
echo ' if ( vkernelshmall=0 ) { print "kernel.shmall = 2097152" } ' >> /tmp/sysctl.txt
echo ' if ( vkernelshmmax=0 ) { print "kernel.shmmax = 4218210304" } ' >> /tmp/sysctl.txt
echo ' if ( vkernelshmmni=0 ) { print "kernel.shmmni = 4096" } ' >> /tmp/sysctl.txt
echo ' if ( vfsfilemax=0 ) { print "fs.file-max = 6815744" } ' >> /tmp/sysctl.txt
echo ' if ( vfsaiomaxnr=0 ) { print "fs.aio-max-nr = 1048576" } ' >> /tmp/sysctl.txt
echo ' if ( vnetipv4iplocalportrange=0 ) { print "net.ipv4.ip_local_port_range = 9000 65500" } ' >> /tmp/sysctl.txt
echo ' if ( vnetcorermemdefault=0 ) { print "net.core.rmem_default = 262144" } ' >> /tmp/sysctl.txt
echo ' if ( vnetcorermemmax=0 ) { print "net.core.rmem_max = 4194304" } ' >> /tmp/sysctl.txt
echo ' if ( vnetcorewmemdefault=0 ) { print "net.core.wmem_default = 262144" } ' >> /tmp/sysctl.txt
echo ' if ( vnetcorewmemmax=0 ) { print "net.core.wmem_max = 1048576" } ' >> /tmp/sysctl.txt
echo ' if ( vkernelspinretry=0 ) { print "kernel.spin_retry = 2000" } ' >> /tmp/sysctl.txt
echo ' if ( vmhugetlbshmgroup=0 ) { print "vm.hugetlb_shm_group = "' $ORACLE_INSTALL_GID } >> /tmp/sysctl.txt
echo 'print "# End of Oracle parameters"; ' >> /tmp/sysctl.txt
echo '} ' >> /tmp/sysctl.txt
#
awk -f /tmp/sysctl.txt /etc/sysctl.conf > /tmp/sysctl.tmp
#
cp /tmp/sysctl.tmp /etc/sysctl.conf
# The following command changes the current values of the kernel parameters
/sbin/sysctl -p 1>/dev/null 2>&1
# Enter the command /sbin/sysctl -a to confirm that the values are set correctly
echo "........................................................" >> $ORAOUTPUT
/sbin/sysctl -a 1>/dev/null 2>&1
echo "........................................................" >> $ORAOUTPUT
# On SUSE Linux Enterprise Server systems only, enter the following command to cause the system to read the /etc/sysctl.conf file when it restarts:
/sbin/chkconfig boot.sysctl on 1>/dev/null 2>&1
#
#/etc/limits.conf
#limite=`cat /etc/security/limits.conf | grep oracle | wc -l `
limite=`cat /etc/security/limits.conf | grep $ORACLE_INSTALL_USER | wc -l `
echo "cat /etc/security/limits.conf | grep "$ORACLE_INSTALL_USER" | wc -l =>"$limite"<=" >> $ORAOUTPUT
echo "........................................................" >> $ORAOUTPUT
if [ $limite -eq 0 ] ; then
echo "# oracle " >>/etc/security/limits.conf
echo $ORACLE_INSTALL_USER" soft nofile 1024" >>/etc/security/limits.conf
echo $ORACLE_INSTALL_USER" hard nofile 65536" >>/etc/security/limits.conf
echo $ORACLE_INSTALL_USER" soft nproc 2047" >>/etc/security/limits.conf
echo $ORACLE_INSTALL_USER" hard nproc 16384" >>/etc/security/limits.conf
echo $ORACLE_INSTALL_USER" soft stack 10240" >>/etc/security/limits.conf
echo $ORACLE_INSTALL_USER" hard stack 32768" >>/etc/security/limits.conf
echo "# Use memlock for Huge Pages support" >>/etc/security/limits.conf
echo "#* soft memlock 3145728" >>/etc/security/limits.conf
echo "#* hard memlock 3145728" >>/etc/security/limits.conf
echo "# End oracle " >> /etc/security/limits.conf
fi
#
#/etc/pam.d/sshd
limite=`cat /etc/pam.d/sshd | grep pam_limits.so | wc -l`
echo "cat /etc/pam.d/sshd | grep pam_limits.so | wc -l =>"$limite"<=" >> $ORAOUTPUT
echo "........................................................" >> $ORAOUTPUT
if [ $limite -eq 0 ] ; then
echo "Saving /etc/pam.d/sshd into /etc/pam.d/sshd.back" >> $ORAOUTPUT
cp /etc/pam.d/sshd /etc/pam.d/sshd.back
echo "# Oracle " >> /etc/security/limits.conf
echo "session required pam_limits.so" >>/etc/pam.d/sshd
echo "# End oracle " >> /etc/security/limits.conf
fi
# rpms for Oracle
orarpm=`rpm -qa | grep ora-val | wc -l`
echo "rpm -qa | grep ora-val | wc -l =>"$limite"<=" >> $ORAOUTPUT
echo "........................................................" >> $ORAOUTPUT
if [ $orarpm -eq 0 ] ; then
echo "Installing Oracle rpm" >> $ORAOUTPUT
echo "rpm -ivh "$ORACLE_INSTALL"/ora-val-rpm-S11-DB-11.2.0.2-1.s390x.rpm" >> $ORAOUTPUT
rpm -ivh $ORACLE_INSTALL/ora-val-rpm-S11-DB-11.2.0.2-1.s390x.rpm
fi
orarpm=`rpm -qa | grep cvuqdisk | wc -l`
echo "rpm -qa | grep cvuqdisk | wc -l =>"$limite"<=" >> $ORAOUTPUT
echo "........................................................" >> $ORAOUTPUT
if [ $orarpm -eq 0 ] ; then
echo "Installing Oracle cvuqdisk rpm" >> $ORAOUTPUT
echo "rpm -iv "$ORACLE_INSTALL"/cvuqdisk-1.0.9-1.rpm" >> $ORAOUTPUT
rpm -iv $ORACLE_INSTALL/cvuqdisk-1.0.9-1.rpm
fi
#
##################################################################
# Prepare a vncserver to avoid being prompted when starting vncserver before Oracle Install
# Needed to run host+
##################################################################
if [ ! -d /root/.vnc ] ; then
mkdir -p /root/.vnc >> $ORAOUTPUT
cd /root/.vnc
# build a passwd file with password="password"
echo "begin 600 passwd" > passwd2
echo "(V]@\_7)Z%%@`" >> passwd2
echo "`" >> passwd2
echo "end" >> passwd2
# generate passwd withh uudecode, passwd2 being the result of
# uuencode passwd passwd > passwd2
uudecode passwd2
# build a xstartup file
echo "#!/bin/sh" > xstartup
echo "" >> xstartup
echo "xrdb $HOME/.Xresources" >> xstartup
echo "xsetroot -solid grey" >> xstartup
echo "xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &" >> xstartup
echo "twm &" >> xstartup
fi
chown -R root:root /root/.vnc
vncserver
xhost +
cvnc=`ps -ef | grep vnc`
#
##################################################################
# run the Installer
##################################################################
# Launch runInstaller
# runInstaller can run with -showProgress parameter to show installation progress, useless in automated case
echo "Executing runInstaller."
export ORACLE_INSTALL_MNT
export ORACLE_INSTALL_USER
export ORACLE_USER_HOME
export ORACLE_SI_SCRIPT
echo "su -c "cd /home/$ORACLE_INSTALL_USER;. ./.profile;cd $ORACLE_INSTALL_MNT/database; ./runInstaller -silent -ignorePrereq -force -responseFile $ORACLE_USER_HOME/$ORACLE_SI_SCRIPT" $ORACLE_INSTALL_USER" >> $ORAOUTPUT
su -c "cd /home/$ORACLE_INSTALL_USER;. ./.profile;cd $ORACLE_INSTALL_MNT/database; ./runInstaller -silent -ignorePrereq -force -responseFile $ORACLE_USER_HOME/$ORACLE_SI_SCRIPT" $ORACLE_INSTALL_USER
echo "End runInstaller."
#
##################################################################
# VERIFICATIONS
##################################################################
echo "################################################################################" >> $ORAOUTPUT
echo "Environment variables set:" >> $ORAOUTPUT
echo "Oracle UserId = " $ORACLE_INSTALL_UID >> $ORAOUTPUT
echo "Oracle Name = " $ORACLE_INSTALL_USER >> $ORAOUTPUT
echo "Oracle Group Name = " $ORACLE_INSTALL_GROUP >> $ORAOUTPUT
echo "Oracle GroupId = " $ORACLE_INSTALL_GID >> $ORAOUTPUT
echo "DBA GroupId = " $ORACLE_DBA_GID >> $ORAOUTPUT
echo "OPERATOR GroupId= " $ORACLE_OPER_GID >> $ORAOUTPUT
echo "Oracle Linux Home Directory = " $ORACLE_USER_HOME >> $ORAOUTPUT
echo "Oracle Installation Base Directory = " $ORACLE_ROOT >> $ORAOUTPUT
echo "Oracle Inventory Referential Directory = " $ORACLE_INVENTORY >> $ORAOUTPUT
##################################################################
echo "################################################################################" >> $ORAOUTPUT
echo "Verif directories creation" >> $ORAOUTPUT
ls -al /u01 >> $ORAOUTPUT
echo "################################################################################" >> $ORAOUTPUT
echo "Verif user and groups creation" >> $ORAOUTPUT
cat /etc/group | grep oinstall >> $ORAOUTPUT
cat /etc/group | grep dba >> $ORAOUTPUT
cat /etc/group | grep oper >> $ORAOUTPUT
cat /etc/passwd | grep $ORACLE_INSTALL_USER >> $ORAOUTPUT
echo "################################################################################" >> $ORAOUTPUT
echo "Verif oracle home creation" >> $ORAOUTPUT
ls -al /home/$ORACLE_INSTALL_USER >> $ORAOUTPUT
cat /home/$ORACLE_INSTALL_USER/.profile >> $ORAOUTPUT
echo "################################################################################" >> $ORAOUTPUT
echo "Verif /user/local/bin chmod" >> $ORAOUTPUT
ls -l /usr/local >> $ORAOUTPUT
echo "################################################################################" >> $ORAOUTPUT
echo "Verif /etc/sysctl.conf" >> $ORAOUTPUT
#cat /etc/sysctl.conf >> $ORAOUTPUT
echo "################################################################################" >> $ORAOUTPUT
echo "Verif /etc/security/limits.conf" >> $ORAOUTPUT
cat /etc/security/limits.conf | grep $ORACLE_INSTALL_USER >> $ORAOUTPUT
echo "################################################################################" >> $ORAOUTPUT
echo "Verif /etc/pam.d/sshd" >> $ORAOUTPUT
cat /etc/pam.d/sshd | grep pam_limits.so >> $ORAOUTPUT
echo "################################################################################" >> $ORAOUTPUT
echo "Oracle Environment Customization End" >> $ORAOUTPUT
fi
#return 0
# End preporacle.sh
 
Sample Tivoli Provisioning Manager workflow
A sample Tivoli Provisioning Manager workflow is shown in the following example:
# -----------------------------------------------------------------
# Licensed Materials - Property of IBM
# 5724-F75
# (C) Copyright IBM Corp. 2003 - 2009
# All Rights Reserved
# US Government Users Restricted Rights -Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
# -----------------------------------------------------------------
@param DeviceID - DCM object ID of the target server
@doc Dependent Workflows:
 
workflow Oracle11203_Install(in DeviceID) LocaleInsensitive
var Source_DeviceID = 5678
var Source_ToolsDir = "/opt/ibm/oracle"
var Dest_DeviceID = DeviceID
var Dest_ToolsDir = "/tmp"
var Script_Name = "./preporacle.sh"
#Search key for client credentials to be used, if it is empty then default Credential key will be used
var ClientCredentialsKey = "default"
var HostCredentialsKey = "default"
var TimeoutInSeconds = 300
#Copies the script file to the server
log info Jython["ACH Start copying Script"]
Device.CopyFile(Source_DeviceID, Source_ToolsDir, Script_Name, Dest_DeviceID, Dest_ToolsDir, Script_Name, ClientCredentialsKey, HostCredentialsKey, TimeoutInSeconds )
log info Jython["ACH End copying Script"]
log info Jython["ACH Start executing script"]
#Device.Execute Command
#@param DeviceId DCM id of the device
#@param ExecuteCommand The command to be executed including arguments
#@param WorkingDirectory The path of the working directory
#@param CredentialsKey Key for identifying credentials for accessing the service
#@param TimeoutInSeconds Number of seconds elapsed to stop waiting for operation completion
#@param TreatTimeoutAs Action when the command timeouts. Possible values: ignore, warning, error.
#@param ReturnCode Contains the return exit code in case of success, null in case of failure
#@param ReturnErrorString Content of error stream (stderr) in case of success, null in case of failure
#@param ReturnResult Return result (content of stdout) in case of success, null in case of failure
Device.ExecuteCommand(DeviceID, Script_Name, Dest_ToolsDir, ClientCredentialsKey, TimeoutInSeconds, "error", <null>, <null>, <null>)
log info Jython["ACH end executing script"]
 
References books
The following Redbooks publications are available:
z/VM and Linux on IBM System z: The Virtualization Cookbook for SLES 11 SP1, SG24-7931-00
Directory Maintenance Facility Tailoring and Administration Guide; Version 6 Release 1, SC24-6190-00
Deploying a Cloud on IBM System z, REDP-4711
Provisioning Linux on IBM System z with Tivoli Service Automation Manager, REDP-4663
Installing Oracle 11gR2 RAC on Linux on System z, REDP-4788
Experiences with a Silent Install of Oracle Database 11gR2 RAC on Linux on System z (11.2.0.3), REDP-9131
Tivoli Service Automation Manager Version 7.2.2 - Installation and Administration Guide, SC34-2657-00
For more information about IBM publications, see the Redbooks website at:
For more information about Tivoli, see the “Configuring the z/VM environment for Tivoli Service Automation Manager” topic in the Tivoli Information Center at this website:
 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset