Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » UltraLite - Database Management and Developer Guide » UltraLite database reference » UltraLite utilities

UltraLite Database Unload utility (ulunload)

Unloads either an entire UltraLite database to XML or SQL, or all or part of UltraLite data to XML or SQL.

Syntax
ulunload -c "connection-string" [ options ] output-file
Option Description
@ data Use this to read in options from the specified environment variable or configuration file. If both exist with the same name, the environment variable is used.

-b max-size

OR

--maxblob=max-size

Set the maximum size of column data to be stored in the XML file. The default is 10 KB. To store all data in the XML file (no maximum size), use -b -1.

-c "connection-string"

OR

--connect="connection-string"

Required. Connect to the database as identified in the DBF or file_name parameter of your connection-string. If you do not specify both a user ID and a password, the default UID of DBA and PWD of sql are assumed.

-d

OR

--dataonly

Only unload the data from the database to the output file. Do not unload any schema information.

-e table,...

OR

--exclude=table,...

Exclude the named table when unloading the database. You can name multiple tables in a comma-separated list. For example:

-e mydbtable1,mydbtable5

-f directory

OR

--filedir=directory

Set the directory to store data larger than the maximum size specified by -b. The default is the same directory as the output file.

-l filename

OR

--log=filename

Log operations to the specified file.

-n

OR

--schemaonly

Unload schema only, ignoring any data in the database.

-q

OR

--quiet

Set the utility to run in quiet mode. Suppress informational banners, version numbers, and status messages. Error messages are still displayed, however.

-s

OR

--sql

Unload as SQL Anywhere-compatible SQL statements. SQL file output can be read by UltraLite or SQL Anywhere using DBISQL.

-t table,...

OR

--include=table,...

Unload data in the named table only. You can name multiple tables in a comma separated list. For example:

-t mydbtable2,mydbtable6

-v

OR

--verbose

Print verbose messages.

-x owner

OR

--owner=owner

Output tables so they are owned by a specific user ID. You can use this option with the -s option.

-y

OR

--overwrite

Overwrite output-file without confirmation.

-?

OR

--help

Displays utility usage information and exits.
output-file Required. Set the name of the file that the database is unloaded into. If you use the -s option, database is unloaded as SQL statements. Otherwise, the database is unloaded as XML.
Remarks

By default, ulunload outputs XML that describes the schema and data in the database. You can use the output for archival purposes, or to keep the UltraLite database portable across all releases.

Saving a database with a synchronization profile results in XML that is incompatible with earlier versions of the UltraLite utilities. A workaround is to edit the XML and remove the text section marked with

<syncprofiles>...</syncprofiles>

Unloading a database does not preserve:

  • Synchronization state, stored synchronization counts, and row deletions. Ensure you synchronize the database before unloading it.

  • UltraLite user entries.

To confirm what database options or properties have been preserved, run ulinfo after you have reloaded your database with the ulload utility.

If column data exceeds the maximum size you specified with -b, the overflow is saved to a *.bin file in either:

  • the same directory as the XML file
  • the directory specified by -f.

The file follows this naming convention:

tablename-columnname-rownumber.bin

The -x option allows you to assign ownership to UltraLite tables. You only need to assign an owner to a table if you intend to use the resulting SQL statements for creating or modifying a SQL Anywhere database. When read by UltraLite, the owner names are silently ignored.

This utility returns error codes. Any value other than 0 means that the operation failed.

If you are using this utility to unload a database on the Windows Mobile device directly, UltraLite cannot back up the database before the unload or action occurs. You must perform this action manually before running these wizards.

Example

Unload the sample.udb database into the sample.xml file.

ulunload -c DBF=sample.udb sample.xml

Unload the data from the sample.udb database into a SQL file called sample.sql. Overwrite the SQL file if it exists.

ulunload -c DBF=sample.udb -d -y -s sample.sql