Contents IndexThe database engine The Collation utility

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

With the Backup utility, you can back up running databases, database files, transaction logs, and write files.

You can access the Backup utility in the following ways:

The Backup utility makes a backup copy of all the files making up a single database. A simple database consists of two files: the main database file and the transaction log. More complicated databases can store tables in multiple files. Each file is a separate dbspace. All backup filenames are the same as the database filenames.

Running the Backup utility on a running database is equivalent to copying the database files when the database is not running. It is provided to allow a database to be backed up while other applications or users are using the database.

For more information

For a description of suggested backup procedures, see the chapter "Backup and Data Recovery".

Top of page


Backing up a database from Sybase Central

To back up a running database:

  1. Connect to the database.
  2. Right-click the database and click Backup in the popup menu. The Backup Wizard is displayed.
  3. Follow the instructions in the Wizard.

To back up a database file or a running database:

  1. Open the Database Utilities folder in the left panel.
  2. Double-click Backup Database in the right panel.
  3. Follow the instructions in the wizard.

  For full information on backing up a database from Sybase Central, see the Sybase Central online Help. For more information about options, see "Backup utility options"

Top of page


Backing up a database from the ISQL Database Tools window

To use the Backup utility from the ISQL Database Tools window:

  1. Select Database Tools from the Window menu.
  2. Click Backup Database Files on the Tools list.
  3. Enter a user ID and password to use when connecting to the database.
  4. For a running database, enter a database name and server name (if more than one is running). For a database file, enter the filename (with path) and optionally a start line to specify command-line switches for the database engine or SQL Anywhere Client.
  5. Click Backup, and select from the options displayed in the dialog.
  6. Click OK to back up the database.

Top of page


Backing up a database using the DBTOOL statement

Syntax

The syntax to access the Backup utility from the ISQL DBTOOL statement is as follows:

     DBTOOL BACKUP TO directory
          ...     [DBFILE] [ WRITE FILE ][ [ TRANSACTION ] LOG ]
              | [ ALL FILES ]
          ...    | [ RENAME [ TRANSACTION ] LOG ]
              | [ TRUNCATE [ TRANSACTION ] LOG ]
          ...    [ NOCONFIRM ] USING connection-string

Example

The following statement connects to and backs up the sample database, to directory C:\TEMP.

     DBTOOL BACKUP TO 'c:\temp' DBFILE
     USING 'dbf=c:\sqlany50\sademo.db;uid=dba;pwd=sql'

Top of page


The DBBACKUP command-line utility

Syntax

     dbbackup [switches] directory

Windows 3.x syntax

     dbbackw [switches] directory

Switch Description
-c"keyword=value; ..." Supply database connection parameters
-d Only back up main database file
-k Change backup transaction log naming convention
-lfile Live backup of transaction log to file
-ofile Log output messages to file
-q Quiet mode---do not print messages
-r Rename and start new transaction log
-t Only back up transaction log
-w Only back up write file
-x Delete and restart transaction log
-y Replace files without confirmation

If none of the switches -d, -t, or -w are used, all database files are backed up.

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

Top of page


Backup utility options

Connection parameters (-c ) For a description of the connection parameters, see "Database connection parameters". If the connection parameters are not specified, connection paremeters from the SQLCONNECT environment variable are used, if set. The user ID must have DBA authority.

For example, the following statement backs up the sademo database running on the server sample_server, connecting as user ID DBA with password SQL:

     dbbackup -c "eng=sample_server;dbn=sademo;uid=dba;pwd=sql"

Backup main database only (-d ) Back up the main database files only, without backing up the transaction log file or a write file, if one exists.

Change backup transaction log naming convention (-k) This option changes the naming convention of the backup transaction log file to YYMMDDxx.LOG, where xx is a number from 00 to 99 and YYMMDD represents the current year, month and day. By default the name used for the backup transaction log file is identical to the file name of the transaction log being backed up.

Live backup (-l lower-case L) This option is provided to enable a secondary system to be brought up rapidly in the event of a server crash. A live backup does not terminate, but continues running while the server runs. It runs until the primary server crashes. At that point it is shut down, but the backed up log file is intact and can be used to bring a secondary system up quickly.

Output messages to log (-o ) Sends backup messages to a named log file.

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

Rename and start new transaction log (-r ) This option forces a checkpoint and the following three steps to occur:

Back up the transaction log file only (-t ) This can be used as an incremental backup since the transaction log can be applied to the most recently backed up copy of the database file(s).

Back up the database write file only See DBWRITE for a description of database write files. For the DBBACKUP command-line utility, this is the -w command-line switch.

Delete and restart the transaction log (-x ) With this option, the existing transaction log is backed up, then the original is deleted and a new transaction log is started with the same name. This option causes the backup to wait for a point when all transactions from all connections are committed.

Operate without confirming actions (-y ) Without this option, you are prompted to confirm the creation of the backup directory or the replacement of a previous backup file in the directory.

Top of page


Contents IndexThe database engine The Collation utility