This article will show how to create a Oracle 12c container database (CDB), with one pluggable database (PDB), in command line with dbca and silent option.

DBCA is for DataBase Configuration Assistant, this is a tool to create/delete Oracle databases.
It can be used as GUI or as command line.

Before starting, you need ...
... Oracle Grid Infrastructure installed (optional but recommanded, see here)
... ASM installed and confgured (only if ASM is used as db storage, see here)
... Oracle 12c RDBMS installed (see here)

Create Oracle database/instance

dbca needs a template file to create a database. These template can be found in $ORACLE_HOME/assistants/dbca/templates.
We will use here the default New_Database.dbt template file to create a container database named UXOCDB with one PDB on ASM storage with DATA and FRA diskgroups.
DBCA will install all database components when it is created as container database.

# Execute dbca with ASM option
[oracle]$ dbca -silent \
 -createDatabase \
 -templateName New_Database.dbt \
 -gdbName UXOCDB \
 -sid UXOCDB     \
 -SysPassword orasyspw \
 -SystemPassword orasystempw \
 -createAsContainerDatabase true \
   -numberofPDBs 1 \
   -pdbName UXOPDB \
   -pdbAdminPassword orapdbadmpw \
 -emConfiguration none  \
 -redoLogFileSize 100   \
 -recoveryAreaDestination FRA \
 -storageType ASM             \
   -asmsnmpPassword asmsnmppw \
   -diskGroupName DATA \
   -recoveryGroupName FRA \
 -listeners LISTENER   \
 -registerWithDirService false \
 -characterSet AL32UTF8 \
 -nationalCharacterSet AL16UTF16 \
 -databaseType MULTIPURPOSE \
 -automaticMemoryManagement true \
 -totalMemory 2048 \
 -sampleSchema  true \
 -initparams audit_file_dest='/u01/app/oracle/admin/UXOCDB/adump' \
 -initparams compatible='12.1.0' \
 -initparams db_create_file_dest='+DATA' \
 -initparams db_create_online_log_dest_1='+DATA' \
 -initparams db_create_online_log_dest_2='+FRA' \
 -initparams db_recovery_file_dest='+FRA' \
 -initparams diagnostic_dest='/u01/app/oracle' \
 -initparams parallel_max_servers=8 \
 -initparams processes=400 

    Cleaning up failed steps
    1% complete
    Registering database with Oracle Restart
    3% complete
    Creating and starting Oracle instance
    4% complete
    6% complete
    Creating database files
    9% complete
    Creating data dictionary views
    10% complete
    12% complete
    14% complete
    15% complete
    16% complete
    18% complete
    Adding Oracle JVM
    23% complete
    28% complete
    32% complete
    34% complete
    Adding Oracle Text
    36% complete
    37% complete
    Adding Oracle Multimedia
    38% complete
    46% complete
    Adding Oracle OLAP
    50% complete
    Adding Oracle Spatial
    56% complete
    Adding Oracle Label Security
    62% complete
    Adding Oracle Application Express
    65% complete
    68% complete
    Adding Oracle Database Vault
    75% complete
    Creating cluster database views
    81% complete
    Completing Database Creation
    82% complete
    83% complete
    84% complete
    86% complete
    89% complete
    90% complete
    Creating Pluggable Databases
    92% complete
    100% complete
    Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/UXOCDB/UXOCDB1.log" for further details.

Others

Delete database

Be careful
This command may cause you data loss, so use it with caution.

You may want for some reason to delete a Oracle database. As oracle user, use the following command to properly delete database from host:

# Delete database
[oracle]$ dbca -silent -deleteDatabase -sourceDB testdb
    ASM with SID +ASM deleted successfully. Check /u01/app/grid/base/cfgtoollogs/asmca/asmca-150713AM012406.log for details.

dbca createDatabase help

# DBCA help
[oracle]$ dbca -createDatabase -help
    Create a database by specifying the following parameters:
	-createDatabase
		-templateName <name an="" complete="" default="" existing="" in="" location="" of="" or="" path="" template="" the="">
		[-cloneTemplate]
		-gdbName <global database="" name="">
		[-ignorePreReqs] <ignore checks="" current="" for="" operation="" prerequisite="">
		[-sid <database identifier="" system="">]
		[-createAsContainerDatabase <true|false>]
			[-numberOfPDBs <number be="" created="" databases="" of="" pluggable="" to="">]
			[-pdbName <new database="" name="" pluggable="">]
			[-pdbAdminPassword <pdb administrator="" password="" user="">]
		[-sysPassword <sys password="" user="">]
		[-systemPassword <system password="" user="">]
		[-emConfiguration <dbexpress|central|both|none>]
			-dbsnmpPassword     <dbsnmp password="" user="">
			[-omsHost     <em host="" management="" name="" server="">
			-omsPort     <em management="" number="" port="" server="">
			-emUser     <em add="" admin="" modify="" or="" targets="" to="" username="">
			-emPassword     <em admin="" password="" user="">
			-emExpressPort     <em database="" express="" number="" port="">]]
		[-dvConfiguration <true>
			-dvUserPassword     <specify database="" owner="" password="" vault="">
			-dvAccountManagerName     <specify account="" database="" manager="" separate="" vault="">
			-dvAccountManagerPassword     <specify account="" database="" manager="" password="" vault="">]
		[-olsConfiguration <true>
		[-datafileDestination <destination all="" database="" directory="" files.="" for=""> | 
    -datafileNames <a as="" containing="" controlfiles="" database="" file="" objects="" such="" text="">]
		[-redoLogFileSize <size each="" file="" in="" log="" megabytes="" of="" redo="">]
		[-recoveryAreaDestination <destination all="" directory="" files.="" for="" recovery="" specify="">]
		[-datafileJarLocation  <location data="" file="" jar="" of="" the="">]
		[-storageType < FS | ASM > 
			[-asmsnmpPassword     <asmsnmp asm="" for="" monitoring="" password="">]
			 -diskGroupName   <database area="" disk="" group="" name="">
			 -recoveryGroupName       <recovery area="" disk="" group="" name="">
		[-characterSet <character database="" for="" set="" the="">]
		[-nationalCharacterSet  <national character="" database="" for="" set="" the="">]
		[-registerWithDirService <true> 
			-dirServiceUserName    <user directory="" for="" name="" service="">
			-dirServicePassword    <password directory="" for="" service="">
			-walletPassword    <password database="" for="" wallet="">]
		[-listeners  <list configure="" database="" listeners="" of="" the="" to="" with="">]
		[-variablesFile   <file for="" in="" name="" pair="" template="" the="" variable-value="" variables="">]]
		[-variables  <comma list="" name="value" of="" pairs="" separated="">]
		[-initParams <comma list="" name="value" of="" pairs="" separated="">]
		[-sampleSchema  <true> ]
		[-memoryPercentage <percentage for="" memory="" of="" oracle="" physical="">]
		[-automaticMemoryManagement <true> ]
		[-totalMemory <memory allocated="" for="" in="" mb="" oracle="">]
		[-databaseType <multipurpose|data_warehousing|oltp>]]

Please leave comments and suggestions,
Michel.

Reference
Creating and Configuring an Oracle Database (docs.oracle.com)
Silent database 11g creation with dbca (uxora.com)

Enjoyed this article? Please like it or share it.

Add comment

Please connect with one of social login below (or fill up name and email)

     


Security code
Refresh

Comments   

Soila
# Silent database 12c creation with dbcaSoila 2016-05-28 15:13
This actually answered my problem, thank you!
Reply | Reply with quote | Quote