静默安装
经常搭建Oracle测试环境,有时候觉得OUI(即图形界面)方式甚是繁琐,你得一步一步进行确认,所幸,Oracle支持静默安装。在我看来,它主要有两方面的好处:一、极大地提升了效率,尤其是批量安装。二、很多时候,只有终端环境可供使用。
一、准备responsefile文件
从Oracle软件中获取文件模板
[oracle@node2 ~]$ cd database/response/dbca.rsp db_install.rsp netca.rsp
其中database是Oracle软件解压后生成的目录。可见在response目录下有三个模板,其中dbca.rsp是用来创建数据库的。db_install.rsp是用来安装Oracle软件的。netca.rsp是用来创建监听器的。当然也可在db_install.rsp中直接创建数据库。在这里,为求方便,我们选择db_install.rsp模板一并安装软件,创建数据库。
二、编辑responsefile文件
[oracle@node2 ~]$ grep -Ev "^$|^#" db_install.rsp oracle.install.responseFiLeversion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0oracle.install.option=INSTALL_DB_AND_CONfigORACLE_HOSTname=node2.being.comUNIX_GROUP_nameoinstallINVENTORY_LOCATION=/u01/app/oracle/oraInventorySELECTED_LANGUAGES=enORACLE_HOME=/u01/app/oracle/product/11.2.0.1/db_1ORACLE_BASE=/u01/app/oracleoracle.install.db.InstallEditionEEoracle.install.db.EEOptionsSelectionfalseoracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:0oracle.install.db.DBA_GROUP=dbaoracle.install.db.OPER_GROUPoperoracle.install.db.CLUSTER_NODESoracle.install.db.isRACOneInstalloracle.install.db.racOneservicename=oracle.install.db.config.starterdb.type=GENERAL_PURPOSEoracle.install.db.config.starterdb.globalDBname=orcloracle.install.db.config.starterdb.SIDoracle.install.db.config.starterdb.characterSet=AL32UTF8oracle.install.db.config.starterdb.memoryOption=trueoracle.install.db.config.starterdb.memorylimit=400oracle.install.db.config.starterdb.installExampleSchemasfalseoracle.install.db.config.starterdb.enableSecuritySettingstrueoracle.install.db.config.starterdb.password.ALL=oracleoracle.install.db.config.starterdb.password.SYSoracle.install.db.config.starterdb.password.SYstemoracle.install.db.config.starterdb.password.SYSMANoracle.install.db.config.starterdb.password.DBSNMPoracle.install.db.config.starterdb.controlDB_CONTRoloracle.install.db.config.starterdb.grIDcontrol.grIDControlServiceURLoracle.install.db.config.starterdb.automatedBackup.enablefalseoracle.install.db.config.starterdb.automatedBackup.osuIDoracle.install.db.config.starterdb.automatedBackup.ospwdoracle.install.db.config.starterdb.storageType=file_SYstem_STORAGEoracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/app/oracle/oradataoracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u01/app/oracle/fast_recovery_areaoracle.install.db.config.asm.diskGrouporacle.install.db.config.asm.ASMSNMPPasswordMYORACLESUPPORT_USERnameMYORACLESUPPORT_PASSWORDSecurity_UPDATES_VIA_MYORACLESUPPORTDECliNE_Security_UPDATES=truePROXY_HOSTPROXY_PORTPROXY_USERPROXY_PWDPROXY_REALMColLECTOR_SUPPORTHUB_URLoracle.installer.autoupdates.option=SKIP_UPDATESoracle.installer.autoupdates.downloadUpdatesLocautoUPDATES_MYORACLESUPPORT_USERnameautoUPDATES_MYORACLESUPPORT_PASSWORD=
注意部分如上所示,关于每个参数的说明,可参考模板中的解释。
三、 静默安装
[oracle@node2 database]$ ./runInstaller -help
如果对runInstaller的参数不是很了解的话,可通过该命令进行查看。
[oracle@node2 database]$ ./runInstaller -helpPreparing to launch Oracle Universal Installer from /tmp/OraInstall2015-04-01_1005-47PM. Please wait ...]$ Usage: 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 overrIDes CRS information obtained from central 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 inventoryinst_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 >. ValID options are: severe,warning,info,config,fine,finer,finest,basic,general,detailed,trace. The use of basic,trace deprecated. -paramfile <location of file Specify location of oraparam.ini 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 mandatory when '-local' is specifIEd so that Oracle Universal 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 detachHome For detaching homes the OUI inventory without deleting inventory directory insIDe Oracle home. enableRollingUpgrade Used in cluster environment,to enable upgrade of a product on a subset of nodes (on which the product was installed). executeSysPrereqs Execute system pre-requisite checks and exitforce Allowing silent mode installation into a nonempty directory. help displays above usage. ignoreSysPrereqs For ignoring the results of the system prerequisite checks. local Performs the operation on the local node irrespective the cluster nodes specifIEd. printdiskusage Log deBUG information for disk usage. printmemory for memory usage. printtime time usage. relink For performing relink actions the oracle home Usage: -relink -maketargetsxml of maketargetsxml> -makedepsxml <location of makedepsxml>name=value] silent For silent mode operations,the inputs can be a response or a List command line variable value pairs. waitforcompletion Installer will wait for completion instead of spawning the java engine and exiting. suppressprecopyScript Suppress the execution precopy script. acceptUntrustedCertificates Accept untrusted certificates a secure site. suppresspostcopyScript Suppress the execution 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 form the cluster. -remotecp Unix specific option. Used to the remote copy program the local cluster node. -remoteshell to the remote shell program 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 showProgress To show the installation progress on the console. This option is supported only in case silent installation.Command line Variables Usage Command line variables are specifIEd using <name=value>; example: session: | compname: | compname:version: ]variablename" valueOfVariable"] SessionInstaller variables are specifIEd using: session:]varnamevalue Ex 1: session:ORACLE_HOME_name"OraHome" Ex 2: ORACLE_HOME_name"OraHome" The lookup is session:varname then just varname. The session prefix is used avoID ambiguity. 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 is compInternalname:Version:varname,1)">then compInternalname:varname,1)">then just varname.
开始静默安装
[oracle@node2 database]$ ./runInstaller -silent -ignoreSysPrereqs -showProgress -responsefile /home/oracle/db_install.rsp
其中-silent指的是静默安装,-ignorePrereq忽略prerequisite的检查结果,showProgress显示进度,responsefile是种子文件。
-silent -ignorePrereq -showProgress /home/oracledb_install.rsp Starting Oracle Universal Installer...Checking Temp space: must be greater than 120 MB. Actual 3073 MB PassedChecking swap 150 MB. Actual 3999 MB PassedPreparing 13-42PM. Please wait ...]$ WARNINGINS-32055] The Central Inventory is located in the Oracle base. CAUSE: The Central Inventory the Oracle base. ACTION: Oracle recommends placing this Central Inventory a location outsIDe the Oracle base directory.INS-30011] The admin password entered does not conform the Oracle recommended standards. CAUSE: Oracle recommends that the password entered should be at least 8 characters in length,contain at least 1 uppercase character,1); Font-weight: bold">1 lower character and 1 digit 0-9. ACTION: ProvIDe a password that conforms the Oracle recommended standards.You can find the log this install session at: /u01/app/oraInventory/logs/installActions2015-42PM.logPrepare progress................................................... 8% Done.Prepare successful.copy files 15 Done................................................... 212734394452576267 Done.........................................copy files successful.link binarIEs progress...........link binarIEs successful.Setup files 72 Done...............................Setup files successful.The installation of Oracle Database 11g was successful.Please check /u01/app/oracle/oraInventory/logs/silentInstall2015-04-01_10-13-42PM.log more details.Oracle Net Configuration Assistant 86 Done.Oracle Net Configuration Assistant successful.Oracle Database Configuration Assistant 95 Done.Oracle Configuration Assistant successful.Execute Root Scripts progress.As a root user,1)"> the following script(s): 1. orainstRoot.sh 2. /product/0.1/db_1root.sh.................................................. 100Execute Root Scripts successful.Successfully Setup Software.
最后,需root用户手动执行以下两个文件:
1. /u01/app/oracle/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/11.2.0.1/db_1/root.sh
当然,也可查看/u01/app/oracle/oraInventory/logs/installActions2015-04-01_10-13-42PM.log了解具体的安装信息。
命令行安装
首先来看dbca命令行支持哪些参数。
oracle@node2 ~]$ dbca helpdbca -silent | -progressOnly | -customCreate] {<command> <options> } | { <command> [options] ] -responsefile <response > } -continueOnNonFatalErrors <true | false>Please refer to the manual details.You can enter one the following command:Create a database specifying the following parameters: createDatabase -templatename <name of an existing template default location or the complete template path> -cloneTemplate] -gdbname <global database name-sID <database system IDentifIEr>] -sysPassword <SYS user password>-systemPassword <SYstem user password>-emConfiguration <CENTRAL|LOCAL|ALL|NONE> -dbsnmpPassword <DBSNMP user password> -sysmanPassword <SYSMAN user password> [-hostUsername <Host user name for EM backup job> -hostUserPassword <Host user password for EM backup job> -backupSchedule <Daily backup schedule in the form of hh:mm>] -centralAgent <Enterprise Manager central agent home>] -disableSecurityConfiguration <ALL|AUDIT|PASSWORD_PROfile|NONE> [-datafileDestination <destination directory for all database files> | -datafilenames <a text file containing database objects such as controlfiles,tablespaces,redo log files and spfile to their corresponding raw device file names mapPings in name=value format.>-redologfileSize <size of each redo log file in megabytes>-recoveryAreaDestination <destination directory for all recovery files>-datafileJarLocation <location of the data file jar,used only for clone database creation>-storageType < FS | ASM > [-asmsnmpPassword <ASMSNMP password for ASM monitoring>] -diskGroupname database area disk group name> -recoveryGroupname <recovery area -characterSet <character set for the database>-nationalCharacterSet <national character set for the database>-registerWithDirservice <true | false> -dirserviceUsername <user name for directory service> -dirservicePassword <password for directory service > -walletPassword <password for database wallet >-Listeners <List of Listeners to configure the database with>-variablesfile <file name for the variable-value pair for variables in the template>-variables <comma separated List of name=value pairs>-initParams <comma separated List of name=value pairs>-sampleSchema <true | false> -memoryPercentage <percentage of physical memory for Oracle>-automaticmemoryManagement -totalMemory <memory allocated for Oracle in MB>-databaseType <MulTIPURPOSE|DATA_WAREHOUSING|olTP>]Configure a configureDatabase -sourceDB <source database sID-sysDBAUsername <user name with SYSDBA privileges> -sysDBAPassword <password for sysDBAUsername user name>-registerWithDirservice|-unregisterWithDirservice|-regenerateDBPassword <true | false> -dirserviceUsername <user name for directory service> -dirservicePassword <password for directory service > -walletPassword <password for database wallet >-disableSecurityConfiguration <ALL|AUDIT|PASSWORD_PROfile|NONE> [-enableSecurityConfiguration <true|false> [-emConfiguration <CENTRAL|LOCAL|ALL|NONE> -dbsnmpPassword <DBSNMP user password> -sysmanPassword <SYSMAN user password> [-hostUsername <Host user name for EM backup job> -hostUserPassword <Host user password for EM backup job> -backupSchedule <Daily backup schedule in the form of hh:mm>]Create a template from an existing createTemplateFromDB <service in the form of <host>:<port<sID>> -templatename <new template name> -sysDBAUsername <user name with SYSDBA privileges-sysDBAPassword <password for sysDBAUsername user name-maintainfileLocations <true | false>]Create a clone template createCloneTemplate -sourceSID -datafileJarLocation <directory to place the datafiles in a compressed format>Generate scripts create generateScripts -scriptDest <destination for all the scriptfiles>Delete a deleteDatabase query for help by specifying the following options: -h | -help
由此来看,dbca命令行参数还是及其丰富的,完全可DIY建库。
下面,用最少参数建了一个库。
oracle@node2 trace-createDatabase -templatename General_Purpose.dbc -gdbname test -sysPassword oracle -systemPassword oracle
注意,密码需指定,不然会有以下提示
A value for the command line argument "systemPassword" not provIDed. We cannot proceed without a value for this argument.
最后输出结果如下:
copying database files 1 complete 311 complete 182637 complete Creating starting Oracle instance 404550555660 complete Completing Creation 66 complete70738596 completeLook at the file "/cfgtoollogs/dbca/test/test.log" for further details.
注意:建库时的日志信息可在$ORACLE_BASE/cfgtoollogs/dbca/<dbname>下查看。
总结
以上是内存溢出为你收集整理的Oracle 11gR2静默安装 & 命令行安装全部内容,希望文章能够帮你解决Oracle 11gR2静默安装 & 命令行安装所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)