Creating an Oracle Database 12c on Grid Infrastructure (Silent DBCA Method)
Assumptions
This instruction assumes:
- Oracle Linux 6.x or 7.x (x86_64) is installed and operational
- Grid Infrastructure 12c (12.1.0.2) is installed and running with Oracle Restart
- The ASM instance is running with
+DATAand+RECOdiskgroups created and mounted - Oracle Database 12.1.0.2 software is installed (software-only) in
/u01/app/oracle/product/12.1.0.2/db_1 - The Grid Infrastructure home is a separate directory from the database home
- The
oracleuser exists and belongs tooinstall,dba,oper,backupdba,dgdba, andkmdbagroups - The Grid Infrastructure listener (LISTENER) is running on port 1521
- The server has at least 21 GB of available memory for SGA (15 GB) + PGA (6 GB)
- The
+DATAdiskgroup has at least 15 GB of free space - The
+RECOdiskgroup has sufficient free space for the Fast Recovery Area - Root access is available for
/dev/shmresizing if needed - This is a traditional single-instance database
Prerequisites
Verify Grid Infrastructure and configure environment
All verification commands run as the oracle user unless noted otherwise.
- Verify Oracle Restart is running
crsctl check has
Expected output:
CRS-4638: Oracle High Availability Services is online
- 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.
- Verify diskgroups are mounted
Note:
asmcmdis a Grid Infrastructure utility. If your PATH points to the database home, use the full path:$GRID_HOME/bin/asmcmd(where$GRID_HOMEis the Grid Infrastructure home directory).
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.
- Verify the listener is running
srvctl status listener
Expected output:
Listener LISTENER is enabled
Listener LISTENER is running on node(s): {HOSTNAME}
- Verify the 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)
Confirm that oinstall and dba groups are present.
Set environment variables
- Configure the oracle user environment
The environment must point to the database home, not the Grid Infrastructure home. As the oracle user, create the scripts directory and environment script:
mkdir -p /home/oracle/scripts
cat > /home/oracle/scripts/setEnv.sh <<'EOF'
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_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., ORCL). Use uppercase, 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
Verify:
echo $ORACLE_HOME
Expected output:
/u01/app/oracle/product/12.1.0.2/db_1
- Verify the DBCA template exists
ls $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc
Expected output:
/u01/app/oracle/product/12.1.0.2/db_1/assistants/dbca/templates/General_Purpose.dbc
Verify /dev/shm
- Verify
/dev/shmis sized for the SGA
The tmpfs mount at /dev/shm must be at least as large as the SGA. With a 15 GB SGA target, /dev/shm must be at least 15 GB.
df -h /dev/shm
Expected output:
Filesystem Size Used Avail Use% Mounted on
tmpfs 16G 0 16G 0% /dev/shm
If the Size column shows less than 15 GB, resize it as root:
mount -o remount,size=16G /dev/shm
Make the change persistent by editing /etc/fstab as root. Ensure the tmpfs entry reads:
tmpfs /dev/shm tmpfs defaults,size=16G 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
psoutput 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 AL32UTF8parameter sets the database character set permanently. This cannot be changed after database creation.
Run the following command as the oracle user. Replace {DB_NAME}, {SYS_PASSWORD}, and {SYSTEM_PASSWORD} with your values. {DB_NAME} must match the ORACLE_SID set in the environment.
{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.
dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname {DB_NAME} \
-sid {DB_NAME} \
-sysPassword {SYS_PASSWORD} \
-systemPassword {SYSTEM_PASSWORD} \
-storageType ASM \
-diskGroupName +DATA \
-recoveryAreaDestination +RECO \
-recoveryAreaSize 50000 \
-characterSet AL32UTF8 \
-nationalCharacterSet AL16UTF16 \
-automaticMemoryManagement false \
-initParams "memory_target=0,sga_target=15G,sga_max_size=16G,pga_aggregate_target=6G" \
-databaseType MULTIPURPOSE \
-emConfiguration NONE \
-listeners LISTENER \
-responseFile NO_VALUE
Parameter notes:
-storageType ASMand-diskGroupName +DATAplace all data files on the+DATAdiskgroup.-recoveryAreaDestination +RECOsets the Fast Recovery Area to the+RECOdiskgroup.-recoveryAreaSize 50000allocates approximately 50 GB for the recovery area.-automaticMemoryManagement falsedisables AMM. On Linux with more than 4 GB of RAM, AMM is not supported — ASMM is used instead.-initParamssets memory sizing:sga_target=15G,sga_max_size=16G(allows 1 GB growth without restart),pga_aggregate_target=6G, andmemory_target=0(confirms AMM is disabled).-nationalCharacterSet AL16UTF16is the default national character set. If DBCA does not recognize this as a command-line parameter, theGeneral_Purpose.dbctemplate uses AL16UTF16 by default.-listeners LISTENERregisters the database with the existing Grid Infrastructure listener named LISTENER.-responseFile NO_VALUEindicates all parameters are specified on the command line.- DBCA automatically registers the database with Oracle Restart. No manual
srvctl add databaseis needed.
Database creation takes 10-30 minutes depending on hardware.
Expected output:
Copying database files
1% complete
2% complete
...
Creating and starting Oracle instance
...
40% complete
...
Completing Database Creation
...
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. This log captures all actions DBCA performed during database creation:
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.
Validation
Quick check
srvctl status database -d ${ORACLE_SID}
Expected output:
Database {DB_NAME} is running
Full validation
- 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/12.1.0.2/db_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.
- Verify database version
sqlplus -s / as sysdba <<'EOF'
SELECT banner FROM v$version WHERE ROWNUM = 1;
EXIT;
EOF
Expected output:
BANNER
--------------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- Verify database open mode
sqlplus -s / as sysdba <<'EOF'
SELECT name, open_mode FROM v$database;
EXIT;
EOF
Expected output:
NAME OPEN_MODE
--------- --------------------
{DB_NAME} READ WRITE
- Verify memory parameters
sqlplus -s / as sysdba <<'EOF'
SHOW PARAMETER sga_target;
SHOW PARAMETER sga_max_size;
SHOW PARAMETER pga_aggregate_target;
SHOW PARAMETER memory_target;
EXIT;
EOF
Expected output:
NAME TYPE VALUE
--------------------- ----------- -----
sga_target big integer 15G
NAME TYPE VALUE
--------------------- ----------- -----
sga_max_size big integer 16G
NAME TYPE VALUE
--------------------- ----------- -----
pga_aggregate_target big integer 6G
NAME TYPE VALUE
--------------------- ----------- -----
memory_target big integer 0
memory_target=0 confirms Automatic Memory Management is disabled. sga_target=15G and pga_aggregate_target=6G confirm ASMM is active.
- 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
- 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
All data files must be on +DATA.
- 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 50000 ...
- 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...
The command completed successfully
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=16G /dev/shm and update /etc/fstab. Verify with df -h /dev/shm. |
| DBCA hangs at password prompt | -sysPassword or -systemPassword missing from command line |
Cancel with Ctrl+C. Re-run the command with both password parameters. |
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 oracleasm listdisks or ls -l /dev/oracleasm/disks/. |
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 after creation |
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/. |
| Memory parameters revert to template defaults | Known issue: the General_Purpose.dbc template sets customSGA=false, which can override -initParams values for SGA parameters in some 12.1 builds |
After creation, verify memory with SHOW PARAMETER sga_target. If values do not match, set them manually: ALTER SYSTEM SET sga_target=15G SCOPE=SPFILE; then ALTER SYSTEM SET sga_max_size=16G SCOPE=SPFILE; then ALTER SYSTEM SET pga_aggregate_target=6G SCOPE=SPFILE; then restart: srvctl stop database -d {DB_NAME} && srvctl start database -d {DB_NAME}. |