Contents IndexThe Validation utility The SQL Preprocessor

User's Guide
   Part VI. SQL Anywhere Reference
     Chapter 39. SQL Anywhere Components
      The Write File utility

The Write File utility is used to manage database write files. A write file is a file attached to a particular database. All changes are written into the write file, leaving the database file unchanged.

Using write files for development

Write files can be used effectively for testing when you do not wish to modify the production database. They can also be used in network and student environments where read-only access to a database is desired, or when you distribute on CD-ROM a database you wish users to be able to modify.

Compressed databases

If you are using a compressed database, then you must use a write file; compressed database files cannot be modified directly. The write file name is then used in place of the database name when connecting to the database or when loading a database on the database engine or server command line.

To access the Write File utility:

The Write File utility runs against a database file. The database must not be running on an engine when you run the Write File utility.

Top of page


Creating a write file from Sybase Central

To create a write file for a database:

  1. Open the Database Utilities folder in the left panel.
  2. Double-click Create Write File in the right panel. The Write File Wizard is displayed.
  3. Follow the instructions in the Wizard.

  For full information on creating a write file from Sybase Central, see the Sybase Central online Help.

Top of page


Creating a write file from the ISQL Database Tools window

To use the Write File utility from the ISQL Database Tools window:

  1. Select Database Tools from the Window menu.
  2. Click Create Write File on the Tools list.
  3. Enter the database filename (with path).
  4. Click Create, and enter a filename to use for the write file and for the write file transaction log.
  5. Click OK to create the write file.

Top of page


Creating a write file using the DBTOOL statement

Syntax

The syntax for the Write File utility from the ISQL DBTOOL statement is as follows:

     DBTOOL CREATE WRITEFILE filename FOR DATABASE filename

     ...    [ [ TRANSACTION ] LOG TO logname ] [ NOCONFIRM ]

Top of page


The DBWRITE command-line utility

Syntax

     dbwrite[switches] database-file [write-name]

Windows 3.x syntax

     dbwritew[switches] database-file [write-name]

Switch Description
-c Create a new write file
-ddatabase-file Point a write file to a different database
-fdatabase-file Force write file to point at file
-mmirror-name Set transaction log mirror name
-ofile Output messages to file
-q Quiet mode---do not print messages
-s Report write file status (default)
-tlog-name Set transaction log name
-y Erase/replace old files without confirmation

If any changes are made to the original database (not using the write file), the write file will no longer be valid. This happens if you start the engine using the original database file and make a modification to it. It can be made valid again by the command:

     dbwrite -c db-name write-name

However, this deletes all changes recorded in the write file.

The log-name and mirror-name parameters are only used when creating a new write file. The write-name parameter is only used with the -c and -d parameters. Note that the db-name parameter must be specified before the write-name parameter.

  For more information about the command-line switches, see "Write file utility options".

Top of page


Write file utility options

Create a new write file (-c ) If an existing write already exists, any information in the old write file will be lost. If no write filename is specified on the command line, the write filename will default to the database name with the extension WRT. If no transaction log name is specified, the log filename will default to the database name with the extension WLG.

Change the database file to which an existing write file points (-d ) If a database file is moved to another directory, or renamed, this option allow you to maintain the link between the write file and the database file. This option is available only from the command-line utility.

Force a write file to point to a file (-f ) This option is available only from the command-line utility. This option is for use when a write file is being created and the database file is held on a Novell NetWare or other network path, for operating systems on which they cannot be entered directly. By providing the full Novell path name for the database file, (for example: SYS\\SADEMO.DB), dependencies on local mappings of the NetWare path can be avoided. Unlike the option to change the database file pointed to, no checking is done on the specified path.

Operate quietly (-q ) Do not display messages on a window. This option is available only from the command-line utility.

Report write file status only (-s ) This displays the name of the database to which the write file points. This option is available only from the command-line utility.

Operate without confirming actions (-y ) Without this option, you are prompted to confirm the replacement of an existing database file.

Top of page


Contents IndexThe Validation utility The SQL Preprocessor