1. 程式人生 > >利用DBCA靜默安裝oracle資料庫

利用DBCA靜默安裝oracle資料庫

在之前寫了一篇靜默安裝資料庫軟體的博文(http://blog.csdn.net/u010343795/article/details/54943355),此時也可以在reponse檔案中配置同時建立資料庫。資料庫安裝方式有很多,最常見的DBCA圖形建庫,這也是網上介紹最多,優點是簡便,but,不適合裝逼;還有手工建庫,OFM建庫,以及DBCA靜默建庫,在無法使用圖形建庫的時候,這種方式還是很方便的。

以下建立在資料庫軟體已經安裝的基礎之上,資料庫版本為Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit。

1、通過DBCA -HELP命令檢視命令引數

[oracle@localhost ~]$ dbca -help

dbca  [-silent | -progressOnly] {<command> <options> }  | { [<command> [options] ] -responseFile  <response file > } [-continueOnNonFatalErrors <true | false>]

 <command> : -createDatabase | -configureDatabase | -createTemplateFromDB | -createCloneTemplate | -generateScripts | -deleteDatabase | -createPluggableDatabase | -unplugDatabase | -deletePluggableDatabase | -configurePluggableDatabase


Enter "dbca -<command> -help" for more option

2、使用createDatabase命令建立一個新的資料庫,執行DBCA -CREATEDATABASE -HELP檢視createDatabase的可選引數

Create a database by specifying the following parameters:
	-createDatabase
		-templateName <name of an existing template in default location or the complete template path>
		[-cloneTemplate]
		-gdbName <global database name>
		[-ignorePreReqs] <ignore prerequisite checks for current operation>
		[-sid <database system identifier>]
		[-createAsContainerDatabase <true|false>]
			[-numberOfPDBs <Number of Pluggable databases to be created, default is 0>]
			[-pdbName <New Pluggable Database Name>]
			[-pdbAdminPassword <PDB Administrator user Password, required only when creating new PDB>]
		[-sysPassword <SYS user password>]
		[-systemPassword <SYSTEM user password>]
		[-emConfiguration <DBEXPRESS|CENTRAL|BOTH|NONE>]
			-dbsnmpPassword     <DBSNMP user password>
			[-omsHost     <EM management server host name>
			-omsPort     <EM management server port number>
			-emUser     <EM Admin username to add or modify targets>
			-emPassword     <EM Admin user password>
			-emExpressPort     <EM Database Express port number>]]
		[-dvConfiguration <true | false Specify "true" to configure and enable Database Vault
			-dvUserName     <Specify Database Vault Owner user name>
			-dvUserPassword     <Specify Database Vault Owner password>
			-dvAccountManagerName     <Specify separate Database Vault Account Manager >
			-dvAccountManagerPassword     <Specify Database Vault Account Manager password>]
		[-olsConfiguration <true | false Specify "true" to configure and enable Oracle Label Security >
		[-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. Specify "NONE" for disabling Fast Recovery Area.>]
		[-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 disk group name>
		[-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 <true | false> ]
		[-totalMemory <memory allocated for Oracle in MB>]
		[-databaseType <MULTIPURPOSE|DATA_WAREHOUSING|OLTP>]]

3、到此,執行靜默安裝的命令的基本模式:dbca -silent -createDatabase [database parameters...],選擇一部分必填引數,其他可以採用預設選項。示例:
dbca -silent -createDatabase -templateName $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc -gdbName orcogg -sid orcogg -createAsContainerDatabase true -numberOfPDBs 1 -pdbName pdbogg -pdbAdminPassword wonderscd -sysPassword wonderscd -systemPassword wonderscd -datafileDestination /u01/data_files -characterSet GBK16 -automaticMemoryManagement true