Earlier in my blog post, I demonstrated how to create golden image templates using dbca GUI.  Now, my goal is to show you how to perform the same tasks but all through the dbca command-line-interface.  You will notice the  command line interface is significantly easier to use and has no dependency on X-windows.

In our example, we are leveraging /bkups file system for our backups.  The whole idea is to leverage NFS and place all of our golden images of databases to be shared across all the servers.

As we deploy our golden image template to all the target database servers, we just need to copy over the db_gold_01.dbc file (see below) and copy the file to the $ORACLE_HOME.  This dbc file should be part of our /u01 tar that we copy to every node.  

1. Create a Golden Image Database Templates from an Existing Database on Source

# cd db home on the source
$ > cat create_clone_template.ksh 
export BKUP_DIR=/bkups/templates
dbca -silent -createCloneTemplate \
-sourceSID RACDB \
-templateName db_gold_01 \
-sysDBAUserName sys \
-sysDBAPassword oracle123 \
-maintainFileLocations false \
-datafileJarLocation $BKUP_DIR

–output……

$ > ./create_clone_template.ksh 
Gathering information from the source database
4% complete
8% complete
13% complete
17% complete
22% complete
Backup datafiles 
28% complete
88% complete
Creating template file
100% complete
Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/silent.log_2013-05-08_08-36-32-AM” for further details.

2. Locate the the tempate xml file in the format of .dbc 
dtccrac > find . -name ‘*.dbc’
./assistants/dbca/templates/General_Purpose.dbc
./assistants/dbca/templates/Data_Warehouse.dbc
./assistants/dbca/templates/db_gold_01.dbc

3. Copy to the target

— to /bkups/templates
$ > ls -l /bkups/templates
total 282784
-rw-r—– 1 oracle oinstall 18497536 May 8 08:37 gb_gold_01.ctl
-rw-r—– 1 oracle oinstall 270778368 May 8 08:37 gb_gold_01.dfb

— to $ORACLE_HOME/assistants/dbca/templates
db_gold_01.dbc

4. Create the database from template

dbca -silent \
-createDatabase \
-templateName db_gold_01.dbc \
-gdbName dbatools \
-sid dbatools \
-SysPassword oracle123 \
-SystemPassword oracle123 \
-emConfiguration NONE \
-redoLogFileSize 200 \
-recoveryAreaDestination FRA \
-storageType ASM \
-asmSysPassword oracle123 \
-diskGroupName DATA \
-listeners LISTENER_RRAC \
-characterSet WE8MSWIN1252 \
-nationalCharacterSet AL16UTF16 \
-databaseType MULTIPURPOSE \
-nodelist rac01,rac02,rac03,rac04 \
-initparams audit_file_dest=’/bkups//dbatools/adump’ \
-initparams compatible=’11.2.0.3′ \
-initparams db_create_file_dest=’+DATA’ \
-initparams db_create_online_log_dest_1=’+DATA’ \
-initparams db_create_online_log_dest_2=’+FRA’ \
-initparams diagnostic_dest=’/bkups’ \
-initparams parallel_max_servers=64 \
-initparams pga_aggregate_target=1824522240 \
-initparams processes=600 \
-initparams sga_target=4294967296 \
-initparams db_recovery_file_dest=’+FRA’ \

-initparams db_recovery_file_dest_size=4322230272