Installation and Upgrade

How to Create a 19c Database by DBCA with Silent Mode

After installing Oracle 19c software only with silent mode, you may like to create a database by Database Configuration Assistant (DBCA) with silent mode, too.

Create Database with Response File

First of all, let’s take a look at the content of the response file.

[oracle@primary-19c ~]$ ll dbca-compdb-primdb.rsp
-rwx------ 1 oracle oinstall 1853 Aug  1 17:29 dbca-compdb-primdb.rsp
[oracle@primary-19c ~]$ cat dbca-compdb-primdb.rsp
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=COMPDB
sid=PRIMDB
databaseConfigType=SI
policyManaged=false
createServerPool=false
force=false
createAsContainerDatabase=false
numberOfPDBs=0
useLocalUndoForPDBs=true
templateName=/u01/app/oracle/product/19.0.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc
sysPassword=welcome1
systemPassword=welcome1
emConfiguration=DBEXPRESS
emExpressPort=5500
runCVUChecks=FALSE
omsPort=0
dvConfiguration=false
olsConfiguration=false
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/
recoveryAreaDestination={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}
storageType=FS
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
registerWithDirService=false
listeners=LISTENER
variables=ORACLE_BASE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1,DB_UNIQUE_NAME=PRIMDB,ORACLE_BASE=/u01/app/oracle,PDB_NAME=,DB_NAME=COMPDB,ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1,SID=PRIMDB
initParams=undo_tablespace=UNDOTBS1,db_block_size=8192BYTES,nls_language=AMERICAN,dispatchers=(PROTOCOL=TCP) (SERVICE=PRIMDBXDB),diagnostic_dest={ORACLE_BASE},control_files=("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/control02.ctl"),remote_login_passwordfile=EXCLUSIVE,audit_file_dest={ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump,processes=500,nls_territory=AMERICA,local_listener=LISTENER_PRIMDB,memory_target=1470MB,db_recovery_file_dest_size=10GB,open_cursors=300,log_archive_format=%t_%s_%r.dbf,compatible=19.0.0,db_name=COMPDB,db_recovery_file_dest={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME},audit_trail=db
sampleSchema=true
memoryPercentage=40
databaseType=MULTIPURPOSE
automaticMemoryManagement=true
totalMemory=0

Next, create a 19c database with silent mode.

[oracle@primary-19c ~]$ dbca -silent -createDatabase -responseFile ./dbca-compdb-primdb.rsp
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
58% complete
60% complete
Completing Database Creation
66% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /u01/app/oracle/cfgtoollogs/dbca/COMPDB.
Database Information:
Global Database Name:COMPDB
System Identifier(SID):PRIMDB
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/COMPDB/COMPDB.log" for further details.

Please note that, although I set sampleSchema=true, OUI installed only HR schema, if you want to use other sample schemas, you have to know how to install complete sample schemas.

Create Database without Response File

Without response file, you have to put all arguments in the command line in order to use DBCA with silent mode.

[oracle@primary-19c ~]$ dbca -silent -createDatabase -gdbName COMPDB -sid PRIMDB -databaseConfigType SI -numberOfPDBs 0 -useLocalUndoForPDBs true -templateName /u01/app/oracle/product/19.0.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc -sysPassword welcome1 -systemPassword welcome1 -emConfiguration DBEXPRESS -emExpressPort 5500 -omsPort 0 -datafileJarLocation {ORACLE_HOME}/assistants/dbca/templates/ -datafileDestination {ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/ -recoveryAreaDestination {ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME} -storageType FS -characterSet AL32UTF8 -nationalCharacterSet AL16UTF16 -listeners LISTENER -variables ORACLE_BASE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1,DB_UNIQUE_NAME=PRIMDB,ORACLE_BASE=/u01/app/oracle,PDB_NAME=,DB_NAME=COMPDB,ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1,SID=PRIMDB -initParams undo_tablespace=UNDOTBS1,db_block_size=8192BYTES,nls_language=AMERICAN,dispatchers=\(PROTOCOL=TCP\) \(SERVICE=PRIMDBXDB\),diagnostic_dest={ORACLE_BASE},control_files=\("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/control02.ctl"\),remote_login_passwordfile=EXCLUSIVE,audit_file_dest={ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump,processes=500,nls_territory=AMERICA,local_listener=LISTENER_PRIMDB,memory_target=1470MB,db_recovery_file_dest_size=10GB,open_cursors=300,log_archive_format=%t_%s_%r.dbf,compatible=19.0.0,db_name=COMPDB,db_recovery_file_dest={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME},audit_trail=db -sampleSchema true -memoryPercentage 40 -databaseType MULTIPURPOSE -automaticMemoryManagement true
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
58% complete
60% complete
Completing Database Creation
66% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /u01/app/oracle/cfgtoollogs/dbca/COMPDB.
Database Information:
Global Database Name:COMPDB
System Identifier(SID):PRIMDB
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/COMPDB/COMPDB.log" for further details.

Please note that, the name of DB_UNIQUE_NAME configured in the response file or argument is useless, DBCA still follows global database name to set DB_UNIQUE_NAME, you have to modify it by yourself.

In my case, I set DB_UNIQUE_NAME as PRIMDB before installation, but it’s COMPDB after installation: SQL> show parameter db_unique_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      COMPDB

So I changed it into PRIMDB and bounce the instance.

SQL> alter system set DB_UNIQUE_NAME=PRIMDB scope=spfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1543500144 bytes
Fixed Size                  8896880 bytes
Variable Size             905969664 bytes
Database Buffers          620756992 bytes
Redo Buffers                7876608 bytes
Database mounted.
Database opened.

DB_UNIQUE_NAME is now what we want.

SQL> show parameter db_unique_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      PRIMDB

I think you may like to know the differences between DB_NAME and DB_UNIQUE_NAME?

Next, I’ll talk about how to duplicate a 19c physical standby database for building a data guard environment.

Leave a Reply

Your email address will not be published. Required fields are marked *