Rhel6.4 automatically installs oracle 11g client
1. Installation process
Click (here) to collapse or open
[root@localhost] # cd / tmp/client/ [root@localhost client] # lltotal 640676 Murray RW Murray. 1 root root 5554 Dec 13 16:24 auto_install_oracle_client.sh # main script-rw-r--r--. 1 root root 12062 Dec 13 16:24 client_install.rsp # Silent installation profile-rw-r--r--. 1 root root 656026876 Dec 13 16:22 p13390677_112040_Linux-x86-64_4of7.zip # installation package [root@localhost client] # chmod uplink auto_install_oracle_client.sh # entitles [root@localhost client] #. / auto_install_oracle_client.sh # to execute tmp is.. using the root user in the path where the file is located . [ok] # check the / tmp directory, which needs to be greater than 120 MBswap is... [ok] # check swap space, need to be greater than 150 MBfinding sqlplus # find sqlplus through find, wait for env is... here [ok] # Environment okpkg is... [ok] # installation package okrsp is... [ok] # Silent installation profile okplease input which user to install oracle client:oracle # can be an existing user or a new user please input ip addr:192.168.1.222 # enter the system ip address unziping p13390677_112040_Linux-x86-64_4of7.zip # to extract the installation package Need to wait here for starting install,may be take a minutes,you can see log:/tmp/install_client.log # need to wait for starting orainstRoot.sh You can see / tmp/orainstRoot.sh.logThe execution of the script is complete.####please use root to run / tmp/del_client.sh to deinstall# # Uninstall script # dba oinstall oracle need your check# # if necessary Users and groups need to manually delete # 2. Verification process
Click (here) to collapse or open
[root@localhost client] # su-oracle [oracle@localhost ~] $cd $ORACLE_HOME/network/admin/ [Oracle @ localhost admin] $vi tnsnames.ora [oracle@localhost admin] $cat tnsnames.oraORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.42) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) [oracle@localhost admin] $sqlplus scott/tiger@orclSQL > 3, Uninstall process (user groups and users need to be manually deleted according to actual needs)
Click (here) to collapse or open
[root@localhost client] # / tmp/del_ client.sh [root @ localhost client] # su-oracle [oracle@localhost ~] $sqlplus-bash: sqlplus: command not found
The content of auto_install_oracle_client.sh:
Click (here) to collapse or open
#! / bin/bash# check / tmp space if [`df-m / tmp | wc-l`-eq 2]; thentmp= `df-m / tmp | tail-1 | awk'{print $4} '`elsetmp= `df-m / tmp | tail-1 | awk' {print $3} '`fiif [$tmp-gt 120]; thenecho "tmp is... [ok] "elseecho" [fail] = > / tmp must more than 120MB "exit 5fi# checks swap space if [`print-m | grep Swap | awk'{print $2}'`- gt 150]; thenecho" swap is... [ok] "elseecho" [fail] = = > swap must more than 150MB "exit 5fi# check whether the host has installed sqlplusecho" finding sqlplus "if [`find /-name" sqlplus "| grep sqlplus | wc-l`-gt 0] thenecho" this system has installed oracle client.install process exit! "echo" install process stop! "exit 0elseecho" env is... [ok] "fi# checks whether the client installation package has been uploaded LOCALDIR= `pwd`if [`pwd`if [`pwd`LOCALDIR | grep" p13390677_112040_Linux-x86-64_4of7.zip "| wc-l`-gt 0] thenecho" pkg is... [ok] "elseecho" please upload p13390677_112040_Linux-x86-64_4of7.zip in $LOCALDIR "echo" install process stop! "exit 0fi# checks whether the configuration file has been uploaded LOCALDIR= `pwd`if [`pwd`if [`pwd`if-l $LOCALDIR | grep client_install.rsp | wc-l`-gt 0] thenecho" rsp is... [ok] "elseecho" please upload client_install.rsp in $LOCALDIR "echo" install process stop! "exit 0fi# gets the user name, ORACLE_BASE, Ip address information echo-e "please input which user to install oracle client:\ c" read USERNAMEORACLE_BASE=/home/$USERNAME/oracle_clientecho-e "please input ip addr:\ c" read ip_addr# backup and modify / etc/hosts file cp / etc/hosts / etc/hosts_lihbbakecho "$ip_addr `hostname`" > > / etc/hosts# backup oraInst.loc file mv-f / etc/oraInst.loc / etc/oraInst.loc_lihbbak > / dev/null 2 > & create dba, oinstall user groups Create user / 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 > & create a directory and attach the right mkdir-p $ORACLE_BASE > / dev/null 2 > & 1cd $ORACLE_BASEmkdir oraInventorychown-R $USERNAME:oinstall $ORACLE_BASE# extract the installation package and attach the right echo "unziping p13390677_112040_Linux-x86-64_4of7.zip" cd $LOCALDIR/ Usr/bin/unzip p13390677_112040_Linux-x86-64_4of7.zip > / dev/null 2 > & 1chown-R $USERNAME:oinstall clientchown $USERNAME:oinstall client_install.rsp# back up and modify the configuration file cp client_install.rsp client_install.rsp_lihbbaksed-I "s | / u01/app | $ORACLE_BASE | g" client_install.rsp# configure the user environment and install the software echo "starting install May be take a minutes You can see log:/tmp/install_client.log "su-$USERNAME > / home/$USERNAME/.bash_profileecho" export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0.4/client_1 "> > / home/$USERNAME/.bash_profileecho 'export PATH=\ $ORACLE_HOME/bin:\ $PATH' > > / home/$USERNAME/.bash_profileecho' export LD_LIBRARY_PATH=$ORACLE_BASE/oracle/product/11.2.0.4/client_1/lib' > > / home/$USERNAME/.bash _ profilesource ~ / .bash_profile > / dev/null 2 > & 1cd $LOCALDIR/client./runInstaller-silent-showProgress-ignorePrereq-waitforcompletion-responseFile $LOCALDIR/client_install.rspEOF# execute the root.sh script sleep 2secho "starting orainstRoot.sh" You can see / tmp/orainstRoot.sh.log "$ORACLE_BASE/oraInventory/orainstRoot.sh > / tmp/orainstRoot.sh.log 2 > & 1tail-1 / tmp/orainstRoot.sh.log# modify the permissions of ORACLE_HOME/bin chmod $ORACLE_BASE/oracle/product/11.2.0.4/client_1/bin/*# configuration tnsnames.ora file is used to test su-$USERNAME > tnsnames.oraecho'(DESCRIPTION ='> > tnsnames.oraecho'(ADDRESS = (PROTOCOL = TCP) (HOST = 192) .168.75.249) (PORT = 1521)'> tnsnames.oraecho'(CONNECT_DATA ='> > tnsnames.oraecho'(SERVER = DEDICATED)'> > tnsnames.oraecho'(SERVICE_NAME = oratest1)'> tnsnames.oraecho')'> > tnsnames.oraecho')'> tnsnames.oraEOF# generation uninstall script touch / tmp/del_client.sh > / dev/null 2 > & 1echo "#! / bin/bash" > / tmp/del_client.shecho "cd $LOCALDIR" > / tmp/ Del_client.shecho'rm-rf client' > > / tmp/del_client.shecho'mv-f / etc/hosts_lihbbak / etc/hosts > / dev/null 2 > & 1'> > / tmp/del_client.shecho'mv-f client_install.rsp_lihbbak client_install.rsp > / dev/null 2 > & 1'> > / tmp/del_client.shecho "rm-rf $ORACLE_BASE" > > / tmp/del_client.shecho "mv-f / etc/oraInst.loc_lihbbak / etc/oraInst. Loc > / dev/null 2 > & 1 "> / tmp/del_client.shchmod uplix / tmp/del_client.shecho'# 'echo' # please use root to Run / tmp/del_client.sh to deinstall#'echo "# dba oinstall $USERNAME need your check#" echo'# # 'content of client_install.rsp:
Click (here) to collapse or open
[root@localhost client] # cat client_install.rsp | grep-v ^ # | grep-v ^ $oracle.install.responseFileVersion=/oracle/install/rspfmt_clientinstall_response_schema_v11_2_0ORACLE_HOSTNAME=UNIX_GROUP_NAME=oinstallINVENTORY_LOCATION=/u01/app/oraInventorySELECTED_LANGUAGES=enORACLE_HOME=/u01/app/oracle/product/11.2.0.4/client_1ORACLE_BASE=/u01/app/oracleoracle.install.client.installType=Administratororacle.install.client.upgrading=falseoracle.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_UPDATESoracle.installer.autoupdates.downloadUpdatesLoc=AUTOUPDATES_MYORACLESUPPORT_USERNAME=AUTOUPDATES_MYORACLESUPPORT_PASSWORD=PROXY_HOST=PROXY_PORT=PROXY_USER=PROXY_PWD=PROXY_REALM=