oracle 9I for linux kernel2.4 安装脚本(未完)
时间:2007-03-27 来源:bleach
#!/bin/bash
KERNEL=`uname -r |awk -F. '{print $1"."$2}'`
case $KERNEL in
2.4)
if [ -z "$( rpm -qa | grep compat-libstdc++ )" ] ; then
{
echo "`basename $0`:Not found RPM Package : compat-libstdc++"
exit 1
}
fi
if [ -z "$( rpm -qa | grep compat-gcc )" ] ; then
{
echo "`basename $0`:Not found RPM Package : compat-gcc"
exit 1
}
fi
if [ -z "$( rpm -qa | grep compat-db )" ] ; then
{
echo "`basename $0`:Not found RPM Package : compat-db"
exit 1
}
fi
if [ -z "$( rpm -qa | grep openmotif )" ] ; then
{
echo "`basename $0`:Not found RPM Package : openmotif"
exit 1
}
fi
if [ -z "$( rpm -qa | grep setarch )" ] ; then
{
echo "`basename $0`:Not found RPM Package : setarch"
exit 1
}
fi
if [ -z "$( rpm -qa | grep tcl )" ] ; then
{
echo "`basename $0`:Not found RPM Package : tcl"
exit 1
}
fi
if [ "$( grep -w MemTotal /proc/meminfo|awk '{print $2}' )" -lt 230000 ] ;then
{
echo "`basename $0`:The Memory deficiency,Update to the 512M or more"
exit 1
}
fi
##add oracle user and group###
if [ -z "$( awk -F: '{print $1}' /etc/group | grep -w dba )" ] ; then
groupadd dba
fi
if [ -z "$( awk -F: '{print $1}' /etc/group | grep -w oinstall )" ] ; then
groupadd oinstall
fi
if [ -z "$( awk -F: '{print $1}' /etc/passwd | grep -w oracle )" ] ; then
useradd -g oinstall -G dba oracle
echo orapasswd | passwd oracle --stdin >/dev/null 2>&1
else
usermod -g oinstall -G dba oracle
echo orapasswd | passwd oracle --stdin >/dev/null 2>&1
fi
##setting oracle'install env###
SHMMAX=`expr $( grep MemTotal /proc/meminfo |awk '{print $2}' ) '*' 1024`
if [ -z "$( grep -w "kernel.shmmax" /etc/sysctl.conf )" ] ; then
echo -e "kernel.shmmax=$SHMMAX\nkernel.shmmni=4096\nkernel.shmall=2097152\nkernel.sem=250 32000 100 128\nfs.file-max=65536\nnet.ipv4.ip_local_port_range=1024 65000" >>/etc/sysctl.conf
if [ $? -eq 0 ] ; then echo "set /etc/sysctl.conf OK" ; fi
fi
if [ -z "$( grep -w "oracle hard nofile 65536" /etc/security/limits.conf )" ] ; then
echo -e "oracle hard nofile 65536\noracle soft nofile 65536\noracle hard nproc 16384\noracle soft nproc 16384" >>/etc/security/limits.conf
if [ $? -eq 0 ] ; then echo "set /etc/security/limits.conf OK" ; fi
fi
if [ -z "$( grep -w "export LD_ASSUME_KERNEL=2.4.1" /home/oracle/.bash_profile )" ] ; then
echo -e "export LD_ASSUME_KERNEL=2.4.1\nexport ORACLE_BASE=/home/oracle\nexport ORACLE_HOME=\$ORACLE_BASE/product/9.2.0\nexport ORACLE_SID=oracle\nexport ORACLE_TERM=xter\nexport NLS_LANG=AMERICAN;\nexport ORA_NLS33=\$ORACLE_HOME/ocommon/nls/admin/data\nLD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib\nLD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib\nexport LD_LIBRARY_PATH\nexport PATH=\$PATH:\$ORACLE_HOME/bin" >>/home/oracle/.bash_profile
if [ $? -eq 0 ] ; then echo "set /home/oracle/.bash_profile OK" ; fi
fi
if [ $( gcc --version ) != "2.96" ] ; then
{
mv /usr/bin/gcc /usr/bin/gcc323
ln -s /usr/bin/gcc296 /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++323
ln -s /usr/bin/g++296 /usr/bin/g++
if [ $( gcc --version ) != "2.96" ] ; then
echo "GCC and G++ 降级失败 原版本已恢复"
rm -rf /usr/bin/gcc
mv /usr/bin/gcc323 /usr/bin/gcc
rm -rf /usr/bin/g++
mv /usr/bin/g++323 /usr/bin/g++
exit 1
fi
}
fi
##upload install files##
if [ -d "/home/oracle/dbinstall/" ]; then
{
chown -R oracle:oinstall /home/oracle/dbinstall/
echo "Please upload install files to /home/oracle/dbinstall/"
}
else
{
mkdir /home/oracle/dbinstall/
chown -R oracle:oinstall /home/oracle/dbinstall/
echo "Please upload install files to /home/oracle/dbinstall/"
}
fi
while :
do
echo -e "install files list:\n\tship_9204_linux_disk1.cpio or ship_9204_linux_disk1.cpio.gz\n\tship_9204_linux_disk2.cpio or ship_9204_linux_disk2.cpio.gz\n\tship_9204_linux_disk3.cpio or ship_9204_linux_disk3.cpio.gz\n"
echo -e "path files list:\n\tttf-zh-song-1.4-13.noarch.rpm\n\tp3238244_9204_LINUX.zip\n\tp3006854_9204_LINUX.zip\n\tp2617419_210_GENERIC.zip\n"
echo "upload finish please enter the key Y"
echo -n "Enter the Y :"
read LINE
case $LINE in
Y)
echo "checking upload files"
if [ ! -f /home/oracle/dbinstall/ship_9204_linux_disk1.cpio -a ! -f /home/oracle/dbinstall/ship_9204_linux_disk1.cpio.gz ] ; then
NOFILES="\tship_9204_linux_disk1.cpio or ship_9204_linux_disk1.cpio.gz"
fi
if [ ! -f /home/oracle/dbinstall/ship_9204_linux_disk2.cpio -a ! -f /home/oracle/dbinstall/ship_9204_linux_disk2.cpio.gz ] ; then
NOFILES="$NOFILES\n\tship_9204_linux_disk2.cpio or ship_9204_linux_disk2.cpio.gz "
fi
if [ ! -f /home/oracle/dbinstall/ship_9204_linux_disk3.cpio -a ! -f /home/oracle/dbinstall/ship_9204_linux_disk3.cpio.gz ] ; then
NOFILES="$NOFILES\n\tship_9204_linux_disk3.cpio or ship_9204_linux_disk3.cpio.gz"
fi
if [ ! -f /home/oracle/dbinstall/ttf-zh-song-1.4-13.noarch.rpm ] ; then
NOFILES="$NOFILES\n\tttf-zh-song-1.4-13.noarch.rpm"
fi
if [ ! -f /home/oracle/dbinstall/p3238244_9204_LINUX.zip ] ; then
NOFILES="$NOFILES\n\tp3238244_9204_LINUX.zip"
fi
if [ ! -f /home/oracle/dbinstall/p3006854_9204_LINUX.zip ] ; then
NOFILES="$NOFILES\n\tp3006854_9204_LINUX.zip"
fi
if [ ! -f /home/oracle/dbinstall/p2617419_210_GENERIC.zip ] ; then
NOFILES="$NOFILES\n\tp2617419_210_GENERIC.zip"
fi
if [ -z "$NOFILES" ] ; then
{
echo "check files OK"
break
}
else
{
echo "Please upload install files "
echo "Not found files list :"
echo -e "$NOFILES\n"
continue
}
fi
;;
*)
continue
;;
esac
done
## release the install files ##3006854 3238244 dbinstall Disk1 Disk2 Disk3 OPatch README.txt
if [ -d /home/oracle/Disk1/ -a -d /home/oracle/Disk2/ -a -d /home/oracle/Disk3 -a -d /home/oracle/3006854/ -a -d /home/oracle/3238244/ -a -d /home/oracle/OPatch/ ] ; then echo "Package files release OK"
else
{
if [ -f /home/oracle/dbinstall/ship_9204_linux_disk1.cpio ] ; then
chown -R oracle:oinstall /home/oracle/dbinstall/
su - oracle -c "cpio -idmv < /home/oracle/dbinstall/ship_9204_linux_disk1.cpio >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "disk1 release OK" ; fi
su - oracle -c "cpio -idmv < /home/oracle/dbinstall/ship_9204_linux_disk2.cpio >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "disk2 release OK" ; fi
su - oracle -c "cpio -idmv < /home/oracle/dbinstall/ship_9204_linux_disk3.cpio >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "disk3 release OK" ; fi
su - oracle -c "unzip /home/oracle/dbinstall/p3006854_9204_LINUX.zip >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "p3006854 release OK" ; fi
su - oracle -c "unzip /home/oracle/dbinstall/p2617419_210_GENERIC.zip >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "p2617419 release OK" ; fi
su - oracle -c "unzip /home/oracle/dbinstall/p3238244_9204_LINUX.zip >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "p3238244 release OK" ; fi
else
chown -R oracle:oinstall /home/oracle/dbinstall/
su - oracle -c "gunzip /home/oracle/dbinstall/ship_9204_linux_disk1.cpio.gz >/dev/null 2>&1"
su - oracle -c "gunzip /home/oracle/dbinstall/ship_9204_linux_disk2.cpio.gz >/dev/null 2>&1"
su - oracle -c "gunzip /home/oracle/dbinstall/ship_9204_linux_disk3.cpio.gz >/dev/null 2>&1"
su - oracle -c "cpio -idmv < /home/oracle/dbinstall/ship_9204_linux_disk1.cpio >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "disk1 release OK" ; fi
su - oracle -c "cpio -idmv < /home/oracle/dbinstall/ship_9204_linux_disk2.cpio >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "disk2 release OK" ; fi
su - oracle -c "cpio -idmv < /home/oracle/dbinstall/ship_9204_linux_disk3.cpio >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "disk3 release OK" ; fi
su - oracle -c "unzip /home/oracle/dbinstall/p3006854_9204_LINUX.zip >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "p3006854 release OK" ; fi
su - oracle -c "unzip /home/oracle/dbinstall/p2617419_210_GENERIC.zip >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "p2617419 release OK" ; fi
su - oracle -c "unzip /home/oracle/dbinstall/p3238244_9204_LINUX.zip >/dev/null 2>&1"
if [ $? -eq 0 ]; then echo "p3238244 release OK" ; fi
fi
}
fi
if [ -z "$( rpm -qa | grep -w ttf-zh-song )" ] ;then
{
rpm -ivh /home/oracle/dbinstall/ttf-zh-song-1.4-13.noarch.rpm >/dev/null 2>&1
if [ $? -eq 0 ]; then echo "ttf-zh-song install OK" ; fi
}
fi
## install patch 3006854 ##
if [ -f /etc/ld.so.preload ] ;then echo "patch p3006854 is already installed"
else if [ -f /home/oracle/3006854/rhel3_pre_install.sh ];then
{
chmod +x /home/oracle/3006854/rhel3_pre_install.sh
/home/oracle/3006854/rhel3_pre_install.sh >/dev/null 2>&1
if [ $? -eq 0 ]; then echo "p3006854 install OK" ; fi
}
fi
fi
## create new script ##
if [ ! -f /home/install.sh ];then
echo -e "#!/bin/bash\n
if [ $( whoami ) = "oracle" -a $ORACLE_HOME = "/home/oracle/product/9.2.0" -a -d /home/oracle/Disk1/ -a -d /home/oracle/Disk2/ -a -d /home/oracle/Disk3/ -a -d /home/oracle/3006854/ -a -d /home/oracle/3238244/ -a -d /home/oracle/OPatch/ -a -f /etc/ld.so.preload -a $( gcc --version ) = "2.96" ]; then
{
echo "Package files release OK"
if [ -z $( netstat -an|grep "0.0.0.0:8080"|grep -v "grep" ) -a -z $( netstat -an|grep "0.0.0.0:1521" | grep -v "grep" ) ] ; then
xprop -root -remove _MOTIF_DEFAULT_BINDINGS
xprop -remove WM_LOCALE_NAME
xprop -root -remove XIM_SERVERS
export LANG=zh_CN
/home/oracle/Disk1/runInstaller
else
echo "oracle is already installed "
fi
}
fi" > /home/install.sh
fi
chown oracle:oinstall /home/install.sh
;;
2.2|2.6)
echo "no 2.4 kernel"
;;
esac