Oracle-& gt; Shell script for a single oracle instance [20180122], oracle-20180122

Source: Internet
Author: User

Oracle> Shell script for a single oracle instance [20180122], oracle-20180122
The script is mainly used for redhat Platform Installation of 11g and 12c software dependent package check and installation of users, group check and installation of system kernel, user limit firewall, selinux close note, only dba is created in the linux Group script. Generally, oinstall and dba ##################### create: 2018/01/22 # version: v0.0 # describe: oracle 11g/12c setup single instance install environment # Reference URL http://blog.csdn.net/xcl168/article/details/19571443# http://blog.51cto.com/hxw168/1424626################# DATE = 'date + % Y % m % d % H % M % s' SYSCTLCONF = "/etc/sysctl. conf "LIMI TSCONF = "/etc/security/limits. conf "LOGINFILE ="/etc/pam. d/login "PROFILE ="/etc/profile "YUMFILE ="/etc/yum. repos. d/rhel-source.repo "echo-e" \ nTo determine the distribution and version of Linux installed. \ n "echo" 'cat/proc/version' "echo-e" \ nTo determine whether the required kernel is installed. \ n "echo" 'uname-a' "echo-e" \ nLeast 4 GB of RAM. \ n "echo" 'grep MemTotal/proc/meminfo' "echo-e" \ nTo de Termine the size of the configured swap space, enter the following command. \ n "echo" 'grep SwapTotal/proc/meminfo' "echo-e" \ nChecking the Software Requirements. \ n "yes | cp-p $ {YUMFILE }$ {YUMFILE }. bak. $ {DATE} read-p "Enter installl oracle version: [12c] "ORA_VERSION # echo" You have entered $ {ORA_VERSION} "if [-z" $ {ORA_VERSION} "]; thenORA_VERSION = "12c" fiecho "You have entered $ {ORA_VERSION}" if [$ {ORA_VERSION }== "12c"]; response = "binutilscompat-libstdc ++ * elfutils-extract-libelf-develgccgcc-c ++ glibcglibc-commonglibc-develglibc-headerskernel-response + + libstdc ++-kernel-devel "elserpmpack =" binutilscompat-libstdc ++ * elfutils-kernel-libelf-develelfutils-libelf-devel-staticgccgcc-c ++ glibcglibc-commonglibc-develglibc -Headerskernel-headerspdkshlibaiolibaio-devellibgcclibgomplibstdc ++ libstdc ++-develmakesysstatunixODBCunixODBC-devel "fi read-p" Enter yum source address: "URL_PTAH # echo" You have entered $ {URL_PTAH} "echo $ {# URL_PTAH} if [$ {# URL_PTAH}-gt 0]; thenecho "You have entered $ {URL_PTAH}" 'grep $ {URL_PTAH }$ {YUMFILE}>/dev/null' if [$? -Ne 0]; thenecho "# add yum resouce $ {DATE}" >$ {YUMFILE} echo "[rhel-source]" >$ {YUMFILE} echo "name = Red Hat Enterprise Linux \ $ releasever-\ $ basearch-Source ">$ {YUMFILE} echo" baseurl =$ {URL_PTAH} ">>$ {YUMFILE} echo" enabled = 1 ">$ {YUMFILE} echo "gpgcheck = 0" >$ {YUMFILE} echo "gpgkey = file: /// etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release ">$ {YUMFILE} fiyum grouplistfi for pack in $ rpmpack; do rpm-qa | Grep $ pack>/dev/null if [$? -Eq 1]; then echo "$ pack not install" yum-y install $ pack fi echo "rpm-qa | grep $ pack is already install. "# read-p" Enter yum source address: "URL_PTAH # echo" You have entered $ {URL_PTAH} "done echo-e" \ nTo determine if the Oracle Inventory group exit. \ n "echo" 'grep oinstall/etc/group' "echo" 'grep dba/etc/group' "echo-e" \ nTo determine whether the oraInstall. loc file exists. \ n "echo" 'cat/ Etc/oraInst. loc '"##################################### ############################ echo-e "\ nCreating Required Operating System Groups and users. \ n "'grep dba/etc/group>/dev/null' if [$? -Ne 0]; thenecho "groupadd dba" 'groupadd dba 'fi 'grep oracle/etc/passwd>/dev/null' if [$? -Ne 0]; thenecho "useradd-g dba oracle" 'useradd-g dba oracle 'echo "oracle #1234" | 'passwd -- stdin oracle 'fi echo "'id oracle'" if [! -D "/u01/app/oracle"]; thenecho-e "\ nmkdir-p/u01/app/oracle \ nmkdir-p/u01/app/oraInventory \ nmkdir-p/u01/app/oracle/product/11.2.0/dbhome_1 \ nchown-R oracle. dba/u01 \ nchmod-R 775/u01 \ n "mkdir-p/u01/app/oraclemkdir-p/u01/app/oraInventoryif [$ {ORA_VERSION} =" 12c" ]; thenmkdir-p/u01/app/oracle/product/12.2.0/dbhome_1elsemkdir-p/u01/app/oracle/product/11.2.0/dbhome_1fichown-R oracle. d Ba/u01chmod-R 775/u01fils-al/u01 ############################ # SYSCTLCONF = "/etc/sysctl. conf "# LIMITSCONF ="/etc/security/limits. conf "# LOGINFILE ="/etc/pam. d/login "# PROFILE ="/etc/profile "########################### # echo-e "\ nCheckResource Limits for the Oracle Software Installation Users. \ n "yes | cp-p $ {LIMITSCONF }$ {LIMITSCONF }. bak. $ {DATE} echo-e "\ nInstallation Owner Resource Limit Recommen Ded Ranges. \ n "'grep" # add limit "$ {LIMITSCONF}>/dev/null' if [$? -Ne 0]; thenecho "# add limit $ {DATE}" >$ {LIMITSCONF} fi 'grep "oracle soft nproc 2047" $ {LIMITSCONF}>/dev/null' if [$? -Ne 0]; thenecho "oracle soft nproc 2047" >$ {LIMITSCONF} fi 'grep "oracle hard nproc 16384" $ {LIMITSCONF}>/dev/null' if [$? -Ne 0]; thenecho "oracle hard nproc 16384" >$ {LIMITSCONF} fi 'grep "oracle soft nofile 1024" $ {LIMITSCONF}>/dev/null' if [$? -Ne 0]; thenecho "oracle soft nofile 1024" >$ {LIMITSCONF} fi 'grep "oracle hard nofile 65536" $ {LIMITSCONF}>/dev/null' if [$? -Ne 0]; thenecho "oracle hard nofile 65536" >$ {LIMITSCONF} fi echo "'Tail-n 5/etc/security/limits. conf '"##################################### ########### echo-e "\ nConfiguring Kernel Parameters for Linux. \ n "yes | cp-p $ {SYSCTLCONF }$ {SYSCTLCONF }. bak. $ {DATE} 'grep "# add sysctl" $ {SYSCTLCONF}>/dev/null' if [$? -Ne 0]; thenecho "# add sysctl $ {DATE}" >$ {SYSCTLCONF} fi 'grep "kernel. shmmni = 4096 "$ {SYSCTLCONF}>/dev/null' if [$? -Ne 0]; thenecho "kernel. shmmni = 4096 ">>$ {SYSCTLCONF} fi 'grep" kernel. sem = 250 32000 100 142 "$ {SYSCTLCONF}>/dev/null' if [$? -Ne 0]; thenecho "kernel. sem = 250 32000 100 142 ">$ {SYSCTLCONF} fi 'grep" fs. aio-max-nr = 1048576 "$ {SYSCTLCONF}>/dev/null' if [$? -Ne 0]; thenecho "fs. aio-max-nr = 1048576 ">$ {SYSCTLCONF} fi 'grep" fs. file-max = 6815744 "$ {SYSCTLCONF}>/dev/null' if [$? -Ne 0]; thenecho "fs. file-max = 6815744 ">>$ {SYSCTLCONF} fi 'grep" net. ipv4.ip _ local_port_range = 9000 65000 "$ {SYSCTLCONF}>/dev/null' if [$? -Ne 0]; thenecho "net. ipv4.ip _ local_port_range = 9000 65000 ">$ {SYSCTLCONF} fi 'grep" net. core. rmem_default = 262144 "$ {SYSCTLCONF}>/dev/null' if [$? -Ne 0]; thenecho "net. core. rmem_default = 262144 ">> {SYSCTLCONF} fi 'grep" net. core. rmem_max = 4194304 "$ {SYSCTLCONF}>/dev/null' if [$? -Ne 0]; thenecho "net. core. rmem_max = 4194304 ">> {SYSCTLCONF} fi 'grep" net. core. wmem_default = 262144 "$ {SYSCTLCONF}>/dev/null' if [$? -Ne 0]; thenecho "net. core. wmem_default = 262144 ">> {SYSCTLCONF} fi 'grep" net. core. wmem_max = 10485 "$ {SYSCTLCONF}>/dev/null' if [$? -Ne 0]; thenecho "net. core. wmem_max = 10485 ">> {SYSCTLCONF} fi/sbin/sysctl-p ####################### ######################## echo-e "\ nedit/etc/pam. d/login file: \ n "yes | cp-p $ {LOGINFILE }$ {LOGINFILE }. bak. $ {DATE} 'grep "session required pam_limits.so" $ {LOGINFILE}>/dev/nulll 'if [$? -Ne 0]; thenecho "# add login $ {DATE}" >$ {LOGINFILE} echo "session required pam_limits.so" >>$ {LOGINFILE} fiecho "'Tail-n 2 $ {LOGINFILE }' "####################################### ###### echo-e "\ nedit/etc/pfole file: \ n "yes | cp-p $ {PROFILE }$ {PROFILE }. bak. $ {DATE} 'grep "# add ulimit profile" $ {PROFILE}>/dev/null' if [$? -Ne 0]; thenecho "# add ulimit profile $ {DATE}" >$ {PROFILE} echo "if [\ $ USER = \" oracle \ "]; then ">$ {PROFILE} echo" if [\ $ SHELL = \ "/bin/ksh \"]; then ">>$ {PROFILE} echo" ulimit-p 16384 ">>> {PROFILE} echo" ulimit-n 65536 ">>> {PROFILE} echo" else ">>> $ {PROFILE} echo "ulimit-u 16384-n 65536" >$ {PROFILE} echo "fi" >>$ {PROFILE} echo "fi" >>$ {PROFILE} fiecho "'Tail-n 9 $ {PROFILE }'"############## ############################ Echo-e "\ nDisabled system firewall. \ n "'chkconfig iptables off & chkconfig ip6tables off & service iptables stop & service ip6tables stop 'echo 'chkconfig -- list | grep iptables 'echo 'chkconfig -- list | grep ip6tables '####################################### ### echo-e "\ nDisabled system selinux. \ n "'sed-I's/^ SELINUX = enforcing/# SELINUX = enforcing/G'/etc/selinux/config'' grep" ^ SELINUX = disabled "/etc/selinux/config>/dev/null' if [$? -Ne 0]; thenecho "SELINUX = disabled">/etc/selinux/configfiecho "'cat-n/etc/selinux/config | grep SELINUX '"########## ###########

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.