Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 11 Using Database Stores : EMS Schema Export Tool

EMS Schema Export Tool
Each database store that is configured for an EMS server includes a configuration parameter pointing to a database. The EMS Schema Export Tool creates and exports database tables for the database stores. Database administrators can use the Schema Export Tool to selectively export and tune schemas to suit your database and messaging system.
 
The Schema Export Tool is a JAR file, tibemsd_util.jar, located in the same directory as tibemsd. Command line options, described in Table 57, 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 at least one store of type dbstore. 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 or tibemsd.json file and reviews the database store parameters, then parses the stores configured, either in the stores.conf file or in the JSON configuration 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.
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\8.1\bin\tibemsd_util.jar options
 
On Unix
> java -jar EMS_HOME/bin/tibemsd_util.jar options
Or
$ java -jar /opt/tibco/ems/8.1/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 or tibemsd.json file. For example, on a UNIX system:
/opt/tibco/ems/8.1/samples/config/tibemsd.conf
Text-based tibemsd.conf files are supported on all platforms.
-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, 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
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.
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/8.1/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/8.1/bin/tibemsd_util.jar -tibemsdconf /opt/tibco/ems/8.1/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/8.1/bin/tibemsd_util.jar -tibemsdconf /opt/tibco/ems/8.1/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/8.1/bin/tibemsd_util.jar -tibemsdconf /opt/tibco/ems/8.1/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/8.1/bin/tibemsd_util.jar –tibemsdconf /opt/tibco/ems/8.1/samples/config/tibemsd.conf -store mystore1=create -store mystore2=drop -export
 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved