Using Database Stores : EMS Schema Export Tool

EMS Schema Export Tool
Each database store that appears in the stores.conf file includes a configuration parameter pointing to a database. The EMS Schema Export Tool creates and exports database tables for the database stores that are configured there. Database administrators can use the Schema Export Tool to selectively export and tune schemas to suit your database and messaging system.
 
The EMS Schema Export Tool must be used to export database tables when one or more database stores are configured in the stores.conf file. That is, if any stores of type dbstore are configured, you must export the database schema before starting the EMS server.
The Schema Export Tool is a JAR file, tibemsd_util.jar, located in the same directory as tibemsd. Command line options, described in Table 15, determine whether database tables are created or dropped, and whether they are printed to the console, saved to a file, or exported to the database.
Before invoking the Schema Export Tool, you must:
Configure the global database store parameters in the tibemsd.conf file. The parameters that configure the global database store settings begin with dbstore_. See Configuration in tibemsd.conf for details about these parameters.
Configure at least one store of type dbstore in the stores.conf file. See Configuration in stores.conf for more information about configuring database stores.
How the Schema Export Tool Works
When it is invoked, the Schema Export Tool accepts the tibemsd.conf file and reviews the database store parameters, then parses the stores.conf file. Depending on the options specified when it was invoked, the Schema Export Tool will create, drop, or update the database tables for the stores of type dbstore that are configured in the stores.conf file.
The tool can perform the selected actions on all database stores, or only on specific stores. The Schema Export Tool can also print the database tables it creates to the console, or export them either to the database or to a specified file.
Running the Schema Export Tool
The Schema Export Tool is invoked from the command line. The tool can be invoked from its directory, or by giving the absolute path to the tibems_util.jar file. For example:
On Windows
> java -jar EMS_HOME\bin\tibemsd_util.jar options
Or
> java -jar c:\tibco\ems\6.0\bin\tibemsd_util.jar options
 
On Unix
> java -jar EMS_HOME/bin/tibemsd_util.jar options
Or
$ java -jar /opt/tibco/ems/6.0/bin/tibemsd_util.jar options
 
This table shows the options that are used with the Schema Export Tool:
The absolute path to the tibemsd.conf file. For example, on a UNIX system:
/opt/tibco/ems/6.0/samples/config/tibemsd.conf
-exporttofile
Export the schema to a file named store-name.ddl.log, where store-name is the name of the database store. If multiple database stores are configured in stores.conf, then one file is created for each database store.
If neither exporttofile nor export option is included, the schema export tool prints the schema to the console.
If both -eporttofile and -export are included, the Schema Export Tool exports the database schema to both locations.
-export
If neither export nor exporttofile option is included, the schema export tool prints the schema to the console.
If both -eport and -exporttofile are included, the Schema Export Tool exports the database schema to both locations.
-store storename=create|update|drop
Create, update, or drop the schema for one or more specific stores that are named in the stores configuration file.
If you choose the create option for a schema that already exists, the Schema Export Tool recreates the schema.
Note that create prints the schema to screen but does not deploy it. You must use export or exporttofile in order to implement the schema.
Create all the stores found in the stores configuration file. Note that this option drops any existing configurations when creating the new stores.
Examples
The following examples show how the Schema Export Tool can be used to create database schemas in various configurations.
Example 1
This example shows how the Schema Export Tool can be invoked from any directory by giving the absolute path to the tibemsd_util.jar:
$ java -jar /opt/tibco/ems/6.0/bin/tibemsd_util.jar -help
Example 2
In this example, the Schema Export Tool creates and exports database schemas for all the stores found in the stores.conf that is set in the specified tibemsd-mssqlserver.conf file:
java -jar /opt/tibco/ems/6.0/bin/tibemsd_util.jar -tibemsdconf /opt/tibco/ems/6.0/samples/config/tibemsd.conf -createall -export
Example 3
In this example, the Schema Export Tool exports the database schema for the $sys.failsafe store to the database:
jar -jar /opt/tibco/ems/6.0/bin/tibemsd_util.jar -tibemsdconf /opt/tibco/ems/6.0/samples/config/tibemsd.conf –export –store \$sys.failsafe=create
Example 3
In this example, the Schema Export Tool writes the database schema for the $sys.failsafe store to the file $sys.failsafe.ddl.log:
$ jaav -jar /opt/tibco/ems/6.0/bin/tibemsd_util.jar -tibemsdconf /opt/tibco/ems/6.0/samples/config/tibemsd.conf –exporttofile –store \$sys.failsafe=create
Example 4
In this example the Schema Export Tool creates and exports the database schema for the store mystore1, but drops the schema associated with mystore2 and exports the change:
java –jar /opt/tibco/ems/6.0/bin/tibemsd_util.jar –tibemsdconf /opt/tibco/ems/6.0/samples/config/tibemsd.conf -store mystore1=create -store mystore2=drop -export