Instruction

Oracle 19c Container Database Creation with DBCA (Silent Method)

Assumptions

This instruction assumes:

  • Oracle Linux 8.x (x86_64) is installed and operational
  • Grid Infrastructure 19c is installed and running with Oracle Restart; the ASM instance is operational
  • ASM diskgroups +DATA and +RECO are created and mounted
  • Oracle Database 19c (19.3.0) software is installed (software-only) in /u01/app/oracle/product/19.0.0/dbhome_1 -- separate from the Grid Infrastructure home
  • The oracle user exists and belongs to oinstall, dba, oper, backupdba, dgdba, kmdba, asmdba, and racdba groups
  • The oracle user's PATH includes the Grid Infrastructure home bin directory (e.g., via .bash_profile sourcing the Grid environment), so that crsctl, srvctl, and asmcmd are available before the database environment is configured
  • The Grid Infrastructure listener (LISTENER) is running on port 1521
  • The server has at least 21 GB of available memory for SGA (16 GB) + PGA (4 GB) + OS overhead
  • The +DATA diskgroup has at least 15 GB of free space
  • The +RECO diskgroup has sufficient free space for the Fast Recovery Area
  • Root access is available for /dev/shm resizing if needed
  • No X11 display is needed or available
  • The result is a Container Database (CDB) with one Pluggable Database (PDB)

Prerequisites

Verify existing infrastructure

All verification commands run as the oracle user unless noted otherwise.

  1. Verify Oracle Restart is running
crsctl check has

Expected output:

CRS-4638: Oracle High Availability Services is online
  1. Verify the ASM instance is running
srvctl status asm

Expected output:

ASM is running on {HOSTNAME}

{HOSTNAME} -- the server hostname where Grid Infrastructure is installed. This placeholder appears throughout the document in expected output examples.

  1. Verify diskgroups are mounted
asmcmd lsdg

Expected output:

State    Type    Rebal  Sector  Block  AU   Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N      512     4096   4194304  ...     ...      0                ...             0              N             DATA/
MOUNTED  EXTERN  N      512     4096   4194304  ...     ...      0                ...             0              N             RECO/

Both +DATA and +RECO must show MOUNTED in the State column. Confirm Free_MB for +DATA is at least 15000.

  1. Verify the listener is running
srvctl status listener

Expected output:

Listener LISTENER is enabled
Listener LISTENER is running on node(s): {HOSTNAME}
  1. Verify oracle user group membership
id oracle

Expected output:

uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54327(asmdba),54330(racdba)

Confirm that oinstall and dba groups are present.

Set environment variables

  1. Configure the oracle user environment for the database home

The environment must point to the database home, not the Grid Infrastructure home. As the oracle user:

mkdir -p /home/oracle/scripts
cat > /home/oracle/scripts/setEnv.sh <<'EOF'
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
export ORACLE_SID={DB_NAME}
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
EOF

{DB_NAME} -- the database name and SID (e.g., cdb1). Use 8 characters or fewer.

Source the environment:

grep -qxF '. /home/oracle/scripts/setEnv.sh' /home/oracle/.bash_profile || echo '. /home/oracle/scripts/setEnv.sh' >> /home/oracle/.bash_profile
source /home/oracle/.bash_profile

Warning: If the oracle user's .bash_profile already sources an environment script that sets ORACLE_HOME to the Grid Infrastructure home, appending this line will override it. After this change, the oracle user's default environment points to the database home. Use oraenv or source a different script to switch between homes.

Verify:

echo $ORACLE_HOME

Expected output:

/u01/app/oracle/product/19.0.0/dbhome_1
  1. Verify the DBCA template exists
ls $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc

Expected output:

/u01/app/oracle/product/19.0.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc

Verify /dev/shm

  1. Verify /dev/shm is sized for the SGA

The tmpfs mount at /dev/shm must be at least as large as the SGA. With a 16 GB SGA target, /dev/shm must be at least 16 GB.

df -h /dev/shm

Expected output:

Filesystem      Size  Used Avail Use% Mounted on
tmpfs            17G     0   17G   0% /dev/shm

If the Size column shows less than 16 GB, resize it as root:

mount -o remount,size=17G /dev/shm

Make the change persistent by editing /etc/fstab as root. Ensure the tmpfs entry reads:

tmpfs  /dev/shm  tmpfs  defaults,size=17G  0  0

Database Creation

Step 1: Suppress shell history recording

Warning: The DBCA command includes passwords on the command line. These will be visible in ps output while the command runs and in shell history after completion. Suppress history recording before executing the command.

As the oracle user:

unset HISTFILE

Step 2: Run DBCA in silent mode

Warning: The -characterSet AL32UTF8 parameter sets the database character set at creation time. Changing the character set after the database accumulates production data is a complex and time-consuming project. Choose the correct character set now.

Run the following command as the oracle user. Replace {DB_NAME}, {PDB_NAME}, {SYS_PASSWORD}, {SYSTEM_PASSWORD}, and {PDB_ADMIN_PASSWORD} with your values.

{DB_NAME} -- the database name and SID. Must match the ORACLE_SID set in step 6 (e.g., cdb1).

{PDB_NAME} -- the name of the pluggable database (e.g., pdb1).

{SYS_PASSWORD} -- password for the SYS account. Minimum 8 characters, must include uppercase, lowercase, and a digit. Avoid special characters that require shell escaping (!, $, `, \, ", '). If special characters are required, enclose the password in single quotes on the command line.

{SYSTEM_PASSWORD} -- password for the SYSTEM account. Same requirements as SYS.

{PDB_ADMIN_PASSWORD} -- password for the PDB local administrator (PDBADMIN). Same requirements as SYS.

dbca -silent -createDatabase \
  -templateName General_Purpose.dbc \
  -gdbname {DB_NAME} \
  -sid {DB_NAME} \
  -createAsContainerDatabase true \
  -numberOfPDBs 1 \
  -pdbName {PDB_NAME} \
  -pdbAdminPassword {PDB_ADMIN_PASSWORD} \
  -sysPassword {SYS_PASSWORD} \
  -systemPassword {SYSTEM_PASSWORD} \
  -storageType ASM \
  -datafileDestination +DATA \
  -recoveryAreaDestination +RECO \
  -recoveryAreaSize 10240 \
  -characterSet AL32UTF8 \
  -nationalCharacterSet AL16UTF16 \
  -memoryMgmtType auto_sga \
  -initParams "sga_target=16G,pga_aggregate_target=4G,memory_target=0" \
  -databaseType MULTIPURPOSE \
  -emConfiguration NONE \
  -listeners LISTENER \
  -redoLogFileSize 200 \
  -responseFile NO_VALUE \
  -ignorePreReqs

Parameter summary:

Parameter Value Purpose
-templateName General_Purpose.dbc Standard DBCA template in $ORACLE_HOME/assistants/dbca/templates/
-gdbname / -sid {DB_NAME} Global database name and system identifier
-createAsContainerDatabase true Creates a Container Database (CDB) with CDB$ROOT and PDB$SEED
-numberOfPDBs / -pdbName 1 / {PDB_NAME} Creates one Pluggable Database
-pdbAdminPassword {PDB_ADMIN_PASSWORD} Password for the PDBADMIN local administrator in the PDB
-storageType ASM Store database files on Automatic Storage Management
-datafileDestination +DATA ASM diskgroup for data files, control files, redo logs, and SPFile
-recoveryAreaDestination +RECO ASM diskgroup for the Fast Recovery Area
-recoveryAreaSize 10240 Fast Recovery Area size in MB (10 GB)
-characterSet AL32UTF8 Database character set (changing after creation is complex and time-consuming)
-nationalCharacterSet AL16UTF16 National character set (default for Oracle databases)
-memoryMgmtType auto_sga Enables Automatic Shared Memory Management (ASMM) for SGA via sga_target, with separate automatic PGA management via pga_aggregate_target; disables AMM
-initParams sga_target=16G,pga_aggregate_target=4G,memory_target=0 Explicit memory sizing; memory_target=0 disables AMM
-databaseType MULTIPURPOSE General-purpose OLTP and reporting workload
-emConfiguration NONE Skip Enterprise Manager configuration
-listeners LISTENER Register with the existing Grid Infrastructure listener
-redoLogFileSize 200 Online redo log file size in MB
-responseFile NO_VALUE All parameters are specified on the command line
-ignorePreReqs -- Bypass prerequisite checks (OL8 is not recognized by the 19.3.0 base release)

Notes on memory management:

  • -memoryMgmtType auto_sga enables Automatic Shared Memory Management (ASMM) for the SGA via sga_target, and configures automatic PGA sizing via pga_aggregate_target. This replaces Automatic Memory Management (memory_target). On Linux systems with more than 4 GB of physical RAM, AMM is not supported -- ASMM with automatic PGA management is the correct approach.
  • The -initParams values override the template defaults for sga_target and pga_aggregate_target. The General_Purpose.dbc template calculates memory based on -totalMemory if specified, but -initParams takes precedence for the parameters listed.
  • DBCA automatically registers the database with Oracle Restart. No manual srvctl add database is needed.

Database creation takes 10-30 minutes depending on hardware.

Expected output:

Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
70% complete
Pluggable database "pdb1" created successfully.
73% complete
Running post-creation scripts
80% complete
85% complete
90% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/{DB_NAME}/{DB_NAME}.log" for further details.

Step 3: Verify the DBCA log

Check the DBCA log for errors:

tail -20 /u01/app/oracle/cfgtoollogs/dbca/${ORACLE_SID}/${ORACLE_SID}.log

The log should end without ORA- errors. Informational messages about Enterprise Manager configuration being skipped (NONE) are expected.

Post-creation

Step 1: Save PDB state for automatic open on restart

By default, PDBs start in MOUNTED mode when the CDB restarts. Save the PDB state so it opens automatically:

sqlplus / as sysdba <<'EOF'
ALTER PLUGGABLE DATABASE {PDB_NAME} SAVE STATE;
EXIT;
EOF

{PDB_NAME} -- the PDB name specified during creation (e.g., pdb1).

Expected output:

Pluggable database altered.

Step 2: Verify PDB save state

sqlplus -s / as sysdba <<'EOF'
SELECT con_name, state FROM dba_pdb_saved_states;
EXIT;
EOF

Expected output:

CON_NAME                       STATE
------------------------------ ----------
PDB1                           OPEN

The PDB will now open automatically when the CDB starts.

Validation

Quick check

srvctl status database -d ${ORACLE_SID}

Expected output:

Database is running.

Full validation

  1. Verify Oracle Restart registration
srvctl config database -d ${ORACLE_SID}

Expected output:

Database unique name: {DB_NAME}
Database name: {DB_NAME}
Oracle home: /u01/app/oracle/product/19.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/{DB_NAME}/PARAMETERFILE/spfile{DB_NAME}.ora
...
Database role: PRIMARY
Start options: open
Stop options: immediate
...

Confirm Oracle home points to the database home and Spfile is on +DATA.

  1. Verify database version
sqlplus -s / as sysdba <<'EOF'
SELECT banner FROM v$version WHERE ROWNUM = 1;
EXIT;
EOF

Expected output:

BANNER
--------------------------------------------------------------------------------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
  1. Verify CDB status and open mode
sqlplus -s / as sysdba <<'EOF'
SELECT name, open_mode, cdb FROM v$database;
EXIT;
EOF

Expected output:

NAME      OPEN_MODE            CDB
--------- -------------------- ---
{DB_NAME} READ WRITE           YES

The CDB column reads YES, confirming this is a Container Database.

  1. Verify PDB status
sqlplus -s / as sysdba <<'EOF'
SELECT con_id, name, open_mode FROM v$pdbs;
EXIT;
EOF

Expected output:

    CON_ID NAME                           OPEN_MODE
---------- ------------------------------ ----------
         2 PDB$SEED                       READ ONLY
         3 {PDB_NAME}                     READ WRITE

The PDB must be in READ WRITE mode. PDB$SEED is always READ ONLY.

  1. Verify memory parameters
sqlplus -s / as sysdba <<'EOF'
SHOW PARAMETER sga_target;
SHOW PARAMETER pga_aggregate_target;
SHOW PARAMETER memory_target;
EXIT;
EOF

Expected output:

NAME                  TYPE        VALUE
--------------------- ----------- -----
sga_target            big integer 16G

NAME                  TYPE        VALUE
--------------------- ----------- -----
pga_aggregate_target  big integer 4G

NAME                  TYPE        VALUE
--------------------- ----------- -----
memory_target         big integer 0

memory_target=0 confirms Automatic Memory Management is disabled. sga_target=16G and pga_aggregate_target=4G confirm ASMM is active with the specified values.

  1. Verify character set
sqlplus -s / as sysdba <<'EOF'
SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET';
SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_NCHAR_CHARACTERSET';
EXIT;
EOF

Expected output:

VALUE
----------------------------------------
AL32UTF8

VALUE
----------------------------------------
AL16UTF16
  1. Verify data files are on +DATA
sqlplus -s / as sysdba <<'EOF'
SELECT name FROM v$datafile;
EXIT;
EOF

Expected output:

NAME
----------------------------------------------------------------------
+DATA/{DB_NAME}/DATAFILE/system.258.1234567891
+DATA/{DB_NAME}/DATAFILE/sysaux.259.1234567893
+DATA/{DB_NAME}/DATAFILE/undotbs1.260.1234567895
+DATA/{DB_NAME}/DATAFILE/users.261.1234567897
+DATA/{DB_NAME}/{PDB_GUID}/DATAFILE/system.262.1234567899
+DATA/{DB_NAME}/{PDB_GUID}/DATAFILE/sysaux.263.1234567901
+DATA/{DB_NAME}/{PDB_GUID}/DATAFILE/undotbs1.264.1234567903

{PDB_GUID} -- ASM uses the PDB's internal GUID (a hexadecimal string such as 64A52F53A7693286E053CDA9E80AED76) as the directory name for PDB datafiles, not the PDB name. The GUID directory appears before DATAFILE in the path.

All data files must be on +DATA. CDB root and PDB data files are listed.

  1. Verify recovery area is on +RECO
sqlplus -s / as sysdba <<'EOF'
SELECT name, space_limit/1024/1024 AS limit_mb, space_used/1024/1024 AS used_mb FROM v$recovery_file_dest;
EXIT;
EOF

Expected output:

NAME        LIMIT_MB    USED_MB
----------- ----------- -----------
+RECO       10240       ...
  1. Verify listener registration
lsnrctl status

Expected output (relevant section):

...
Services Summary...
Service "{DB_NAME}" has 1 instance(s).
  Instance "{DB_NAME}", status READY, has 1 handler(s) for this service...
Service "{DB_NAME}XDB" has 1 instance(s).
  Instance "{DB_NAME}", status READY, has 1 handler(s) for this service...
Service "{PDB_NAME}" has 1 instance(s).
  Instance "{DB_NAME}", status READY, has 1 handler(s) for this service...
The command completed successfully

The CDB service ({DB_NAME}), XDB service ({DB_NAME}XDB), and PDB service ({PDB_NAME}) are all registered with the listener.

Troubleshooting

Problem Cause Solution
ORA-27102: out of memory /dev/shm is smaller than the SGA or insufficient physical memory As root: mount -o remount,size=17G /dev/shm and update /etc/fstab. Verify with df -h /dev/shm.
DBCA hangs at password prompt -sysPassword or -systemPassword missing from the command line Cancel with Ctrl+C. Re-run the command with all three password parameters (-sysPassword, -systemPassword, -pdbAdminPassword).
DIM-00019: create service error Listener is not running Start the listener: srvctl start listener. Verify: srvctl status listener.
ORA-15001: diskgroup "DATA" does not exist Wrong diskgroup name or ASM instance not running Verify ASM is running: srvctl status asm. Verify diskgroups: asmcmd lsdg. Use +DATA with the plus sign prefix.
ORA-15025: could not open disk ASM disk device permissions are incorrect As root, verify ASM disk ownership matches the Grid Infrastructure owner. Check with ls -l /dev/oracleasm/disks/ or ls -l /dev/sd* for AFD/udev configurations.
PDB not open after CDB restart PDB state was not saved Connect as SYSDBA: ALTER PLUGGABLE DATABASE {PDB_NAME} OPEN; then ALTER PLUGGABLE DATABASE {PDB_NAME} SAVE STATE;
srvctl status database returns "not registered" DBCA did not complete successfully or was interrupted Check the DBCA log at /u01/app/oracle/cfgtoollogs/dbca/{DB_NAME}/. If the database was partially created, drop it with dbca -silent -deleteDatabase -sourceDB {DB_NAME} and re-run.
ORA-01078: failure in processing system parameters SPFile on ASM is corrupted or inaccessible Verify ASM is running. Check SPFile location: srvctl config database -d {DB_NAME}. Verify the file exists: asmcmd ls +DATA/{DB_NAME}/PARAMETERFILE/.

References