Database to SQL Script Utility
The Database to SQL Script utility will produce an SQL Script from any given PLEXOS Database, (both Input and Solution databases), which will create and populate an SQL Database with the corresponding schema and data. It currently creates Primary Keys, Foreign Key Relationships and Unique Constraints.
Command Line Usage
> DataSetToSQL --help
DatasetToSQL <database_filename> <output_filename> [--drop] [--target=<dbms>] [--progress] [--compress]
<database_filename> can be an input database (*.xml) or a Solution database (*.zip)
--drop Generate SQL to DROP the database if it already exists.
--target=<dbms> Generates SQL supported by a specific DBMS. (default=sqlserver)
Valid <dbms> values are: sqlserver, mysql, oracle
--progress Generates progress messages in the SQL Script.
--compress Writes the output file to a ZIP archive.
DBMS Support
At the present time, SQL Server, MySQL and Oracle are supported. Use the –target command line argument to specify which DBMS you intend to run the script for.
Usage Notes
The sql script generated may be quite large. It may be necessary, therefore, to execute the resulting script from the command line, using sqlcmd with the –i argument in SQL Server, or with the mysql command line in MySQL, or sqlplus for Oracle.
Examples:
sqlcmd –i script.sql
mysql –u=root < script.sql
To reduce file size, you can use the –compress option to write to a .zip file.

