一、部署Oracle环境,以及准备responseFile文件
1、环境部署请参考博客:https://blog.51cto.com/hnyuanzijian/2342205,此外还需要再创建目录和文件,并给与权限 a、创建目录 mkdir /u01/app/oracle/oraInventory -p mkdir /u01/app/oracle/fast_recovery_area -p chown -R oracle.oinstall /u01 chmod -R 775 /u01 b、新建文件 [root@oracledb ~]# vim /etc/oraInst.loc inventory_loc=/u01/app/oracle/oraInventory inst_group=oinstall 2、主备responseFile文件,从Oracle软件中获取文件模板 [root@oracledb ~]# cd /opt/database/response/ [root@oracledb response]# ls dbca.rsp db_install.rsp netca.rsp [root@oracledb response]# 3、其中database是Oracle软件解压后生成的目录。在response目录下有三个模板, a、dbca.rsp是用来创建数据库的。 b、db_install.rsp是用来安装Oracle软件的。 c、netca.rsp是用来创建监听器的。 当然也可在db_install.rsp中直接创建数据库。在这里,为求方便,我们选择db_install.rsp模板一并安装软件,创建数据库。
二、编辑responseFile文件
[root@oracledb response]# grep -Ev "^$|^#" db_install.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 #选择安装数据库软件 oracle.install.option=INSTALL_DB_SWONLY #数据库服务器的主机名 ORACLE_HOSTNAME=oracledb.newcapec.net #Oracle用户组 UNIX_GROUP_NAME=oinstall #Oracle环境路径 INVENTORY_LOCATION=/u01/app/oracle/oraInventory #Oracle安装语言 SELECTED_LANGUAGES=en #ORACLE_HOME目录 ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 #ORACLE_BASE目录 ORACLE_BASE=/u01/app/oracle #Oracle安装版本,企业版 oracle.install.db.InstallEdition=EE oracle.install.db.EEOptionsSelection=false oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0 #Oracle管理员DBA组 oracle.install.db.DBA_GROUP=dba #Oracle的安装组oinstall oracle.install.db.OPER_GROUP=oinstall oracle.install.db.CLUSTER_NODES= oracle.install.db.isRACOneInstall= oracle.install.db.racOneServiceName= #Oracle的一般用途 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE #Oracle的服务名 oracle.install.db.config.starterdb.globalDBName=oracledb.newcapec.net #Oracle实例名 oracle.install.db.config.starterdb.SID=oracledb #Oracle字符集 oracle.install.db.config.starterdb.characterSet=ZHS16GBK #Oracle内存管理模式 oracle.install.db.config.starterdb.memoryOption=true #Oracle的内存限制,内存*80% oracle.install.db.config.starterdb.memoryLimit=1536 #Oracle的示例 oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.enableSecuritySettings=true #Oracle的所有用户密码,ALl填写的话,其他就不用填写了 oracle.install.db.config.starterdb.password.ALL=oracle oracle.install.db.config.starterdb.password.SYS= oracle.install.db.config.starterdb.password.SYSTEM= oracle.install.db.config.starterdb.password.SYSMAN= oracle.install.db.config.starterdb.password.DBSNMP= oracle.install.db.config.starterdb.control=DB_CONTROL oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL= oracle.install.db.config.starterdb.automatedBackup.enable=false oracle.install.db.config.starterdb.automatedBackup.osuid= oracle.install.db.config.starterdb.automatedBackup.ospwd= #Oracle文件系统类型 oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE #Oracle的日志目录 oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/app/oracle/oraInventory #Oracle快速恢复区 oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u01/app/oracle/fast_recovery_area oracle.install.db.config.asm.diskGroup= oracle.install.db.config.asm.ASMSNMPPassword= MYORACLESUPPORT_USERNAME= MYORACLESUPPORT_PASSWORD= SECURITY_UPDATES_VIA_MYORACLESUPPORT= DECLINE_SECURITY_UPDATES=true PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PWD= PROXY_REALM= COLLECTOR_SUPPORTHUB_URL= #Oracle忽略更新 oracle.installer.autoupdates.option=SKIP_UPDATES oracle.installer.autoupdates.downloadUpdatesLoc= AUTOUPDATES_MYORACLESUPPORT_USERNAME= AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
三、 静默安装 [root@oracledb response]$ ./runInstaller -help 如果对runInstaller的参数不是很了解的话,可通过该命令进行查看。 Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-01-19_10-56-31PM. Please wait runInstaller [-options] [()*] Where options include: -clusterware oracle.crs, Version of Cluster ready services installed. -crsLocation Used only for cluster installs, specifies the path to the crs home location. Specifying this o inventory. -invPtrLoc Unix only. To point to a different inventory location. The orainst.loc file contains: inventory_loc= inst_group=<> -jreLoc Path where Java Runtime Environment is installed. OUI cannot be run without it. -logLevel To filter log messages that have a lesser priority level than . Valid options are: seve, basic, general, detailed, trace. The use of basic, general, detailed, trace is deprecated. -paramFile Specify location of oraparam.ini file to be used by OUI. -responseFile Specifies the response file and path to use. -attachHome For attaching homes to the OUI inventory. -cfs Indicates that the Oracle home specified is on cluster file system (shared). This is mandatoryversal Installer can register the home appropriately into the inventory. -clone For making an Oracle Home copy match its current environment. -debug For getting the debug information from OUI. -detachHome For detaching homes from the OUI inventory without deleting inventory directory inside Oracle -enableRollingUpgrade Used in cluster environment, to enable upgrade of a product on a subset of nodes (on which the -executeSysPrereqs Execute system pre-requisite checks and exit. -force Allowing silent mode installation into a non-empty directory. -help Displays above usage. -ignoreSysPrereqs For ignoring the results of the system pre-requisite checks. -local Performs the operation on the local node irrespective of the cluster nodes specified. -printdiskusage Log debug information for disk usage. -printmemory Log debug information for memory usage. -printtime Log debug information for time usage. -relink For performing relink actions on the oracle home Usage: -relink -maketargetsxml [-makedepsxml Unix specific option. Used only for cluster installs, specifies the path to the remote copy pr -remoteshell Unix specific option. Used only for cluster installs, specifies the path to the remote shell p -executePrereqs To execute only the prerequisite checks. -ignorePrereq To ignore running the prerequisite checks. -ignoreInternalDriverError To ignore any internal driver errors. -downloadUpdates To download updates only. -showProgress To show the installation progress on the console. This option is supported only in case of sil Command Line Variables Usage Command line variables are specified using ; for example: [ session: | compName: | compName:version: ]variableName=" valueOfVariable"] Session/Installer variables are specified using: [session:]varName=value Ex 1: session:ORACLE_HOME_NAME="OraHome" Ex 2: ORACLE_HOME_NAME="OraHome" The lookup order is session:varName then just varName. The session prefix is used to avoid ambigui Component variables are specified using: [compInternalName:[Version:]]varName Ex 1: oracle.comp1:1.0.1:varName="VarValue" Ex 2: oracle.comp1:varName="VarValue" The lookup order is compInternalName:Version:varName, then compInternalName:varName, then just var ./runInstaller -silent -igno
开始静默安装 [oracle@oracledb database]$ ./runInstaller -silent -ignoreSysPrereqs -showProgress -responseFile /home/oracle/db_install.rsp 其中-silent指的是静默安装,-ignorePrereq忽略prerequisite的检查结果,showProgress显示进度,responseFile是种子文件。
[oracle@oracledb database]$ ./runInstaller -silent -ignoreSysPrereqs -showProgress -responseFile /opt/database/response/db_install.rsp Starting Oracle Universal Installer... Checking Temp space: must be greater than 120 MB. Actual 20032 MB Passed Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-01-19_11-13-22PM. Please wait ...[oracle@oracledb database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base. CAUSE: The Central Inventory is located in the Oracle base. ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory. [WARNING] [INS-13014] Target environment do not meet some optional requirements. CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2019-01-19_11-13-22PM/installActions2019-01-19_11-13-22PM.log ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2019-01-19_11-13-22PM/installActions2019-01-19_11-13-22PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually. You can find the log of this install session at: /u01/app/oracle/oraInventory/logs/installActions2019-01-19_11-13-22PM.log [oracle@oracledb database]$ Prepare in progress. .................................................. 9% Done. Prepare successful. Copy files in progress. .................................................. 14% Done. .................................................. 20% Done. .................................................. 26% Done. .................................................. 31% Done. .................................................. 36% Done. .................................................. 41% Done. .................................................. 46% Done. .................................................. 51% Done. .................................................. 56% Done. .................................................. 63% Done. .................................................. 68% Done. .................................................. 73% Done. .................................................. 78% Done. .................................................. 83% Done. .............................. Copy files successful. Link binaries in progress. .......... Link binaries successful. Setup files in progress. .................................................. 88% Done. .................................................. 94% Done. Setup files successful. The installation of Oracle Database 11g was successful. Please check '/u01/app/oracle/oraInventory/logs/silentInstall2019-01-19_11-13-22PM.log' for more detai Execute Root Scripts in progress. As a root user, execute the following script(s): 1. /u01/app/oracle/oraInventory/orainstRoot.sh 2. /u01/app/oracle/product/11.2.0/dbhome_1/root.sh .................................................. 100% Done. Execute Root Scripts successful.
最后,需root用户手动执行以下两个文件: 1. /u01/app/oracle/oraInventory/orainstRoot.sh 2. /u01/app/oracle/product/11.2.0/dbhome_1/root.sh 当然,也可查看/u01/app/oracle/oraInventory/logs/installActions2015-04-01_10-13-42PM.log了解具体的安装信息。
四、配置网络 [oracle@oracledb database]$netca -silent -responsefile /opt/database/response/netca.rsp
五、安装Oracle数据库实例 [oracle@oracledb database]$dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname oracledb.newcapec.net -sid oracledb -sysPassword oracle -systemPassword oracle -responseFile NO_VALUE -datafileDestination /u01/app/oracle/oradata/ -redoLogFileSize 50 -recoveryAreaDestination /u01/app/flash_recovery_area -storageType FS -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -memoryPercentage 40 -totalMemory 1530 -databaseType OLTP -emConfiguration NONE
六、检查实例 ps -ef | grep ora_ | grep -v grep | wc -l ps -ef | grep ora_ | grep -v grep