一、部署Oracle环境,以及准备responseFile文件

1、环境部署请参考博客:https://blog.51cto.com/hnyuanzijian/2342205,此外还需要再创建目录和文件,并给与权限a、创建目录mkdir/u01/app/oracle/oraInventory-pmkdir/u01/app/oracle/fast_recovery_area-pchown-Roracle.oinstall/u01chmod-R775/u01b、新建文件[root@oracledb~]#vim/etc/oraInst.locinventory_loc=/u01/app/oracle/oraInventoryinst_group=oinstall2、主备responseFile文件,从Oracle软件中获取文件模板[root@oracledb~]#cd/opt/database/response/[root@oracledbresponse]#lsdbca.rspdb_install.rspnetca.rsp[root@oracledbresponse]#3、其中database是Oracle软件解压后生成的目录。在response目录下有三个模板,a、dbca.rsp是用来创建数据库的。b、db_install.rsp是用来安装Oracle软件的。c、netca.rsp是用来创建监听器的。当然也可在db_install.rsp中直接创建数据库。在这里,为求方便,我们选择db_install.rsp模板一并安装软件,创建数据库。

二、编辑responseFile文件

[root@oracledbresponse]#grep-Ev"^$|^#"db_install.rsporacle.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=EEoracle.install.db.EEOptionsSelection=falseoracle.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的安装组oinstalloracle.install.db.OPER_GROUP=oinstalloracle.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=falseoracle.install.db.config.starterdb.enableSecuritySettings=true#Oracle的所有用户密码,ALl填写的话,其他就不用填写了oracle.install.db.config.starterdb.password.ALL=oracleoracle.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_CONTROLoracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=oracle.install.db.config.starterdb.automatedBackup.enable=falseoracle.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_areaoracle.install.db.config.asm.diskGroup=oracle.install.db.config.asm.ASMSNMPPassword=MYORACLESUPPORT_USERNAME=MYORACLESUPPORT_PASSWORD=SECURITY_UPDATES_VIA_MYORACLESUPPORT=DECLINE_SECURITY_UPDATES=truePROXY_HOST=PROXY_PORT=PROXY_USER=PROXY_PWD=PROXY_REALM=COLLECTOR_SUPPORTHUB_URL=#Oracle忽略更新oracle.installer.autoupdates.option=SKIP_UPDATESoracle.installer.autoupdates.downloadUpdatesLoc=AUTOUPDATES_MYORACLESUPPORT_USERNAME=AUTOUPDATES_MYORACLESUPPORT_PASSWORD=

三、静默安装[root@oracledbresponse]$./runInstaller-help如果对runInstaller的参数不是很了解的话,可通过该命令进行查看。PreparingtolaunchOracleUniversalInstallerfrom/tmp/OraInstall2019-01-19_10-56-31PM.PleasewaitrunInstaller[-options][(<CommandLineVariable=Value>)*]Whereoptionsinclude:-clusterwareoracle.crs,<crsversion>VersionofClusterreadyservicesinstalled.-crsLocation<Path>Usedonlyforclusterinstalls,specifiesthepathtothecrshomelocation.Specifyingthisoinventory.-invPtrLoc<fullpathoforaInst.loc>Unixonly.Topointtoadifferentinventorylocation.Theorainst.locfilecontains:inventory_loc=<locationofcentralinventory>inst_group=<>-jreLoc<location>PathwhereJavaRuntimeEnvironmentisinstalled.OUIcannotberunwithoutit.-logLevel<level>Tofilterlogmessagesthathavealesserprioritylevelthan<level>.Validoptionsare:seve,basic,general,detailed,trace.Theuseofbasic,general,detailed,traceisdeprecated.-paramFile<locationoffile>Specifylocationoforaparam.inifiletobeusedbyOUI.-responseFile<Path>Specifiestheresponsefileandpathtouse.-attachHomeForattachinghomestotheOUIinventory.-cfsIndicatesthattheOraclehomespecifiedisonclusterfilesystem(shared).ThisismandatoryversalInstallercanregisterthehomeappropriatelyintotheinventory.-cloneFormakinganOracleHomecopymatchitscurrentenvironment.-debugForgettingthedebuginformationfromOUI.-detachHomeFordetachinghomesfromtheOUIinventorywithoutdeletinginventorydirectoryinsideOracle-enableRollingUpgradeUsedinclusterenvironment,toenableupgradeofaproductonasubsetofnodes(onwhichthe-executeSysPrereqsExecutesystempre-requisitechecksandexit.-forceAllowingsilentmodeinstallationintoanon-emptydirectory.-helpDisplaysaboveusage.-ignoreSysPrereqsForignoringtheresultsofthesystempre-requisitechecks.-localPerformstheoperationonthelocalnodeirrespectiveoftheclusternodesspecified.-printdiskusageLogdebuginformationfordiskusage.-printmemoryLogdebuginformationformemoryusage.-printtimeLogdebuginformationfortimeusage.-relinkForperformingrelinkactionsontheoraclehomeUsage:-relink-maketargetsxml<locationofmaketargetsxml>[-makedepsxml<locationofmakede-silentForsilentmodeoperations,theinputscanbearesponsefileoralistofcommandlinevariab-waitforcompletionInstallerwillwaitforcompletioninsteadofspawningthejavaengineandexiting.-suppressPreCopyScriptSuppresstheexecutionofprecopyscript.-acceptUntrustedCertificatesAcceptuntrustedcertificatesfromasecuresite.-suppressPostCopyScriptSuppresstheexecutionofpostcopyscript.-noconfigDonotexecuteconfigtools.-noconsoleForsuppressingdisplayofmessagestoconsole.Consoleisnotallocated.-formClusterToinstalltheOracleclusterwareinordertoformthecluster.-remotecp<Path>Unixspecificoption.Usedonlyforclusterinstalls,specifiesthepathtotheremotecopypr-remoteshell<Path>Unixspecificoption.Usedonlyforclusterinstalls,specifiesthepathtotheremoteshellp-executePrereqsToexecuteonlytheprerequisitechecks.-ignorePrereqToignorerunningtheprerequisitechecks.-ignoreInternalDriverErrorToignoreanyinternaldrivererrors.-downloadUpdatesTodownloadupdatesonly.-showProgressToshowtheinstallationprogressontheconsole.ThisoptionissupportedonlyincaseofsilCommandLineVariablesUsageCommandlinevariablesarespecifiedusing<name=value>;forexample:[session:|compName:|compName:version:]variableName="valueOfVariable"]Session/Installervariablesarespecifiedusing:[session:]varName=valueEx1:session:ORACLE_HOME_NAME="OraHome"Ex2:ORACLE_HOME_NAME="OraHome"Thelookuporderissession:varNamethenjustvarName.ThesessionprefixisusedtoavoidambiguiComponentvariablesarespecifiedusing:[compInternalName:[Version:]]varNameEx1:oracle.comp1:1.0.1:varName="VarValue"Ex2:oracle.comp1:varName="VarValue"ThelookuporderiscompInternalName:Version:varName,thencompInternalName:varName,thenjustvar./runInstaller-silent-igno

开始静默安装[oracle@oracledbdatabase]$./runInstaller-silent-ignoreSysPrereqs-showProgress-responseFile/home/oracle/db_install.rsp其中-silent指的是静默安装,-ignorePrereq忽略prerequisite的检查结果,showProgress显示进度,responseFile是种子文件。

[oracle@oracledbdatabase]$./runInstaller-silent-ignoreSysPrereqs-showProgress-responseFile/opt/database/response/db_install.rspStartingOracleUniversalInstaller...CheckingTempspace:mustbegreaterthan120MB.Actual20032MBPassedCheckingswapspace:mustbegreaterthan150MB.Actual4095MBPassedPreparingtolaunchOracleUniversalInstallerfrom/tmp/OraInstall2019-01-19_11-13-22PM.Pleasewait...[oracle@oracledbdatabase]$[WARNING][INS-32055]TheCentralInventoryislocatedintheOraclebase.CAUSE:TheCentralInventoryislocatedintheOraclebase.ACTION:OraclerecommendsplacingthisCentralInventoryinalocationoutsidetheOraclebasedirectory.[WARNING][INS-13014]Targetenvironmentdonotmeetsomeoptionalrequirements.CAUSE:Someoftheoptionalprerequisitesarenotmet.Seelogsfordetails./tmp/OraInstall2019-01-19_11-13-22PM/installActions2019-01-19_11-13-22PM.logACTION:Identifythelistoffailedprerequisitechecksfromthelog:/tmp/OraInstall2019-01-19_11-13-22PM/installActions2019-01-19_11-13-22PM.log.Theneitherfromthelogfileorfrominstallationmanualfindtheappropriateconfigurationtomeettheprerequisitesandfixitmanually.Youcanfindthelogofthisinstallsessionat:/u01/app/oracle/oraInventory/logs/installActions2019-01-19_11-13-22PM.log[oracle@oracledbdatabase]$Prepareinprogress...................................................9%Done.Preparesuccessful.Copyfilesinprogress...................................................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...............................Copyfilessuccessful.Linkbinariesinprogress...........Linkbinariessuccessful.Setupfilesinprogress...................................................88%Done...................................................94%Done.Setupfilessuccessful.TheinstallationofOracleDatabase11gwassuccessful.Pleasecheck'/u01/app/oracle/oraInventory/logs/silentInstall2019-01-19_11-13-22PM.log'formoredetaiExecuteRootScriptsinprogress.Asarootuser,executethefollowingscript(s):1./u01/app/oracle/oraInventory/orainstRoot.sh2./u01/app/oracle/product/11.2.0/dbhome_1/root.sh..................................................100%Done.ExecuteRootScriptssuccessful.

最后,需root用户手动执行以下两个文件:1./u01/app/oracle/oraInventory/orainstRoot.sh2./u01/app/oracle/product/11.2.0/dbhome_1/root.sh当然,也可查看/u01/app/oracle/oraInventory/logs/installActions2015-04-01_10-13-42PM.log了解具体的安装信息。

四、配置网络[oracle@oracledbdatabase]$netca-silent-responsefile/opt/database/response/netca.rsp

五、安装Oracle数据库实例[oracle@oracledbdatabase]$dbca-silent-createDatabase-templateNameGeneral_Purpose.dbc-gdbnameoracledb.newcapec.net-sidoracledb-sysPasswordoracle-systemPasswordoracle-responseFileNO_VALUE-datafileDestination/u01/app/oracle/oradata/-redoLogFileSize50-recoveryAreaDestination/u01/app/flash_recovery_area-storageTypeFS-characterSetZHS16GBK-nationalCharacterSetAL16UTF16-sampleSchematrue-memoryPercentage40-totalMemory1530-databaseTypeOLTP-emConfigurationNONE

六、检查实例ps-ef|grepora_|grep-vgrep|wc-lps-ef|grepora_|grep-vgrep