Backing Up Database Files

Regularly perform a remote backup of data so it can be recovered. Before you back up system data, ensure the data is valid.

Note: Depending on the design of your production environment, the dbvalid and dbbackup commands may not work remotely.

The database server is named <clustername>_primary.

  1. Validate the databases:
    1. Ensure there are no active connections to the server.
    2. Validate the cache database:
      dbvalid.exe -c "DBF=default.db;UID=dba;PWD=SQL"
    3. Validate the cluster database:
      dbvalid.exe -c "DBF=clusterdb.db;UID=dba;PWD=SQL"
    4. Validate the monitoring database:
      dbvalid.exe -c "DBF=monitor.db;UID=dba;PWD=SQL"
  2. On the backup machine, verify that SQL Anywhere software is installed, and the PATH is set.
  3. Back up the databases to archive the system data:
    • For cache databases, run:
      dbbackup -c "ENG=<clusterName>_primary;DBN=default;UID=dba;PWD=SQL" \SQLAnybackup
    • For cluster databases, run:
      dbbackup -c "ENG=<clusterName>_primary;DBN=clusterdb;UID=dba;PWD=SQL" \SQLAnybackup
    • For monitor database, run:
      dbbackup -c "ENG=<clusterName>_primary;DBN=monitor;UID=dba;PWD=SQL" \SQLAnybackup

    This creates default.db, default.log, clusterdb.db, and clusterdb.log, and monitor.db, monitor.log in the \SQLAnybackup directory on the backup computer.

  4. As a precaution, validate the backups are suitable for recovery:
    1. On the backup computer, create a temporary working directory (such as \tmp).
    2. Under the temporary directory, create an identical directory structure for the two log locations. You may need to use the subst command to map local directories to drive letters used on the runtime computers to the backup location.
    3. Copy *.log to these locations.
    4. Run dbvalid on the \tmp copy of the .db file.
      WARNING: Do not run dbvalid on the backup copy itself (in the \SQLAnybackup directory of this example). The command runs, but corrupts your .db file so it cannot be used in recovery.
      • If validation succeeds, the backup in \SQLAnybackup can be used for recovery; delete the files in the \tmp and log directories.
      • If validation fails, the backup is not usable for recovery; try again.
Next
With the archive of the database complete, you can optionally back up the archive to a tape drive.