Recreate the sample database

Testing features and completing the tutorials in the SQL Anywhere documentation sometimes results in changes to the sample database that can prevent the successful completion of subsequent tutorials and tests. When this happens, you can restore the sample database to its original state. Alternatively, if you need to preserve the sample database in its current state, then you can recreate the sample database in its original state using a different name. Both methods are presented below.

To recreate the sample database
  1. At a command prompt, change to the samples directory.

    For the default location of samples-dir, see SQLANYSAMP11 environment variable.

  2. Execute the following command to erase demo.db:

    dberase demo.db
  3. Type y when prompted to confirm your choice and to delete the transaction log.

  4. Execute the following command to create a new, empty sample database:

    dbinit demo.db
  5. At a command prompt, change to the install-dir\scripts directory.

    For information about the default location of install-dir, see SQLANY11 environment variable.

  6. Execute the following command to load the new sample database with objects and data:

    dbisql -c "DSN=SQL Anywhere 11 Demo" mkdemo.sql
To recreate the sample database using a different name
  1. At a command prompt, change to the samples directory.

    For information about the default location of samples-dir, see SQLANYSAMP11 environment variable.

  2. Execute the following command to create a database called mydemo.db:

    dbinit mydemo.db
  3. Execute the following command to start the database:

    dbeng11 mydemo.db
  4. At a command prompt, change to the install-dir\scripts directory.

    For the default location of install-dir, see SQLANY11 environment variable.

  5. Execute the following command to load mydemo.db with the objects and data used to create the demo database:

    dbisql -c "UID=DBA;PWD=sql" mkdemo.sql