#!/bin/bash
#Purpose: Create and config Oracle install.
#Usage: Log on as the superuser (' root ')
#1. Create groups and users.
Groupadd DBA-G 111
Groupadd Oinstall-g 110
Useradd oracle-u 110-g 110-g 111
echo "Oracle" | passwd--stdin Oracle
echo "Export tmp=/tmp" >>/home/oracle/.bash_profile
Echo ' Export tmpdir= $TMP ' >>/home/oracle/.bash_profile
echo "Export Oracle_hostname=localhost.localdomain" >>/home/oracle/.bash_profile
echo "Export ORACLE_SID=ORCL" >>/home/oracle/.bash_profile
echo "Export oracle_base=/u01/app/oracle" >>/home/oracle/.bash_profile
Echo ' Export oracle_home= $ORACLE _base/product/11.2.0/dbhome_1 ' >>/home/oracle/.bash_profile
Echo ' Export path=/usr/sbin: $PATH ' >>/home/oracle/.bash_profile
Echo ' Export path= $ORACLE _home/bin: $PATH ' >>/home/oracle/.bash_profile
Echo ' Export ld_library_path= $ORACLE _home/lib:/lib:/usr/lib ' >>/home/oracle/.bash_profile
Echo ' Export classpath= $ORACLE _home/jre: $ORACLE _home/jlib: $ORACLE _home/rdbms/jlib ' >>/home/oracle/.bash_ Profile
echo "Export Lang=en_us" >>/home/oracle/.bash_profile
echo "Export Nls_lang=american_america. Al32utf8 ">>/home/oracle/.bash_profile
echo "Export nls_date_format= ' yyyy-mm-dd hh24:mi:ss '" >>/home/oracle/.bash_profile
echo "The Groups and users has been created"
#2. Create directory for Oracle.
Mkdir-p/u01
Mkdir-p/u01/app
Mkdir-p/u01/app/oracle
Chown-r oracle:oinstall/u01
Chown-r Oracle:oinstall/u01/app
Chown-r oracle:oinstall/u01/app/oracle
echo "The directory has Beeb created."
#3. config limits.
Cp/etc/security/limits.conf/etc/security/limits.conf.bak
echo "Oracle soft Nproc 2047" >>/etc/security/limits.conf
echo "Oracle hard Nproc 16384" >>/etc/security/limits.conf
echo "Oracle Soft nofile 1024x768" >>/etc/security/limits.conf
echo "Oracle hard Nofile 65536" >>/etc/security/limits.conf
echo "Modifing the/etc/security/limits.conf has been succeed."
#4. config login.
Cp/etc/pam.d/login/etc/pam.d/login.bak
echo "Session required/lib/security/pam_limits.so" >>/etc/pam.d/login
echo "Session required pam_limits.so" >>/etc/pam.d/login
echo "Modifing The/etc/pam.d/login has been succeed."
#5. config profile.
Cp/etc/profile/etc/profile.bak
Echo ' if [$USER = ' Oracle ']; Then ' >>/etc/profile
Echo ' if [$SHELL = '/bin/ksh ']; Then ' >>/etc/profile
Echo ' ulimit-p 16384 ' >>/etc/profile
Echo ' ulimit-n 65536 ' >>/etc/profile
Echo ' Else ' >>/etc/profile
Echo ' ulimit-u 16384-n 65536 ' >>/etc/profile
Echo ' fi ' >>/etc/profile
Echo ' fi ' >>/etc/profile
echo "Modifing The/etc/profile has been succeed."
#6. config Sysctl.ctl
Cp/etc/sysctl.conf/etc/sysctl.conf.bak
echo "FS.AIO-MAX-NR = 1048576" >>/etc/sysctl.conf
echo "Fs.file-max = 6815744" >>/etc/sysctl.conf
echo "Kernel.shmall = 2097152" >>/etc/sysctl.conf
echo "Kernel.shmmax = 1285103616" >>/etc/sysctl.conf
echo "Kernel.shmmni = 4096" >>/etc/sysctl.conf
echo "Kernel.sem = 32000" >>/etc/sysctl.conf
echo "Net.ipv4.ip_local_port_range = 9000 65500" >>/etc/sysctl.conf
echo "Net.core.rmem_default = 262144" >>/etc/sysctl.conf
echo "Net.core.rmem_max = 4194304" >>/etc/sysctl.conf
echo "Net.core.wmem_default = 262144" >>/etc/sysctl.conf
echo "Net.core.wmem_max = 1048586" >>/etc/sysctl.conf
echo "Net.ipv4.tcp_wmem = 262144 262144 262144" >>/etc/sysctl.conf
echo "Net.ipv4.tcp_rmem = 4194304 4194304 4194304" >>/etc/sysctl.conf
echo "Modifing the/etc/sysctl.conf has been succeed."
Sysctl-p
Oracle 11g Install Linux