The DB init scripts initialize the database for products being configured, creating schemas and importing initial data required for some Oracle ATG Web Commerce products. Scripts are declared in the <ATG10dir>/module_name/cim/dbinit.xml file.

The dbinit.xml file has three top-level elements: schema, data-import, and server-instance-type.

The schema element identifies the database schema to be modified, and contains the tasks that do the work of running the scripts. These schema IDs are then specified for a particular server-instance-type and datasource. The IDs for server-instance-type and datasource come from the selected product.xml file. There is a special ID all that can be used for both server-instance-type and datasources. The order for processing is:

Which dbinit.xml files are used is based on the module list for the server-instance-type of the datasource. CIM looks at the full list. For every dbinit.xml found, it proceeds through the four steps to create a list of what to run. For example, if you create a custom module that requires DAS, CIM automatically runs the DAS table creation scripts (as long as they match the specified criteria).

The server-instance-type element identifies which server-instance-type (as defined in product.xml) is associated with this schema, since many of them have different database needs; for example, a reporting server needs certain utility tables that are not otherwise required by the platform.

Within the schema element you can specify SQL scripts and database import scripts to run. To specify a SQL script, use the structure shown in this example:

<create>sql/db_components/${database}/versioned_ddl.sql</create>

The path is relative to the module the dbinit.xml file is in. For example, if the file is in DAS/CIM, the path is relative to the DAS module, and using the example above would end up as DAS/sql/database. The database value is passed in based on the user’s previous selections.

The data-import element contains database initialization scripts, and includes the following elements:

A detailed example follows. Note that data-import element paths are relative to the Oracle ATG Web Commerce installation location, while repository-loader paths are relative to the specified source module (src-module. The repository-loader element’s post-cleanup attribute is used to clean up data that is used during the installation, but which should not be included in a database used by a running Oracle ATG Web Commerce server.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE database-initializer SYSTEM "http://www.atg.com/dtds/dbinit_1_0.dtd">
<database-initializer>

<schema id="versionedSchema">

     <sql>
          <path>
               <create>
                    sql/db_components/${database}/versioned_ddl.sql
               </create>
               <drop>
                    sql/uninstall/${database}/drop_versioned_ddl.sql
               </drop>
          </path>
     </sql>

     <data-import>
          <repository-path>/atg/epub/file/PublishingFileRepository
</repository-path>
          <import-file-path>/Publishing/base/install/epub-file-repository
-data.xml</import-file-path>
          <user>publishing</user>
          <workspace>workspace</workspace>
          <comment>initial_data_import</comment>
     </data-import>

     <repository-loader post-cleanup="true">
          <files>
               <src-module>DSS</src-module>
               <config-path>atg/registry/data/scenarios/DSS</config-path>
               <file-pattern>*.sdl</file-pattern>
          </files>
          <files>
               <src-module>DSS</src-module>
               <config-path>atg/registry/data/scenarios/recorders</config-path>
               <file-pattern>*.sdl</file-pattern>
          </files>
          <file-mapping>/atg/epub/file/typemappers/ScenarioTypeMapping
</file-mapping>
     <folder-mapping>/atg/epub/file/typemappers/FileFolderTypeMapping
</folder-mapping>
     </repository-loader>

</schema>

<server-instance-type id="management">
   <datasource id="management">
        <schema id="versionedSchema"/>
   </datasource>
</server-instance-type>

<server-instance-type id="production">
   <datasource id="all">
       <schema id="nonVersionedSchema"/>
   </datasource>
</server-instance-type>

</database-initializer>

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices