Before installing Oracle software under Linux, there is considerable work to be done, including setting up users, configuring kernel parameters, configuring resource throttling parameters, and configuring Oracle user environments. Even if you are familiar with it, you need to spend some effort to prepare it. Plainly, doing these things is a bit like a low-level repetitive construction, although not much technical content, but have to do. These preparations are now scripted so that the Oracle installation can be prepared with almost one click.
Description
1> the script is executed in SH oracle_setup_prepare.sh orcl/opt, two parameter descriptions are explained in the Scripting section.
2> This script involves a text file package_list, which is a list of Oracle installation dependency packages. The specific content is shown below.
3> The script is intended primarily for single-instance database installations.
4> installation information refer to the generated Output.log file
The script reads as follows:
[email protected] ~]$ cat oracle_setup_prepare.sh
#!/bin/bash############################################## #功能: Preparation forOracle installation## #参数: Sid base## #其中, sid refers to oracle_sid## #BASE指的是ORACLE_BASE的一级目录, such as Oracle_base=/opt/app/oracle, the base is/opt############################################ #检查参数个数是否正确if[$#-ne2]; Then Echo "$ A SID BASE"ExitfiSID=" $"BASE=" $"#主机名绑定IP=`ifconfig|awk-F'[: ]+' 'Nr==2{print $4'} ' HOST=`hostname`sed-I.'$a'$IP' '$HOST"'/etc/hosts#checking The package requirements# the list of tables that need to be installed in the Package_list fileawk-F'-[0-9]' '{print $}'Package_list |awk '{print $}'|Uniq|Xargs Yum Install-y > Output.log2>&1#Creating Required Operating System Groups and Usersgroupadd-G -Oinstallgroupadd-G801Dbagroupadd-G802Operuseradd-G Oinstall-G Dba,oper OracleEcho 123456|passwd--stdin Oracle >> Output.log2>&1#Configure kernal Parameterssed-I.'$a \fs.aio-max-nr = 1048576'/etc/sysctl.confsed-I.'$a \fs.file-max = 6815744'/etc/sysctl.confsed-I.'$a \kernel.shmall = 2097152'/etc/sysctl.confsed-I.'$a \kernel.shmmax = 536870912'/etc/sysctl.confsed-I.'$a \kernel.shmmni = 4096'/etc/sysctl.confsed-I.'$a \kernel.sem = 32000'/etc/sysctl.confsed-I.'$a \net.ipv4.ip_local_port_range = 9000 65500'/etc/sysctl.confsed-I.'$a \net.core.rmem_default = 262144'/etc/sysctl.confsed-I.'$a \net.core.rmem_max = 4194304'/etc/sysctl.confsed-I.'$a \net.core.wmem_default = 262144'/etc/sysctl.confsed-I.'$a \net.core.wmem_max = 1048586'/etc/Sysctl.confsysctl-P >> Output.log2>&1#Configure Resource Limitssed-I.'$a \oracle soft nproc 2047'/etc/security/limits.confsed-I.'$a \oracle hard Nproc 16384'/etc/security/limits.confsed-I.'$a \oracle soft nofile 1024x768'/etc/security/limits.confsed-I.'$a \oracle hard nofile 65536'/etc/security/Limits.conf#add The following line to the/etc/pam.d/Login file,ifIt does not already exist:sed-I.'$a \session required pam_limits.so'/etc/pam.d/Login#Add The following line to the/etc/ Profilesed-I.'$a \if [[$USER = "Oracle"]]; Then'/etc/ Profilesed-I.'$a \ If [[$SHELL = "/bin/ksh"]]; Then'/etc/ Profilesed-I.'$a \ ulimit-p 16384'/etc/ Profilesed-I.'$a \ ulimit-n 65536'/etc/ Profilesed-I.'$a \ Else'/etc/ Profilesed-I.'$a \ ulimit-u 16384-n 65536'/etc/ Profilesed-I.'$a \ Fi'/etc/ Profilesed-I.'$a \fi'/etc/Profilesource/etc/profile#configuring the Oracle User's Environmentsed-I.'$a \export oracle_sid='$SID"'/home/oracle/. Bash_profilesed-I.'$a \export oracle_base='$BASE'/app/oracle'/home/oracle/. Bash_profilesed-I.'$a \export oracle_home= $ORACLE _base/product/11.2.0.1/db_1'/home/oracle/. Bash_profilesed-I.'$a \export path= $ORACLE _home/bin: $PATH'/home/oracle/. Bash_profilesource/home/oracle/. bash_profile#creating Required Directoriesmkdir-P $ORACLE _homeChown-R Oracle.oinstall $BASE/appchmod-R775$BASE/appEcho "Preparation for Oracle installation is over!"
Package_list content is as follows:
[email protected] ~]$ cat Package_list
binutils-2.17.50.0.6Compat-libstdc++- --3.2.3Compat-libstdc++- --3.2.3( +bit) Elfutils-libelf-0.125elfutils-libelf-devel-0.125GCC-4.1.2GCC-c++-4.1.2glibc-2.5- -glibc-2.5- -( +bit) glibc-common-2.5glibc-devel-2.5glibc-devel-2.5( +bit) glibc-headers-2.5Ksh-20060214Libaio-0.3.106Libaio-0.3.106( +bit) Libaio-devel-0.3.106Libaio-devel-0.3.106( +bit) LIBGCC-4.1.2LIBGCC-4.1.2( +bit) Libstdc++-4.1.2LIBSTDC++-4.1.2( +bit) Libstdc++-devel4.1.2 Make-3.81Sysstat-7.0.2UnixODBC-2.2. OneUnixODBC-2.2. One( +bit) UnixODBC-devel-2.2. OneUnixODBC-devel-2.2. One( +Bit
One-click Preparation for Oracle Installation