One of the great features it to make use of the command-line option available with the oracle tools, like runInstaller, asmca, netca, dbca etc., especially when no X environment is available.

Below are several examples on how to manage pluggable database instances using the DBCA in silent mode for the Oracle RDBMS 12c.

To list all the possible option you first need to execute: dbca -help. This will display the command options, for more details about each command you need to define dbca <command> -help.



$ 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

Create a pluggable database

There are several option when you want to create a pluggable database using the command line. The default, which is the pdb$seed, rmanbackup, metadatafile (if unplugged). The example will display the default one. Including the creation of the PDB admin user.


$ dbca -silent -createPluggableDatabase -sourceDB cdbprod -pdbName pdbprod -createPDBFrom default -pdbAdminUserName pdbadmin -pdbAdminPassword oracle -createUserTableSpace true

Creating Pluggable Database

4% complete
12% complete
21% complete
38% complete
85% complete

Completing Pluggable Database Creation

100% complete

Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/

cdbprod/pdbprod/cdbprod0.log” for further details.

Unplug a pluggable database

The unplug will remove a PDB from the defined container database and create as default a tar.gz file in the location: /u01/app/oracle/product/12.1.0/dbhome_1/assistants/dbca/templates

$ dbca -silent -unplugDatabase -sourceDB cdbprod -pdbName pdbprd -PDBMetadatafile /tmp/ -archiveType none

Gathering information from the pluggable database

5% complete
10% complete
25% complete
Unplugging Database
32% complete
47% complete
70% complete
77% complete
100% complete

Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/

cdbprod/pdbprd/cdbprod.log” for further details.

Drop a pluggable database 

You only need to define the container database name and the pluggable database name.
The drop statement will result in the following SQL statements:

1)alter pluggable database <name> close immediate

2)alter system flush buffer_cache inst=0 container=3 local;

3)drop pluggable database <name> including datafiles

$ dbca -silent -deletePluggableDatabase -sourceDB cdbprod -pdbName pdbprod

 

Deleting Pluggable Database

10% complete
20% complete
80% complete
90% complete
100% complete

Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/

cdbprod/pdbprod/cdbprod.log” for further details.