1、部署Oracle環境,以及準備responseFile文件
一、環境部署請參考博客: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 二、主備responseFile文件,從Oracle軟件中獲取文件模板 [root@oracledb ~]# cd /opt/database/response/ [root@oracledb response]# ls dbca.rsp db_install.rsp netca.rsp [root@oracledb response]# 三、其中database是Oracle軟件解壓後生成的目錄。在response目錄下有三個模板, a、dbca.rsp是用來建立數據庫的。 b、db_install.rsp是用來安裝Oracle軟件的。 c、netca.rsp是用來建立監聽器的。 固然也可在db_install.rsp中直接建立數據庫。在這裏,爲求方便,咱們選擇db_install.rsp模板一併安裝軟件,建立數據庫。
2、編輯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=
3、 靜默安裝 [root@oracledb response]$ ./runInstaller -help 若是對runInstaller的參數不是很瞭解的話,可經過該命令進行查看。 Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-01-19_10-56-31PM. Please wait runInstaller [-options] [(<CommandLineVariable=Value>)*] Where options include: -clusterware oracle.crs,<crs version> Version of Cluster ready services installed. -crsLocation <Path> Used only for cluster installs, specifies the path to the crs home location. Specifying this o inventory. -invPtrLoc <full path of oraInst.loc> Unix only. To point to a different inventory location. The orainst.loc file contains: inventory_loc=<location of central inventory> inst_group=<> -jreLoc <location> Path where Java Runtime Environment is installed. OUI cannot be run without it. -logLevel <level> To filter log messages that have a lesser priority level than <level>. Valid options are: seve, basic, general, detailed, trace. The use of basic, general, detailed, trace is deprecated. -paramFile <location of file> Specify location of oraparam.ini file to be used by OUI. -responseFile <Path> 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 <location of maketargetsxml> [-makedepsxml <location of makede -silent For silent mode operations, the inputs can be a response file or a list of command line variab -waitforcompletion Installer will wait for completion instead of spawning the java engine and exiting. -suppressPreCopyScript Suppress the execution of precopy script. -acceptUntrustedCertificates Accept untrusted certificates from a secure site. -suppressPostCopyScript Suppress the execution of postcopy script. -noconfig Do not execute config tools. -noconsole For suppressing display of messages to console. Console is not allocated. -formCluster To install the Oracle clusterware in order to form the cluster. -remotecp <Path> Unix specific option. Used only for cluster installs, specifies the path to the remote copy pr -remoteshell <Path> 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 <name=value>; 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瞭解具體的安裝信息。
4、配置網絡 [oracle@oracledb database]$netca -silent -responsefile /opt/database/response/netca.rsp
5、安裝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
6、檢查實例 ps -ef | grep ora_ | grep -v grep | wc -l ps -ef | grep ora_ | grep -v grep