Rebuilding databases on Windows Mobile

When rebuilding a database on Windows Mobile, you have the following options:

  • Rebuild the Windows Mobile database on another platform and then copy the database to the Windows Mobile device. This is the recommended method for rebuilding a Windows Mobile database.
  • Repopulate an empty database using dbmlsync.
  • Repopulate an empty database using dbremote.
  • Use dbunload on the Windows Mobile device. This option is not available on smartphones.

The first three options are recommended when upgrading a Windows Mobile database. However, if these options are not available to you, you can use dbunload on Windows Mobile. 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

Because running dbunload on a Windows Mobile device can require more resources than some devices have available, upgrading the database on a different platform is recommended whenever possible.

Note

If you want to run dbunload on a Windows Mobile device, you must choose the Unload/Reload Support option in the Deploy SQL Anywhere 11 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.

Notes about using dbunload on Windows Mobile

To use dbunload on a Windows Mobile device, ensure you have performed the following tasks:

  • The following files should be deployed to your SQL Anywhere installation directory (by default, \Program Files\SQLAny11):
    • dbsrv11.exe
    • dbunlspt.exe
    • dbunload.exe
    • dbrunsql.exe
    • unloadold.sql
    • unload.sql
    • optdeflt.sql
    • opttemp.sql
  • The following files should be deployed to the \Windows directory:
    • dblgen11.dll
    • dblib11.dll
    • dbtool11.dll
    • dbusen.dll
  • The following registry entry string value should be set to the SQL Anywhere software directory: HKEY_LOCAL_MACHINE\SOFTWARE\Sybase\SQL Anywhere\11.0\Location.

The following steps can be embedded into 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 dbtool11.dll.

To unload a database on Windows Mobile (dbunload)

  1. On a platform other than Windows Mobile, create a new, empty SQL Anywhere 11 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 (dbicu11.dll, dbicudt11.dll) are not required by the database server.

  2. Copy the SQL Anywhere 11 software and the empty SQL Anywhere 11 database file to the Windows Mobile device. See Notes about using dbunload on Windows Mobile.

  3. Ensure there are no database servers running on the device.

  4. Run the following command:

    dbunload-path\dbunload -c "UID=DBA;PWD=DBA-password;CHARSET=none;DBF=existing-database" unload-directory
  5. Ensure that dbunload succeeded, and then close the dbunload window.

  6. Run the following command:

    dbrunsql-path\dbrunsql -c "UID=DBA;PWD=sql;CHARSET=none;DBF=new-empty-SQLAnywhere11databasefile" -g- \reload.sql
  7. Ensure that dbrunsql succeeded, and then close the dbrunsql window.

  8. Remove the reload.sql file and unload-directory from the Windows Mobile device.