RootSetup.sh

#!/bin/bash

#Redhat 7

rpm -q binutils compat-libcap1 compat-libstdc++  gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel


/usr/sbin/groupadd oinstall && /usr/sbin/groupadd dba && /usr/sbin/useradd -g oinstall -G dba oracle && echo 'a1a2a3a4!' | passwd --stdin oracle


#vi /etc/sysctl.conf 

echo "fs.aio-max-nr = 1048576" >>/etc/sysctl.conf 

echo fs.file-max = 6815744 >>/etc/sysctl.conf 

# shmall=Totalmem*40%

echo  kernel.shmall = 1717986918 >>/etc/sysctl.conf 

# shmmax=Totalmem*50%

echo  kernel.shmmax = 2147483648 >>/etc/sysctl.conf 

echo  kernel.shmmni = 4096 >>/etc/sysctl.conf 

echo  kernel.sem = 250 32000 100 128 >>/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 


/sbin/sysctl -p

/sbin/sysctl -a 


# vi /etc/security/limits.conf

echo oracle soft nproc 2047 >>/etc/security/limits.conf

echo oracle hard nproc 16384 >>/etc/security/limits.conf

echo oracle soft nofile 1024 >>/etc/security/limits.conf

echo oracle hard nofile 65536 >>/etc/security/limits.conf



#vi /etc/pam.d/login 

echo session required /lib/security/pam_limits.so >>/etc/pam.d/login

echo session required pam_limits.so  >>/etc/pam.d/login


mkdir -p /u01/app/ && mkdir /u01/tmp && chown -R oracle:oinstall /u01/app/ && chmod -R 775 /u01/app/ 



vi /etc/hosts

#增加 IP地址 主机名


su - oracle



OracleSetup.sh

#!/bin/bash


#vi .bash_profile

echo umask 022 >>.bash_profile

echo export ORACLE_BASE=/u01/app/oracle >>.bash_profile

echo -e "export ORACLE_HOME=\$ORACLE_BASE/product/12c" >>.bash_profile

echo export ORACLE_SID=oracle12c >>.bash_profile

echo -e "PATH=\$PATH:$HOME/bin:\$ORACLE_HOME/bin:\$ORACLE_HOME/lib:\$ORACLE_HOME/lib64" >>.bash_profile

echo -e "LD_LIBRARY_PATH=\$ORACLE_HOME/bin:/usr/bin" >>.bash_profile

echo export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK" >>.bash_profile


echo "if [ $USER = "oracle" ]; then " >>.bash_profile

echo    " if [ $SHELL = "/bin/ksh" ]; then " >>.bash_profile

echo ulimit -p 16384 >>.bash_profile

echo ulimit -n 65536  >>.bash_profile

echo  else  >>.bash_profile

echo ulimit -u 16384 -n 65536 >>.bash_profile

echo fi >>.bash_profile

echo fi  >>.bash_profile


source ~/.bash_profile