DBCA – variables inside Database templates

Other day at work my need was to create some template for a database to install on both Windows and Solaris platform. My choice was obvious, database templates and use dbca to install on silent mode. I looked at an original database template located at $ORACLE_HOME/assistants/dbca/templates and find out that is possible (somehow) use variables.

Example:

<datafilesList>
 <TablespaceDatafileAttributes id="{ORACLE_BASE}/{DB_UNIQUE_NAME}/undotbs01.dbf">
  <id>-1</id>
 </TablespaceDatafileAttributes>
 </datafilesList>

As you can see, template uses some variables, but they are not environment (or system) variables, but dbca variables. After some research, i’ve found nothing on  “The Internet” regarding this need, so i’m writing this “how-to” blog post.

To use variables in dbca templates

1) Replace whatever you want to a variable name. This example, i’ve created a variable called ORADATA:

 <DatafileAttributes id="{ORADATA}/users01.dbf">
         <tablespace>USERS</tablespace>
        <temporary>false</temporary>
       <online>true</online>
       <status>0</status>
       <size unit="MB">5</size>
        <reuse>true</reuse>
        <autoExtend>true</autoExtend>
       <increment unit="KB">1280</increment>
         <maxSize unit="MB">-1</maxSize>
    </DatafileAttributes>

2) run: dbca -silent -createDatabase -gdbName TEST_DB -variables ORADATA=/u01/disk1/

Advertisements

One thought on “DBCA – variables inside Database templates

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s