Use shell scripts to configure Oracle Installation Requirements

Source: Internet
Author: User

Use shell scripts to configure Oracle Installation Requirements

1. Configure yum
Yum-y install libXp
Yum-y install libaio

2. Modify the SID in the chprofile file as needed

3. rps-ivh rlwrap-0.30-1.el5.i386.rpm

4. Run the script # Save the following scripts in the install directory: adduser. sh, chprofile. sh, install. sh, limits. sh, mkdir. sh, and sysctl. sh.
./Install

Adduser script content

#/Bin/bash
ADDGROUPS = "oinstall dba"
ADDUSERS = "oracle"
For group in $ ADDGROUPS; do
If [-z "$ (awk-F: '{print $1}'/etc/group | grep $ group)"]; then
Groupadd $ group
Echo "Add new group $ group"
Else
Echo "Group $ group already existed"
Fi
Done
For user in $ ADDUSERS; do
If [-z "$ (awk-F: '{print $1}'/etc/passwd | grep $ user)"]; then
Useradd $ user
Echo "Add new user $ user"
Else
Echo "User $ user already existed"
Fi
Done
If $ (usermod-g oinstall-G dba oracle); then
Echo "Modify user oracle account success"
Else
Echo "Modify user oracle account failure"
Fi
Chprofile script content
#/Bin/bash
PROFILES = "/home/oracle/. bashrc"
For PROFILE in $ PROFILES; do
If [-f "$ PROFILE"]; then
If [-z "$ (grep" Oracle "$ PROFILE)"]; then
Cat >>$ PROFILE <END
# Oracle configure profile parameters success
Export ORACLE_BASE =/u01/app/oracle
Export ORACLE_HOME =\$ ORACLE_BASE/product/10.2.0/db_1
Export PATH =\$ ORACLE_HOME/bin: \ $ PATH
Export ORACLE_OWNER = oracle
Export ORACLE_SID = cctv
Export ORACLE_TERM = vt100
Export THREADS_FLAG = native
Export LD_LIBRARY_PATH =\$ ORACLE_HOME/lib: \ $ LD_LIBRARY_PATH
Export PATH =\$ ORACLE_HOME/bin: \ $ PATH
Export SQLPATH =/home/oracle
Export EDITOR = vi
Alias sqlplus = 'maid sqlplus'
#
# Change this NLS settings to suit your country:
# Example:
# German_germany.we8iso8859p15, american_america.we8iso8859p2 etc.
#
Export LANG = en_US
END
Echo "Add Oracle configure $ PROFILE parameters success"
Else
Echo "Oracle configure $ PROFILE parameters already existed"
Fi
Else
Echo "$0: $ PROFILE not found"
Fi
Done
Install script content
#/Bin/bash
../Adduser. sh
../Sysctl. sh
../Limits. sh
../Mkdir. sh
../Chprofile. sh
Limits script content
#/Bin/bash
LIMITS_FILE = "/etc/security/limits. conf"
If [-f "$ LIMITS_FILE"]; then
If [-z "$ (grep" Oracle "$ LIMITS_FILE)"]; then
Cat >>>$ LIMITS_FILE <END
# Oracle configure shell parameters
Oracle soft nofile 65536
Oracle hard nofile 65536
Oracle soft nproc 16384
Hard nproc 16384
END
Echo "Add Oracle configure shell parameters success"
Else
Echo "Oracle configure shell parameters already existed"
Fi
Else
Echo "$0: $ LIMITS_FILE not found"
Fi
Mkdir script content
#/Bin/bash
ORACLE_FILE_BASE = "/u01/app/oracle"
ORACLE_FILE_VAR = "/var/opt/oracle"
ORACLE_FILE_HOME = "$ ORACLE_FILE_BASE/product/10.2.0/db_1"
For directory in $ ORACLE_FILE_BASE $ ORACLE_FILE_VAR $ ORACLE_FILE_HOME; do
If [-d $ directory]; then
Echo "Directory $ directory already existed"
Else
Mkdir-p $ directory
Chown-R oracle. dba $ directory
Echo "Change directory $ directory owner and group success"
Fi
Done
Sysctl script content
#/Bin/bash
# Echo 250 32000 100 128>/proc/sys/kernel/sem
# Echo 536870912>/proc/sys/kernel/shmmax
# Echo 4096>/proc/sys/kernel/shmmni
# Echo 2097152>/proc/sys/kernel/shmall
# Echo 65536>/proc/sys/fs/file-max
# Echo 1024 65000>/proc/sys/net/ipv4/ip_local_port_range
SYSCTL_FILE = "/etc/sysctl. conf"
RCLOCAL_FILE = "/etc/rc. local"
If [-f "$ SYSCTL_FILE"]; then
If [-z "$ (grep" Oracle "$ SYSCTL_FILE)"]; then
Cat >>$ SYSCTL_FILE <END
# Oracle configure kernel parameters
Kernel. shmmax = 2147483648
Kernel. shmmni = 4096
Kernel. shmall = 2097152
Kernel. sem = 250 32000 100 128
Fs. file-max = 65536
Net. ipv4.ip _ local_port_range = 1024 65000
Net. core. rmem_default = 262144
Net. core. rmem_max = 262144
Net. core. wmem_default = 262144
Net. core. wmem_max = 262144
END
/Sbin/sysctl-p
Echo "Add Oracle configure kernel parameters success"
Else
Echo "Oracle configure kernel parameters already existed"
Fi
Else
If [-z "$ (grep" Oracle "$ RCLOCAL_FILE)"]; then
Cat >>$ RCLOCAL_FILE <END
# Oracle configure kernel parameters
Echo 536870912>/proc/sys/kernel/shmmax
Echo 4096>/proc/sys/kernel/shmmni
Echo 2097152>/proc/sys/kernel/shmall
Echo 250 32000 100 128>/proc/sys/kernel/sem
Echo 65536>/proc/sys/fs/file-max
Echo 1024 65000>/proc/sys/net/ipv4/ip_local_port_range
END
. $ RCLOCAL_FILE
Echo "Add Oracle configure kernel parameters success"
Else
Echo "Oracle configure kernel parameters already existed"
Fi
Fi

Recommended reading:

Install Oracle 10g R2 in CentOS 6.3 (x32)

Installing Oracle 12C in Linux-6-64

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.