在之前写了一篇静默安装数据库软件的博文(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