How to create Oracle RAC database using dbca silent mode with different db_name and db_unique_name

oracle

I have a requirement to use dbca (version 11.2.0.3) silent mode to create a RAC database on a 2-node RAC and the db_name and db_unique_name must be different, I tried following dbca command

$ORACLE_HOME/bin/dbca -silent -createDatabase -templateName 'General_Purpose.dbc' -adminManaged -emConfiguration NONE -gdbName 'oiddb' -sid 'oiddb' -sysPassword oracle -systemPassword oracle -asmSYSPassword oracle -asmsnmpPassword oracle -storageType ASM -diskGroupName DATA -datafileJarLocation /u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/templates -nodelist 'node1,node2' -characterset AL32UTF8 -obfuscatedPasswords false -sampleSchema false -oratabLocation /etc/oratab -initParams db_unique_name=oiddbp,processes=7000,db_name=oiddb -listeners LISTENER_OID

But it failed at this error

DBCA_PROGRESS : 85%
ORA-17502: ksfdcre:4 Failed to create file +DATA/oiddb/spfileoiddb.ora
ORA-15173: entry 'oiddb' does not exist in directory '/'

PRCR-1079 : Failed to start resource ora.oiddbp.db
CRS-5017: The resource action "ora.oiddbp.db start" encountered the following error:
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+DATA/oiddb/spfileoiddb.ora'
ORA-17503: ksfdopn:2 Failed to open file +DATA/oiddb/spfileoiddb.ora
ORA-15056: additional error message
ORA-17503: ksfdopn:2 Failed to open file +DATA/oiddb/spfileoiddb.ora
ORA-15173: entry 'oiddb' does not exist in directory '/'
ORA-06512: at line 4
. For details refer to "(:CLSN00107:)" in "/u01/app/11.2.0/grid/log/node1/agent/crsd/oraagent_oracle/oraagent_oracle.log".

I was monitoring my ASM during the run and I can see +DATA/oiddbp got created, but it seems that dbca was trying to create the spfile under +DATA/oiddb.

I then tried to create the database with the same parameters using dbca UI mode and it did create +DATA/oiddbp and spfile under it.

I am wondering if this could be an Oracle bug? Any workaround or how to resolve this? Please help, thanks.

Best Answer

Since you asked RAC, please see if you can use this non-RAC example as a starting point. For db_name != db_unique_name != sid - Non-RAC - Oracle 12.1 - Custom Database (not seed)

On the command line, set ddbname == parameter db_unique_name, and also set parameter db_name

dbca    \
-silent \
-createDatabase \
-templateName    wailua.dbt     \
-sid wailua20           \
-gdbname wailuaq        \
-initParams db_unique_name=wailuaq,db_name=wailua       \

where wailua.dbt is copied from New_Database.dbt

db_name and db_unique_name are not mentioned in wailua.dbt

Note that variables SID and DB_UNIQUE_NAME expand in the template.

[oracle@waipio1 wailua20 templates]$ echo $ORACLE_SID
wailua20

[oracle@waipio1 wailua20 templates]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Jun 11 00:48:22 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      wailua
SQL> show parameter db_unique_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      wailuaq

oratab:
wailua20:/app/oracle/product/12.1.0/db_1:N:         # line added by Agent

ASM:
asmcmd ls data/WAILUAQ/
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfilewailua20.ora

Full crdb.wailua.ksh dbca script: http://pastebin.com/vx3k5g3U/

dbca log: http://pastebin.com/8UQDEDZn/