静默安装ORACLE数据库软件

用响应文件,加快安装oracleDB 软件

1.指定DBNAME和版本号

     ORACLE_BASE=/oracle/DBNAME

     ORACLE_HOME=/oracle/DBNAME/版本号

2.响应文件手动生成

3.oracle的安装目录指定为/oracle/database/

以下是脚本

#!/bin/bash
#############################################
#
#  Script to create oracle id and set id environment
#  
#  $1 : ORACLE_SID   $2  : ORACLE VERION 112 121 122 180 193
#
#############################################
check_inventroy()
{
 if  [ -f $oldbinventory ]
     then
        rm -rf $oldbinventory
 fi
 cp $dbinventory $oldbinventory
 chown $oracle_sid:dba $oldbinventory
 chmod 775 $oldbinventory
 rm -rf $dbinventory
 cat $oldbinventory |grep -v $ORACLE_BASE >$dbinventory
 chown $oracle_sid:dba $dbinventory
 chmod 775 $dbinventory
}


if [ $# -ne 2 ]
then
 echo "==========================================================================================="
 echo
 echo "====This is generate oracle install rsp file                                          ====="
 echo
 echo "====parm 1:is oralce_SID                                                              ====="
 echo
 echo "====parm 2:is oralce version 112,122,121,180,193                                      ====="
 echo
 echo "==========================================================================================="
 exit 8
fi
oracle_sid=$1
ORACLE_SID=$(echo $1|tr 'a-z' 'A-Z')
oraver=$2
oracle_sid=$(echo $1|tr 'A-Z' 'a-z')
rspfile="/tmp/""$oracle_sid""_dbswonly_""$oraver.rsp"
echo $rspfile
lisport=$((1000+$oraver))

if [ -f $rspfile ]
    then
    rm -rf $rspfile
fi
echo "oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0" >> $rspfile
echo "oracle.install.option=INSTALL_DB_SWONLY"                                                        >> $rspfile
echo "ORACLE_HOSTNAME=$(hostname)"                                                                 >> $rspfile
echo "UNIX_GROUP_NAME=dba"                                                                         >> $rspfile
ORACLE_BASE=/oracle/$oracle_sid
echo "INVENTORY_LOCATION=/oracle/oraInventory"                                                     >> $rspfile
echo "SELECTED_LANGUAGES=en"                                                                       >> $rspfile
echo "ORACLE_HOME=$ORACLE_BASE/$oraver"                                                            >> $rspfile
echo "ORACLE_BASE=/oracle/$oracle_sid"                                                             >> $rspfile
echo "oracle.install.db.InstallEdition=EE"                                                         >> $rspfile
echo "oracle.install.db.isCustomInstall=false"                                                     >> $rspfile
echo "oracle.install.db.DBA_GROUP=dba"                                                             >> $rspfile
echo "oracle.install.db.OPER_GROUP=dba"                                                            >> $rspfile
echo "oracle.install.db.config.starterdb.type=GENERAL_PURPOSE"                                     >> $rspfile
echo "oracle.install.db.config.starterdb.globalDBName=$oracle_sid.inno.com"                        >> $rspfile
echo "oracle.install.db.config.starterdb.SID=$oracle_sid"                                          >> $rspfile
echo "oracle.install.db.config.starterdb.characterSet=AL32UTF8"                                    >> $rspfile
echo "oracle.install.db.config.starterdb.memoryLimit=3124"                                         >> $rspfile
echo "oracle.install.db.config.starterdb.memoryOption=true"                                        >> $rspfile
echo "oracle.install.db.config.starterdb.installExampleSchemas=true"                               >> $rspfile
echo "oracle.install.db.config.starterdb.enableSecuritySettings=true"                              >> $rspfile
echo "oracle.install.db.config.starterdb.control=DB_CONTROL"                                       >> $rspfile
echo "oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false"                  >> $rspfile
echo "oracle.install.db.config.starterdb.automatedBackup.enable=false"                             >> $rspfile
echo "oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE"                          >> $rspfile
echo "SECURITY_UPDATES_VIA_MYORACLESUPPORT=false"                                                  >> $rspfile
echo "DECLINE_SECURITY_UPDATES=true"                                                               >> $rspfile

oracle_out=/tmp/oracle_inst.out
if [ -f $oracle_out ]
   then 
     rm -rf $oracle_out
fi

chown $oracle_sid:dba $rspfile
chmod 775 $rspfile
echo -e "    \033[34mInstallNotice >>\033[0m \033[32moracle start install withe responseFile $rspfile\033[05m...\033[0m"
cd $ORACLE_BASE
dbinventory=$(echo $ORACLE_BASE|cut -d "/" -f 1-2)"/oraInventory/ContentsXML/inventory.xml"
oldbinventory=$dbinventory"backup"
if [ -f $dbinventory ]
    then
    check_inventroy
fi
su - $oracle_sid -c "/oracle/database/runInstaller -silent -force -noconfig -responseFile $rspfile "  1> ${oracle_out}

echo -e "    \033[34mInstallNotice >>\033[0m \033[32moracle install starting \033[05m...\033[0m"
progresswait.sh
/oracle/${oracle_sid}/${oraver}/root.sh
View Code

 

posted on 2020-10-21 23:38  InnoLeo  阅读(195)  评论(0编辑  收藏  举报