Create Oracle Multitenant Database in Silent Mode

Quick Tip

We can use dbca to create an instance in a multitenant Oracle 19c in a similar way as we used to do it in previous non multitenant versions.

Response file

You need to prepare a response file similar to this one, including the parameters createAsContainerDatabase=true and numberOfPDBs=0 to generate only the multitenant container and later create the pluggable databases.

sid=patodb
gdbName=patodb
createAsContainerDatabase=true
numberOfPDBs=0
databaseConfigType=SINGLE
databaseType=MULTIPURPOSE
templateName={ORACLE_HOME}/assistants/dbca/templates/General_Purpose.dbc
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/
datafileDestination=/oradata/cdbs
storageType=FS
redoLogFileSize=64
useLocalUndoForPDBs=false
enableArchive=true
recoveryAreaDestination=/oradata/recovery
recoveryAreaSize=10240
memoryMgmtType=AUTO
totalMemory=2048
createListener=LISTENER:1521
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
sysPassword=********
systemPassword=********
sampleSchema=false
initParams=log_archive_format=%t_%s_%r.arc

I also included another multitenant parameter useLocalUndoForPDBs=false as I want only one UNDO tablespace shared between CDB root and the PDBs.

Create Container and Pluggable Database

Then you can run the command dbca -silent -createDatabase -responseFile as usual:

[oracle@patoracle ~]$ dbca -silent -createDatabase -responseFile ./dbcreate.rsp
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
52% complete
56% complete
60% complete
Completing Database Creation
66% complete
69% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/patodb.
Database Information:
Global Database Name:patodb
System Identifier(SID):patodb
Look at the log file "/opt/oracle/cfgtoollogs/dbca/patodb/patodb.log" for further details.
[oracle@patoracle ~]$

And when your instance is running you can create the Pluggable Database like this:

[oracle@patoracle ~]$ sqlplus / as sysdba

SQL> CREATE PLUGGABLE DATABASE taller
  ADMIN USER pato IDENTIFIED BY ********
  ROLES = (dba)
  STORAGE (MAXSIZE 2G)
  DEFAULT TABLESPACE datos DATAFILE '/oradata/pdbs/taller/datos.dbf' SIZE 250M AUTOEXTEND ON
  PATH_PREFIX = '/oradata/pdbs/taller/'
  FILE_NAME_CONVERT = ('/oradata/cdbs/PATODB/pdbseed/', '/oradata/pdbs/taller/');

Pluggable database created.

SQL> ALTER PLUGGABLE DATABASE taller OPEN;

Pluggable database altered.

SQL> ALTER PLUGGABLE DATABASE taller SAVE STATE;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 TALLER                         READ WRITE NO

notice that pluggable databases are cloned from PDB$SEED so you may need to do a file name conversion if needed for you standards.