[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1433
  • Last Modified:

Manage Templates in Oracle 10g

I have created a template from computer A. Can I create a db in Computer B using the template from computer A instead of using RMAN ?
1 Solution
DBCA Templates:

a. Templates are used by the DBCA to create new databases or make clones of
   existing databases.

   DBCA Templates are XML files containing information required to create a
   database.  This includes:
   - database options
   - init.ora parameters
   - storage attributes (datafiles, tablespaces, controlfiles and redologs)

b. These templates reside in the "$ORACLE_HOME/assistants/dbca/templates"
   directory.  In this directory you can see the following:

   - Data_Warehouse.dbc          
   - General_Purpose.dbc
   - Transaction_Processing.dbc
   - New_Database.dbt            

c. Types of Templates

   1. Seed Templates (files with a '.dbc' extension)
      -> Contain information about a clone database.
      -> Data files and redo logs are stored in zipped format in another file
         with a '.dfj' extension.
      -> Usually the corresponding '.dfj' of a '.dbc' has the same file name:
             Data_Warehouse.dfj and Data_Warehouse.dbc,
             Transaction_Processing.dfj and Transaction_Processing.dbc
      -> But it is not necessary to have the same name since the '.dfj' file is
         referred by a <Location> tag under <DataFiles> within the '.dbc file'.

    2. Non-Seed Templates (files with a '.dbt' extension)
       -> Are used to create new databases from scratch.
       -> Contain characteristics of the database to be created.
       -> Are more flexible compared to their seed counter parts since all
          datafiles and redo logs are created from scratch. The file names,
          sizes, and other attributes can be changed as required.

Creating Templates Using the DBCA:
Users can create their own custom templates from:

a. An existing database:  
   -> Structure only, i.e. using a non-seed template.
      You can run DBCA from remote machines.

    -> Structure as well as data, i.e. using a seed template.
       Run DBCA from the same machine where the database is running.

    You can choose an option to translate file paths into OFA (Oracle Flexible
    Architecture) or maintain the file paths. OFA is recommended if the machine
    where you create the database using this template has a different directory
    structure (ORACLE_HOME, etc.). Non-OFA (maintaining file paths) can be used
    if the target machine has a similar structure.

- OR -                              
b. An existing template using the Manage Templates option of the DBCA
   operations page:        
   -> seed to seed template                
   -> non-seed to non-seed template

Running DBCA:
The DBCA can be run in three modes:  
-> Interactive
-> Silent
-> Progress Only
In Silent and Progress_Only modes, you can only create databases (both new and
clone) and templates (both seed and non-seed). Other options like 'Configuring
Database' and 'Deleting Database' are available in Interactive mode only.
Here are some examples on how to use DBCA in different modes. To get all
available options, type 'dbca -help' at the command line.

a. Interactive Mode
   By default (without any parameters) DBCA runs in interactive mode.
   It presents the Wizard to:
   -> Create/Delete/Configure Databases
   -> Create/Delete Templates

b. Progress Only Mode

   Progress only mode is typically used by other tools to create a database.
   - The Installer uses DBCA to create initial database
   - EMCA and OID Assistants use DBCA to create databases.
   In this mode, only the progress bar is shown.

c. Silent Mode

   Silent mode does not provide any User interface or User interaction. It
   outputs all messages including information, error and warnings into log
   ********* **************************************************
   Example1  Creating a clone database from a non-seed template
   ********* **************************************************
   % dbca -silent -createDatabase \
                  -templateName New_Database.dbt \
                  -gdbname V901 -sid V901 \
                  -characterset WE8ISO8859P1 \
                  -continueOnNonFatalErrors true

    where -continueOnNonFatalErrors allows the DBCA to go on when a non fatal
    error occurs such as not enough space left on device (/ora9i/oradata).
    You can view the error messages in the file:

    Errors that prevent the database from being created are logged in the
    "$ORACLE_HOME/admin/<DBNAME>/create" directory:

        characterSet.log, CloneDBCreation.log, lockAccount.log,
        <DBNAME>.log, postDBCreation.log, postScripts.log

    Logs reporting that the database is created are also in the
    $ORACLE_HOME/admin/<DBNAME>/create" directory:

        CreateDBCatalog.log, CreateDBFiles.log, CreateDB.log

    ********* **************************************************
    Example2  Creating a seed template from an existing database
    ********* **************************************************
    % dbca -silent -createCloneTemplate \
                   -sourceDB V901
                   -sysDBAUserName sys -sysDBAPassword change_on_install \
                   -templateName copy_of_ora9i \
                   -datafileJarLocation /ora9i/assistants/dbca/templates
    When completed:
    -> a log file is generated, such as "/ora9i/assistants/dbca/logs/1.log"
       that contains a message similar to:
       "The generation of the clone database template "copy_of_ora9i"
       is successful."
     -> a large binary zipped format file copy_of_ora9i.dfj is created in
        the datafileJarLocation directory "/ora9i/assistants/dbca/templates".

    ********* ******************************************************
    Example3  Creating a non-seed template from an existing database
    ********* ******************************************************

    % dbca -silent -createTemplateFromDB \
                   -sourceDB V901 \
                   -sysDBAUserName sys -sysDBAPassword change_on_install \
                   -templateName copy_of_ora901
    When completed:
    -> a log file is generated, such as "/ora9i/assistants/dbca/logs/17.log",
       that contains a message similar to:
       "The template "copy_of_ora901" creation completed."
    -> a small text file copy_of_ora901.dbt is created in datafileJarLocation
       directory "/ora9i/assistants/dbca/templates".


Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now