Oracle->oracle Single Instance shell script [20180122]

Source: Internet
Author: User
Tags dba gpg

Scripts are primarily used for Redhat platform installation 11g and 12c software     Dependency check and install     user, group check and install     system kernel, user limit     firewall, SELinux off     Note that only DBAs are created in the Linux group script, typically creating 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" limitsconf= "/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" ' UN Ame-a '  echo-e   ' \nleast 4GB of ram.\n "echo" ' grep memtotal/proc/meminfo ' " ECHO-E" \nto determine 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 "];the nrpmpack= "binutilscompat-libstdc++*elfutils-libelfelfutils-libelf-develgccgcc-c++ glibcglibc-commonglibc-develglibc-headerskernel-headerskshlibaiolibaio-devellibgcclibgomplibstdc++libstdc++- Develmakesysstatunixodbcunixodbc-devel "elserpmpack=" binutilscompat-libstdc++* Elfutils-libelfelfutils-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 ${dat E} ">${yumfile}echo" [Rhel-source] ">>${yumfile}echo" name=red Hat Enterprise Linux \ $releasever-\ $basearch-S Ource ">>${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  & Nbsp;             echo "$pack not install"                  yum-y Install $pack         fi      &Nbsp; 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 &nbsp ;" \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&nbs p; ' grep oracle/etc/passwd >/dev/null ' if [$-ne 0]; Thenecho "useradd-g dba Oracle" ' Useradd-g dba Oracle ' echo ' pcq#1234 ' | ' passwd--stdin Oracle ' fi echo ' ID Oracle ' " if [!-d"/u01/app/oracle "];thenecho-e  " \nmkdir-p/U 01/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.dba/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 Recommended 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];thenech O "Oracle hard nproc 16384" >> ${limitsconf}fi  ' grep "Oracle soft nofile 1024x768" ${limitsconf}  >/D Ev/null ' If [$?-ne 0];thenecho "Oracle soft nofile 1024x768" >> ${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.shm Mni = 4096 "${sysctlconf} >/dev/null ' If [$?-ne 0];thenecho" Kernel.shmmni = 4096 ">> ${sysctlconf}fi ' grep" Ke Rnel.sem = 32000 142 "${sysctlcoNF} >/dev/null ' If [$?-ne 0];thenecho "Kernel.sem = 32000" 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_lo Cal_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" ${sy sctlconf} >/dev/null ' If [$?-ne 0];thenecho "Net.core.rmem_max = 4194304" >> ${sysctlconf}fi ' grep "net.core.wm Em_default =262144 "${sysctlconf} >/dev/null ' If [$?-ne 0];thenecho" Net.core.wmem_default =262144 ">> ${SYSCT Lconf}fi ' grep ' NET.CORE.WMem_max = 10485 "${sysctlconf} >/dev/null ' If [$?-ne 0];thenecho" Net.core.wmem_max = 10485 ">> ${sysctlconf}f i/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 "Ulimi T-u 16384-n 65536 ">>${profile}echo" fi ">> ${profile}echo" fi ">>${profile}fiecho" ' Tail-n 9 ${PROF ILE} ' "###################### #################### #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 '" #####################

Oracle->oracle Single Instance shell script [20180122]

Related Article

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.