# Scripts are only used for communication and learning! # The current script version is 1. 0. implements the detection of physical memory swap space. The RPM package is automatically installed (you need to configure Yum or attach the disc. If you have copied all the required RPM packages to a directory
# Scripts are only used for communication and learning! # The current script version is 1. 0. implements the detection of physical memory swap space. The RPM package is automatically installed (you need to configure Yum or attach the disc. If you have copied all the required RPM packages to a directory
# Scripts are only used for communication and learning!
# The current script version is 1. 0. implements the detection of physical memory and swap space. The RPM package is automatically installed (you need to configure Yum or attach the disc. If you have copied all the required RPM packages to a directory, OK .), user and User Group Creation, software environment variable configuration, system kernel parameter configuration, and other functions. after the script is successfully executed, decompress the Oracle Installation Package and enable the graphical installation of runInstaller.
# The script has passed the test on Red Hat Enterprise Linux 5.4 64bit (Oracle 10g/Oracle11g). In principle, it is applicable to RHEL 5 and RHEL 6.
# Suggestions for improvement are welcome.
# Scripts can be downloaded through attachments
#! /Bin/bash # Version 1.0 # AUTHOR: Xin23 #1. Oracle Version and SystemGetOracleVersion () {read-p "Which Version of Oracle You Will Install? [11 | 10]? "VERSION} GetOracleVersionSetVersion () {if [$ VERSION-eq 11] then echo 'oracle Version is 11! 'Elif [$ VERSION-eq 10] then echo 'Oracle Version is 10! 'Elasticecho 'Please Retype The Version of Oracle You Will Install! 'Getoracleversionsetversionfi} SetVersionMEMORY =$ (cat/proc/meminfo | grep MemTotal | awk '{print $2 }') SWAP = $ (cat/proc/meminfo | grep SwapTotal | awk '{print $2 }') MEMORY_REQ = 1048576if [$ MEMORY-lt $ MEMORY_REQ] then echo 'physical Memory is too small! 'Exit 1 elseecho 'Physical Memory Check OK! 'Fiif [$ VERSION-eq 10] thenif [$ MEMORY-lt 2097152] then if [$ SWAP-lt $ (echo "$ MEMORY * 3/2" | bc)] then echo 'SWAp is too small! 'Exit 2 elseecho 'Swap Check OK! 'Fielif [$ MEMORY-gt 2097152] | [$ MEMORY-lt 8388608] then if [$ SWAP-lt $ MEMORY] then echo 'SWAp is too small! 'Exit 2 elseecho 'Swap Check OK! 'Fielif [$ MEMORY-gt 8388608] then if [$ SWAP-lt $ (echo "$ MEMORY * 3/4" | bc)] then echo 'SWAp is too small! 'Exit 2 elseecho 'Swap Check OK! 'Cancielif [$ VERSION-eq 11] thenif [$ MEMORY-lt 2097152] then if [$ SWAP-lt $ (echo "$ MEMORY * 3/2" | bc)] then echo 'SWAp is too small! 'Exit 2 elseecho 'Swap Check OK! 'Fielif [$ MEMORY-gt 2097152] | [$ MEMORY-lt 16777216] then if [$ SWAP-lt $ MEMORY] then echo 'SWAp is too small! 'Exit 2 elseecho 'Swap Check OK! 'Fielif [$ MEMORY-gt 16777216] then if [$ SWAP-lt 16777216] then echo 'SWAp is too small! 'Exit 2 elseecho 'Swap Check OK! 'Deleifiecho 'Oracle Version and System hardware has been checked! '#2. softwareRpm () {rpm-ivh compat-libstdc ++ * rpm-ivh elfutils-libelf * compression-ivh elfutils-libelf- devel-static * cancelfutils-libelf-devel * kernel-ivh elfutils-libelf-devel-static * i386.rpm elfutils-libelf-devel * kernel-ivh libaio-devel * rpm-ivh sysstat * rpm-ivh unixODBC -[[: digit:] * rpm-ivh unixODBC-devel * rpm-ivh k Ernel-headers * rpm-ivh glibc-devel * rpm-ivh libgomp * rpm-ivh libstdc ++-devel * x86_64.rpmrpm-ivh libstdc ++-devel * i386.rpmrpm-ivh gcc -[[: digit:] * rpm-ivh gcc-c ++ * rpm-ivh libXp-[[: digit:] *} Yum () {yum-y install compat-libstdc ++ yum-y install elfutils-libelf-devel-staticyum-y install elfutils-libelf-develyum-y install libaio-develyum-y install sysstatyum-y- y install unixOD BCyum-y install unixODBC-develyum-y install kernel-headersyum-y install glibc-develyum-y install libgompyum-y install gccyum-y install gcc-c + + yum-y install libstdc ++-develyum-y install libXp} GetYum () {read-p "Have you config the yum? [Y | n] "YUM} getyumpolicyum () {if [$ YUM = y] then Yumelif [$ YUM = n] then read-p" Please input rpm package's location: "MEDIA_DIRcd $ media_dirrpmelsegetyumpolicyumfi} RetroYumecho 'necessary RPM Package has been installed! '#3. user and Groupsgroupadd oinstallgroupadd dbauseradd-g oinstall-G dba oraclemkdir-p/u01/app/oracle; chown-R oracle: oinstall/u01read-p "Please input password for user oracle: "PASSWORDecho" $ PASSWORD "| passwd -- stdin oracleecho 'user and Group has been Created! '#4. Environmentread-p "Please input oracle sid:" SIDsu-c "echo 'export ORACLE_BASE =/u01/app/oracle'> ~ /. Bash_profile "oraclesu-c" echo 'export ORACLE_SID = $ SID '> ~ /. Bash_profile "oracleexport ORACLE_BASE =/u01/app/oracleif [$ VERSION = 11] then su-c 'echo" export ORACLE_HOME = $ ORACLE_BASE/product/11.2.0/dbhome_1 "> ~ /. Bash_profile 'oracleexport ORACLE_HOME = $ ORACLE_BASE/product/11.2.0/dbhome_1elif [$ VERSION = 10] then su-c 'echo "export ORACLE_HOME = $ ORACLE_BASE/product/10.2.0/db_1"> ~ /. Bash_profile 'oracleexport ORACLE_HOME = $ ORACLE_BASE/product/10.2.0/db_1elseexit 3 fisu-C' echo "export PATH = $ PATH: $ HOME/bin: $ ORACLE_HOME/bin" >> ~ /. Bash_profile 'oracleecho 'Software Enviroment has been finished! '#5. operate System and Kernel Parametersread-p "Please input your ip address:" IP_ADDRESSecho "$ IP_ADDRESS $ (hostname)" >>>/etc/hostsecho 'fs. aio-max-nr = 1048576 '>/etc/sysctl. confecho 'fs. file-max = 6815744 '>/etc/sysctl. confecho 'kernel. shmmni = 4096 '>/etc/sysctl. confecho 'kernel. sem = 250 32000 100 128 '>/etc/sysctl. confecho 'Net. core. rmem_default = 262144 '>/etc/sysctl. confecho' Net. core. rmem_max = 4194304 '>/etc/sysctl. confecho 'Net. core. wmem_default = 262144 '>/etc/sysctl. confecho 'Net. core. wmem_max = 1048586 '>/etc/sysctl. confif [$ VERSION = 11] then echo 'Net. ipv4.ip _ local_port_range = 9000 65500 '>/etc/sysctl. confelif [$ VERSION = 10] then echo 'Net. ipv4.ip _ local_port_range = 1024 65000 '>/etc/sysctl. conffisysctl-pecho 'oracle soft nproc 2047 '>/etc/secu Rity/limits. confecho 'oracle hard nproc 16384 '>/etc/security/limits. confecho 'oracle soft nofile 1024 '>/etc/security/limits. confecho 'oracle hard nofile 65536 '>/etc/security/limits. confecho 'oracle soft stack 10240 '>/etc/security/limits. confecho 'operate System and Kernel Parameter has been finished! 'Echo 'Now You Can Run runInstaller to start Installation of Oracle!'
THE END
This article is from the "Xin23 journal account" blog, Hong Kong Space, declined to repost!
, Hong Kong virtual host, Hong Kong server