Centos6.5_Oracle_sh静默安装【离线安装-RPM安装依赖包】

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

1.拷贝Oracle文件和脚本至/tmp

2.拷贝目录[Windows]Centos6.5_Oracle_rpm /tmp

Centos6.5_Oracle_rpm --> [依赖包全存在里面]

#######################################
3.执行oracle_for_1.sh引导安装
cd /tmp/
sh oracle_for_1.sh
#######################################
4.验证Oracle是否安装成功
su - oracle
sqlplus / as sysdba
show parameter name

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

1.该脚本与“通过Yum安装依赖包一文大体相似”,不同处只有依赖包的安装方式,考虑到各个公司项目服务器环境不允许访问外网。该文通过手动下载rpm包安装Oracle

2.依赖包下载方式两种:

    2.1通过Oracle官网指示去获取

    2.2①准备各常用版本的依赖包②了解用户服务器版本后 在模拟环境通过Yum方式安装, 然后获取该服务器系统版本适应的依赖包[这个比较麻烦,保存下来就今后可以使用①了,比较不是每个人都是英语6级水准, 我也没找到oracle显示依赖地方在哪里,笨人用笨办法呗,能完成工作就行,我特瞄的才不管什么办法。 

    2.3这个版本的可以联系我 找我要。后期我在做一个Centos7.4的离线安装

依赖包获取url:依赖包-官网?

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

该部署脚本共分为三个sh。

oracle_for_1.sh

oracle_for_2.sh

oracle_for_3.sh

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

oracle_for_1.sh

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

#!/bin/bash
###########
myhostname=$(hostname)
myip=$(ifconfig |awk -F "[ :]+" 'NR==2 {print $4}')
###########
echo "BeginSetInfo..."
cd
cd /tmp
sed -i "/::1/a\ $myip\t\t$myhostname" /etc/hosts
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
#yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel
#Centos6.5
cd /tmp/Centos6.5_Oracle_rpm/
#gcc
rpm -ivh --force --nodeps cloog-ppl-0.15.7-1.2.el6.x86_64.rpm  
rpm -ivh --force --nodeps cpp-4.4.7-18.el6.x86_64.rpm     
rpm -ivh --force --nodeps gcc-4.4.7-18.el6.x86_64.rpm        
rpm -ivh --force --nodeps libgcc-4.4.7-18.el6.x86_64.rpm    
rpm -ivh --force --nodeps libgomp-4.4.7-18.el6.x86_64.rpm   
rpm -ivh --force --nodeps mpfr-2.4.1-6.el6.x86_64.rpm       
rpm -ivh --force --nodeps ppl-0.10.2-11.el6.x86_64.rpm 
#make
rpm -ivh --force --nodeps make-3.81-23.el6.x86_64.rpm
#binutils
rpm -ivh --force --nodeps binutils-2.20.51.0.2-5.47.el6_9.1.x86_64.rpm
#gcc-c++
rpm -ivh --force --nodeps gcc-c++-4.4.7-18.el6.x86_64.rpm            
rpm -ivh --force --nodeps libstdc++-4.4.7-18.el6.x86_64.rpm     
rpm -ivh --force --nodeps libstdc++-devel-4.4.7-18.el6.x86_64.rpm
#compat-libstdc++-33
rpm -ivh --force --nodeps compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
#elfutils-libelf-devel
rpm -ivh --force --nodeps elfutils-0.164-2.el6.x86_64.rpm                                                                                                                                                                               
rpm -ivh --force --nodeps elfutils-libelf-0.164-2.el6.x86_64.rpm                                                                                                                                                                       
rpm -ivh --force --nodeps elfutils-libelf-devel-0.164-2.el6.x86_64.rpm                                                                                                                                                                
rpm -ivh --force --nodeps elfutils-libs-0.164-2.el6.x86_64.rpm
#elfutils-libelf-devel-static
rpm -ivh --force --nodeps elfutils-libelf-devel-static-0.164-2.el6.x86_64.rpm
#ksh
rpm -ivh --force --nodeps ksh-20120801-36.el6_9.x86_64.rpm
#libaio-0.3.107-10.el6.x86_64
#libaio-devel
rpm -ivh --force --nodeps libaio-devel-0.3.107-10.el6.x86_64.rpm
#numactl-devel				
rpm -ivh --force --nodeps numactl-2.0.9-2.el6.x86_64.rpm                                                                                                                                                                                  
rpm -ivh --force --nodeps numactl-devel-2.0.9-2.el6.x86_64.rpm
#sysstat
rpm -ivh --force --nodeps sysstat-9.0.4-33el6_9.1.x86_64.rpm
#unixODBC
rpm -ivh --force --nodeps unixODBC-2.2.14-14.el6.x86_64.rpm
#unixODBC-devel
rpm -ivh --force --nodeps unixODBC-devel-2.2.14-14.el6.x86_64.rpm
#pcre-devel
rpm -ivh --force --nodeps pcre-7.8-7.el6.x86_64.rpm                                                                                                                                                                                   
rpm -ivh --force --nodeps pcre-devel-7.8-7.el6.x86_64.rpm
#new users
cd /tmp/
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
#passwd oracle
echo "123456" | passwd --stdin oracle
#/etc/sysctl.conf
sed -i '$a\io-max-nr \= 1048576\nfs.file-max \= 6815744\nkernel.shmall \= 2097152\nkernel.shmmax \= 1073741824\nkernel.shmmni \= 4096\nkernel.sem \= 250 32000 100 128\nnet.ipv4.ip_local_port_range \= 9000 65500\nnet.core.rmem_default \= 262144\nnet.core.rmem_max \= 4194304\nnet.core.wmem_default \= 262144\nnet.core.wmem_max \= 1048576' /etc/sysctl.conf
#验证是否生效
sysctl -p
# End of file	/etc/security/limits.conf
sed -i '/^# End of file/i\oracle\tsoft\tnproc\t2047\noracle\thard\tnproc\t16384\noracle\tsoft\tnofile\t1024\noracle\thard\tnofile\t65536\noracle\tsoft\tstack\t10240' /etc/security/limits.conf
#/etc/pam.d/login
sed -i '$a\session\t\trequired\t/lib64/security/pam_limits.so\nsession\t\trequired\tpam_limits.so' /etc/pam.d/login
#Path manipulation /etc/profile

 
  

#mkdir files
mkdir -p /u01/app/oracle/product/11.2.0
mkdir /u01/app/oracle/oradata
mkdir /u01/app/oracle/inventory
mkdir /u01/app/oracle/fast_recovery_area
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
#go /tmp
cd
cd /tmp
#unzip
unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip
#set oracle: su root password null
#/etc/pam.d/su 
#auth sufficient pam_wheel.so trust use_uid	#use_uid	#del
#usermod -G wheel oracle	
#usermod -G dba oracle  修改成指定行下一行
sed -i '/trust use_uid/a\auth\t\tsufficient\tpam_wheel.so\ trust\ use_uid\n\#del' /etc/pam.d/su
#not count
usermod -G wheel oracle
#
cd /tmp/database/response/
cp db_install.rsp db_install.rsp-
sed -i '/oracle\.install\.option/'d /tmp/database/response/db_install.rsp
sed -i '/ORACLE\_HOSTNAME/'d /tmp/database/response/db_install.rsp
sed -i '/UNIX\_GROUP\_NAME/'d /tmp/database/response/db_install.rsp
sed -i '/INVENTORY\_LOCATION/'d /tmp/database/response/db_install.rsp
sed -i '/SELECTED\_LANGUAGES/'d /tmp/database/response/db_install.rsp
sed -i '/ORACLE\_HOME/'d /tmp/database/response/db_install.rsp
sed -i '/ORACLE\_BASE/'d /tmp/database/response/db_install.rsp
sed -i '/oracle\.install\.db\.InstallEdition/'d /tmp/database/response/db_install.rsp
sed -i '/oracle\.install\.db\.DBA\_GROUP/'d /tmp/database/response/db_install.rsp
sed -i '/oracle\.install\.db\.OPER\_GROUP/'d /tmp/database/response/db_install.rsp
sed -i '/DECLINE\_SECURITY\_UPDATES/'d /tmp/database/response/db_install.rsp
#add anyinfo
sed -i '/rspfmt_dbinstall_response_schema_v11_2_0/a\\n\noracle\.install\.option\=INSTALL\_DB\_SWONLY\nORACLE\_HOSTNAME\=$myhostname\nUNIX\_GROUP\_NAME\=oinstall\nINVENTORY\_LOCATION\=\/u01\/app\/oracle\/inventory\nSELECTED\_LANGUAGES\=en\,zh\_CN\nORACLE\_HOME\=\/u01\/app\/oracle\/product\/11\.2\.0\nORACLE\_BASE\=\/u01\/app\/oracle\noracle\.install\.db\.InstallEdition\=EE\noracle\.install\.db\.DBA\_GROUP\=dba\noracle\.install\.db\.OPER\_GROUP\=dba\nDECLINE\_SECURITY\_UPDATES\=true\n' /tmp/database/response/db_install.rsp
#
cd /tmp/database/response/
#delete anyinfo 
sed -i '/GDBNAME/'d /tmp/database/response/dbca.rsp
sed -i '/SID/'d /tmp/database/response/dbca.rsp
sed -i '/SYSPASSWORD/'d /tmp/database/response/dbca.rsp
sed -i '/SYSTEMPASSWORD/'d /tmp/database/response/dbca.rsp
sed -i '/SYSMANPASSWORD/'d /tmp/database/response/dbca.rsp
sed -i '/DBSNMPPASSWORD/'d /tmp/database/response/dbca.rsp
sed -i '/DATAFILEDESTINATION/'d /tmp/database/response/dbca.rsp
sed -i '/RECOVERYAREADESTINATION/'d /tmp/database/response/dbca.rsp
sed -i '/CHARACTERSET/'d /tmp/database/response/dbca.rsp
sed -i '/TOTALMEMORY/'d /tmp/database/response/dbca.rsp
#add anyinfo
#/tmp/database/response/dbca.rsp
#OPERATION_TYPE = "createDatabase" need update .must set the [createDabase] of down
sed -i '/\[CREATEDATABASE/a\\nGDBNAME\=\"orcl\"\nSID\=\"orcl\"\nSYSPASSWORD\=\"oracle\"\nSYSTEMPASSWORD\=\"oracle\"\nSYSMANPASSWORD\=\"oracle\"\nDBSNMPPASSWORD\=\"oracle\"\nDATAFILEDESTINATION\=\/u01\/app\/oracle\/oradata\nRECOVERYAREADESTINATION\=\/u01\/app\/oracle\/fast\_recovery\_area\nCHARACTERSET\=\"ZHS16GBK\"\nTOTALMEMORY\=\"1638"\n' /tmp/database/response/dbca.rsp
usermod -G dba oracle
chown oracle /tmp/oracle_for_1.1.sh
chown oracle /tmp/oracle_for_3.sh
chgrp oinstall /tmp/oracle_for_1.1.sh
chgrp oinstall /tmp/oracle_for_3.sh
echo "请执行下一步操作!"
echo "请执行下一步操作!"
echo "请执行下一步操作!"

#set oracle .bash_profile
echo "BeginSetprofile..."
su - oracle -s /bin/bash /tmp/oracle_for_2.sh
echo "EndSetprofile..."
#

#function
initDatabase(){
	runStr="cd /tmp/database/
	nohup ./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /tmp/database/response/db_install.rsp
	"
	su - oracle -c "$runStr"
	while true
	do
	echo -n "."
	sleep 10s
	grep "Successfully Setup Software" /home/oracle/nohup.out >> /dev/null
	if [ $? -eq 0 ];then
		echo "\n即将开始执行系统生成脚本..."
		sh /u01/app/oracle/inventory/orainstRoot.sh
		sh /u01/app/oracle/product/11.2.0/root.sh
		break
	fi
	done
}
echo "BeginInit..."
initDatabase
echo "EndInit..."
#su - oracle -s /bin/bash /tmp/oracle_for_1.1.sh
#echo "完成上一步的退出..."
#sh oracle_for_2.sh
#start netar / ntca
su - oracle -s /bin/bash /tmp/oracle_for_3.sh
#

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

oracle_for_2.sh

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

#!/bin/bash
#/tmp/Two.sh
#Open Second Windows sh file.sh
sed -i '$a\ORACLE_BASE\=\/u01\/app\/oracle\nORACLE_HOME\=\$ORACLE_BASE\/product\/11.2.0\nORACLE_SID\=orcl\nPATH\=\$PATH\:\$ORACLE_HOME\/bin\nexport\ ORACLE_BASE\ ORACLE_HOME\ ORACLE_SID\ PATH' /home/oracle/.bash_profile

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

oracle_for_3.sh

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


#!/bin/bash
#The shell for oracle
###########
#myhostname=$(hostname)
#myip=$(ifconfig |awk -F "[ :]+" 'NR==2 {print $4}')
###########
netca -silent -responseFile /tmp/database/response/netca.rsp
export DISPLAY=localhost:0.0
netca -silent -responseFile /tmp/database/response/netca.rsp
netstat -tnulp | grep 1521
#update oracle the secound group
dbca -silent -responseFile /tmp/database/response/dbca.rsp
#show parameter name
#sed -i '$a\auth\t\tsufficient\tpam_wheel.so\ttrust use_uid' /etc/pam.d/su
#sed -i '/trust use_uid/{n;d}' /etc/pam.d/su
echo "安装完成..."
echo "请用户手动验证Oracle是否正常使用..."



Centos6.5_Oracle_sh静默安装【离线安装-RPM安装依赖包】_第1张图片




你可能感兴趣的:(Oracle,Linux)