rhel6.4自动安装oracle11g客户端
1、安装过程
点击(此处)折叠或打开
创新互联公司秉承实现全网价值营销的理念,以专业定制企业官网,成都网站设计、做网站,微信小程序,网页设计制作,手机网站制作,成都全网营销帮助传统企业实现“互联网+”转型升级专业定制企业官网,公司注重人才、技术和管理,汇聚了一批优秀的互联网技术人才,对客户都以感恩的心态奉献自己的专业和所长。
- [root@localhost ~]# cd /tmp/client/
- [root@localhost client]# ll
- total 640676
- -rw-r--r--. 1 root root 5554 Dec 13 16:24 auto_install_oracle_client.sh #主脚本
- -rw-r--r--. 1 root root 12062 Dec 13 16:24 client_install.rsp #静默安装配置文件
- -rw-r--r--. 1 root root 656026876 Dec 13 16:22 p13390677_112040_Linux-x86-64_4of7.zip #安装包
- [root@localhost client]# chmod u+x auto_install_oracle_client.sh #赋权
- [root@localhost client]# ./auto_install_oracle_client.sh #在文件所在路径使用root用户执行
- tmp is.................................................... [ok] #检查/tmp目录,需要大于120 MB
- swap is.................................................... [ok] #检查swap空间,需要大于150 MB
- finding sqlplus #通过find查找sqlplus,此处需要等待
- env is.................................................... [ok] #环境ok
- pkg is.................................................... [ok] #安装包ok
- rsp is.................................................... [ok] #静默安装配置文件ok
- please input which user to install oracle client:oracle #可以是已经存在的用户,也可以是新用户
- please input ip addr:192.168.1.222 #输入该系统ip地址
- unziping p13390677_112040_Linux-x86-64_4of7.zip #正在解压安装包,此处需要等待
- starting install,may be take a minutes,you can see log:/tmp/install_client.log #需要等待
- starting orainstRoot.sh,you can see /tmp/orainstRoot.sh.log
- The execution of the script is complete.
- #######################################################################
- #########please use root to run /tmp/del_client.sh to deinstall####### #卸载脚本
- #########dba oinstall oracle need your check################### #若需要,用户和组需手动删除
- #######################################################################
点击(此处)折叠或打开
- [root@localhost client]# su - oracle
- [oracle@localhost ~]$ cd $ORACLE_HOME/network/admin/
- [oracle@localhost admin]$ vi tnsnames.ora
- [oracle@localhost admin]$ cat tnsnames.ora
- ORCL =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.42)(PORT = 1521))
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = orcl)
- )
- )
- [oracle@localhost admin]$ sqlplus scott/tiger@orcl
- SQL>
点击(此处)折叠或打开
- [root@localhost client]# /tmp/del_client.sh
- [root@localhost client]# su - oracle
- [oracle@localhost ~]$ sqlplus
- -bash: sqlplus: command not found
auto_install_oracle_client.sh的内容:
点击(此处)折叠或打开
- #!/bin/bash
- #检查/tmp空间
- if [ `df -m /tmp|wc -l` -eq 2 ];then
- tmp=`df -m /tmp|tail -1|awk '{print $4}'`
- else
- tmp=`df -m /tmp|tail -1|awk '{print $3}'`
- fi
- if [ $tmp -gt 120 ];then
- echo "tmp is.................................................... [ok]"
- else
- echo "[fail]====>/tmp must more than 120MB"
- exit 5
- fi
- #检查swap空间
- if [ `free -m|grep Swap|awk '{print $2}'` -gt 150 ];then
- echo "swap is.................................................... [ok]"
- else
- echo "[fail]====>swap must more than 150MB"
- exit 5
- fi
- #检查该主机是否已经安装了sqlplus
- echo "finding sqlplus"
- if [ `find / -name "sqlplus"|grep sqlplus|wc -l` -gt 0 ]
- then
- echo "this system has installed oracle client.install process exit!"
- echo "install process stop!"
- exit 0
- else
- echo "env is.................................................... [ok]"
- fi
- #检查客户端安装包是否已经上传
- LOCALDIR=`pwd`
- if [ `ls -l $LOCALDIR|grep "p13390677_112040_Linux-x86-64_4of7.zip" |wc -l` -gt 0 ]
- then
- echo "pkg is.................................................... [ok]"
- else
- echo "please upload p13390677_112040_Linux-x86-64_4of7.zip in $LOCALDIR"
- echo "install process stop!"
- exit 0
- fi
- #检查配置文件是否已经上传
- LOCALDIR=`pwd`
- if [ `ls -l $LOCALDIR|grep client_install.rsp|wc -l` -gt 0 ]
- then
- echo "rsp is.................................................... [ok]"
- else
- echo "please upload client_install.rsp in $LOCALDIR"
- echo "install process stop!"
- exit 0
- fi
- #获取用户名、ORACLE_BASE、ip地址信息
- echo -e "please input which user to install oracle client:\c"
- read USERNAME
- ORACLE_BASE=/home/$USERNAME/oracle_client
- echo -e "please input ip addr:\c"
- read ip_addr
- #备份和修改/etc/hosts文件
- cp /etc/hosts /etc/hosts_lihbbak
- echo "$ip_addr `hostname`">>/etc/hosts
- #备份oraInst.loc文件
- mv -f /etc/oraInst.loc /etc/oraInst.loc_lihbbak >/dev/null 2>&1
- #创建dba、oinstall用户组,创建用户
- /usr/sbin/groupadd dba >/dev/null 2>&1
- /usr/sbin/groupadd oinstall >/dev/null 2>&1
- /usr/sbin/useradd -m -g oinstall -G dba $USERNAME >/dev/null 2>&1
- #创建目录并附权
- mkdir -p $ORACLE_BASE >/dev/null 2>&1
- cd $ORACLE_BASE
- mkdir oraInventory
- chown -R $USERNAME:oinstall $ORACLE_BASE
- #解压安装包并附权
- echo "unziping p13390677_112040_Linux-x86-64_4of7.zip"
- cd $LOCALDIR
- /usr/bin/unzip p13390677_112040_Linux-x86-64_4of7.zip >/dev/null 2>&1
- chown -R $USERNAME:oinstall client
- chown $USERNAME:oinstall client_install.rsp
- #备份并修改配置文件
- cp client_install.rsp client_install.rsp_lihbbak
- sed -i "s|/u01/app|$ORACLE_BASE|g" client_install.rsp
- #配置用户环境并安装软件
- echo "starting install,may be take a minutes,you can see log:/tmp/install_client.log"
- su - $USERNAME
- echo "export ORACLE_BASE=$ORACLE_BASE" >>/home/$USERNAME/.bash_profile
- echo "export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0.4/client_1" >>/home/$USERNAME/.bash_profile
- echo 'export PATH=\$ORACLE_HOME/bin:\$PATH' >>/home/$USERNAME/.bash_profile
- echo 'export LD_LIBRARY_PATH=$ORACLE_BASE/oracle/product/11.2.0.4/client_1/lib' >>/home/$USERNAME/.bash_profile
- source ~/.bash_profile >/dev/null 2>&1
- cd $LOCALDIR/client
- ./runInstaller -silent -showProgress -ignorePrereq -waitforcompletion -responseFile $LOCALDIR/client_install.rsp
- EOF
- #执行root.sh脚本
- sleep 2s
- echo "starting orainstRoot.sh,you can see /tmp/orainstRoot.sh.log"
- $ORACLE_BASE/oraInventory/orainstRoot.sh >/tmp/orainstRoot.sh.log 2>&1
- tail -1 /tmp/orainstRoot.sh.log
- #修改ORACLE_HOME/bin的权限
- chmod 755 $ORACLE_BASE/oracle/product/11.2.0.4/client_1/bin/*
- #配置tnsnames.ora文件用于测试
- su - $USERNAME
- source ~/.bash_profile
- cd $ORACLE_BASE/oracle/product/11.2.0.4/client_1/network/admin
- touch tnsnames.ora
- echo 'ORATEST1 ='>>tnsnames.ora
- echo ' (DESCRIPTION = ' >>tnsnames.ora
- echo ' (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.75.249)(PORT = 1521)) ' >>tnsnames.ora
- echo ' (CONNECT_DATA = ' >>tnsnames.ora
- echo ' (SERVER = DEDICATED) ' >>tnsnames.ora
- echo ' (SERVICE_NAME = oratest1) ' >>tnsnames.ora
- echo ' ) ' >>tnsnames.ora
- echo ' ) ' >>tnsnames.ora
- EOF
- #生成卸载脚本
- touch /tmp/del_client.sh >/dev/null 2>&1
- echo "#!/bin/bash" >/tmp/del_client.sh
- echo "cd $LOCALDIR" >>/tmp/del_client.sh
- echo 'rm -rf client' >>/tmp/del_client.sh
- echo 'mv -f /etc/hosts_lihbbak /etc/hosts >/dev/null 2>&1' >>/tmp/del_client.sh
- echo 'mv -f client_install.rsp_lihbbak client_install.rsp >/dev/null 2>&1' >>/tmp/del_client.sh
- echo "rm -rf $ORACLE_BASE" >>/tmp/del_client.sh
- echo "mv -f /etc/oraInst.loc_lihbbak /etc/oraInst.loc >/dev/null 2>&1 " >>/tmp/del_client.sh
- chmod u+x /tmp/del_client.sh
- echo '#########################################################################'
- echo '###########please use root to run /tmp/del_client.sh to deinstall#######'
- echo "###########dba oinstall $USERNAME need your check################"
- echo '#########################################################################'
点击(此处)折叠或打开
- [root@localhost client]# cat client_install.rsp |grep -v ^# |grep -v ^$
- oracle.install.responseFileVersion=/oracle/install/rspfmt_clientinstall_response_schema_v11_2_0
- ORACLE_HOSTNAME=
- UNIX_GROUP_NAME=oinstall
- INVENTORY_LOCATION=/u01/app/oraInventory
- SELECTED_LANGUAGES=en
- ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/client_1
- ORACLE_BASE=/u01/app/oracle
- oracle.install.client.installType=Administrator
- oracle.install.client.upgrading=false
- oracle.install.client.customComponents="oracle.sqlj:11.2.0.4.0","oracle.rdbms.util:11.2.0.4.0","oracle.javavm.client:11.2.0.4.0","oracle.sqlplus:11.2.0.4.0","oracle.dbjava.jdbc:11.2.0.4.0","oracle.ldap.client:11.2.0.4.0","oracle.rdbms.oci:11.2.0.4.0","oracle.precomp:11.2.0.4.0","oracle.xdk:11.2.0.4.0","oracle.network.aso:11.2.0.4.0","oracle.assistants.oemlt:11.2.0.4.0","oracle.oraolap.mgmt:11.2.0.4.0","oracle.network.client:11.2.0.4.0","oracle.network.cman:11.2.0.4.0","oracle.network.listener:11.2.0.4.0","oracle.ordim.client:11.2.0.4.0","oracle.odbc:11.2.0.4.0","oracle.has.client:11.2.0.4.0","oracle.dbdev:11.2.0.4.0","oracle.rdbms.scheduler:11.2.0.4.0"
- oracle.install.client.schedulerAgentHostName=
- oracle.install.client.schedulerAgentPortNumber=
- oracle.installer.autoupdates.option=SKIP_UPDATES
- oracle.installer.autoupdates.downloadUpdatesLoc=
- AUTOUPDATES_MYORACLESUPPORT_USERNAME=
- AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
- PROXY_HOST=
- PROXY_PORT=
- PROXY_USER=
- PROXY_PWD=
- PROXY_REALM=
当前题目:rhel6.4自动安装oracle11g客户端
分享URL:http://ybzwz.com/article/geispd.html