centos 7 安装 Oracle 12c

#!/bin/bash
#!/usr/bin/expect -f
#/etc/sysctl.conf --bash-srcipts--
echo 'net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500' >> /etc/sysctl.conf
sysctl -p
echo $?
######################################################################

######################################################################
#/etc/security/limits.conf --bash-srcipts--
echo 'oracle   soft   nofile    1024
oracle   hard   nofile    65536
oracle   soft   nproc    16384
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768
oracle   hard   memlock    134217728
oracle   soft   memlock    134217728' >> /etc/security/limits.conf
echo $?
######################################################################

######################################################################
yum  install -y binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libX11 libX11.i686 libXau libXau.i686 libXi libXi.i686 libXtst libXtst.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libxcb libxcb.i686 make nfs-utils net-tools smartmontools sysstat unixODBC unixODBC-devel

######################################################################
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
useradd -u 54321 -g oinstall -G dba,oper oraclegroupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
useradd -u 54321 -g oinstall -G dba,oper oracle
######################################################################

######################################################################
#passwd oracle
echo "oracle" | passwd --stdin oracle //设置oracle用户密码...
######################################################################

#/etc/selinux/config --bash-srcipts--
#<---selinux-disabled shell script--->
sed -i '7,12s/^/#&/g;7,12s/##/#/g;13cSELINUX=disabled' /etc/selinux/config
setenforce 0
selinux_config=`getenforce`
disabled=`echo Disabled`
if [ $disabled  == $selinux_config ]
then
    echo "your selinux is `getenforce`."
else
    echo "your selinux is `getenforce`,please running command'reboot' or 'init 6'and 'cat /etc/selinux/config' configuration bash file!"
fi
getenforce
######################################################################

######################################################################
(systemctl stop firewalld;systemctl disable firewalld)
mkdir -p /usr/local/products/oracle12c
chown -R oracle:oinstall /usr/local
chmod -R 775 /usr/local/
######################################################################

######################################################################
spawn su oracle
expect ":"
send "oracle
"
interact
######################################################################

#.bash_profile --bash-srcipts--
echo 'export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=solang
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/usr/local/products
export ORACLE_HOME=$ORACLE_BASE/oracle12c
export ORACLE_SID=cdb1

export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib' >> .bash_profile
######################################################################

######################################################################
cd $(dirname "`find / -name 'linuxx64_12201_database.zip'`") //查找linuxx64_12201_database.zip并进入该文件所在目录

#//查找文件/文件夹并进入目录命令
#//[root@localhost /]# cd $(dirname "`find / -name 'ifcfg-ens33'`") //查找ifcfg-ens33文件并进入该文件所在目录
#//[root@localhost network-scripts]# 
#//[root@localhost /]# mkdir -p /etc/sysconfig/network-scripts/kings-dev 
#//[root@localhost ~]# cd $(dirname "`find / -name 'kings-dev'`") //查找kings-dev文件夹并进入该文件夹上层目录
#//[root@localhost network-scripts]# 
#//[root@localhost ~]# cd $(find / -name 'kings-dev') ////查找kings-dev文件夹并进入该文件夹目录
#//[root@localhost kings-dev]# 
#//[root@localhost src]# du -alh
#//1.9M    ./redis-5.0.5.tar.gz
#//1.9M    .
#//[root@localhost src]# cd $(dirname "`tar -zxvf redis-5.0.5.tar.gz`")  //解压redis-5.0.5.tar.gz进入解压目录
#//[root@localhost redis-5.0.5]# 

######################################################################

######################################################################
unzip linuxx64_12201_database.zip
原文地址:https://www.cnblogs.com/huixst/p/11595134.html