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

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Database Administration » SQL Anywhere database connections » SQL Anywhere for Windows Mobile » Windows Mobile database configuration » Database rebuilding on Windows Mobile


Rebuilding a database on Windows Mobile

Rebuild a database on Windows Mobile using the Unload (dbunload) and Script Execution (dbrunsql) utilities. This rebuild option is not available for smartphones. This option is not recommended it can require more resources than some devices have available. It is recommended that you rebuild the database on another platform and then copy the database to the Windows Mobile device.


Ensure the database is not running. Ensure there are no database servers running on the device.

You must have the SELECT ANY TABLE and SERVER OPERATOR system privileges.


To run dbunload on a Windows Mobile device, you must choose the Unload/Reload Support option in the Deploy SQL Anywhere 16 for Windows Mobile Wizard. You can modify your SQL Anywhere installation to add this support if you did not select this option when you first installed SQL Anywhere for Windows Mobile.

Contexte et remarques

Before deciding to use dbunload on Windows Mobile, you should consider the following implications of using dbunload on Windows Mobile:

  • the size of the database server's temporary file (both the unload and reload can cause this file to grow to several megabytes)

  • the extra space required for dbunload and related components

  • the extra cost of having multiple copies of a database on the Windows Mobile device

  1. To use dbunload on a Windows Mobile device, ensure that:

    • The following files are deployed to your SQL Anywhere installation directory (by default, \Program Files\SQLAny16):

      • dbsrv16.exe
      • dbsrv16.lic
      • dbunlspt.exe
      • dbunload.exe
      • dbrunsql.exe
    • The following files are deployed to the \Windows directory if you are intending to unload old (version 9 or earlier) databases and you are including dbunlspt.exe.

      • scripts\optdeflt.sql
      • scripts\opttemp.sql
      • scripts\unloadold.sql
    • The following files are deployed to the \Windows directory:

      • dblgen16.dll
      • dblib16.dll
      • dbscript16.dll
      • dbtool16.dll
      • dbusen.dll
  2. Ensure that the Location string value (REG_SZ) is set to the SQL Anywhere software directory, inside the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Sybase\SQL Anywhere\16.0\.

  3. On a platform other than Windows Mobile, create a new, empty SQL Anywhere 16 database.

    The CHAR collation sequence should match that of the existing database. If NCHAR UCA sorting is not required, the NCHAR collation sequence should be UTF8BIN. In this way, the ICU libraries (dbicu16.dll, dbicudt16.dat) are not required by the database server.

  4. Copy the SQL Anywhere 16 software and the empty SQL Anywhere database file to the Windows Mobile device.

  5. Run the following command to unload the database:

    dbunload-path\dbunload -c "UID=DBA;PWD=DBA-password;CHARSET=none;DBF=existing-database" unload-directory
  6. When dbunload completes, close the dbunload window.

  7. Run the following command to run the reload.sql script file against the empty SQL Anywhere database file:

    dbrunsql-path\dbrunsql -c "UID=DBA;PWD=sql;CHARSET=none;DBF=new-empty-SQLAnywhere16database-file" -g- \reload.sql
  8. When dbrunsql completes, close the dbrunsql window.

  9. You can remove the reload.sql file and unload-directory from the Windows Mobile device.


The database is rebuilt.


The dbunload and dbrunsql commands can be used in third-party Windows Mobile applications so that the process is automated for the end user. If you choose to do this, then you should consider using the -qc and/or -q dbunload and dbrunsql options or calling the DBUnload function in dbtool16.dll.

 See also