Regularly perform a remote backup of data so it can be recovered.
Before you back up system data, ensure the data is valid.
SQL Anywhere has various utilities to help you with these tasks:
-
dbvalid – validates the integrity of the database by checking the index keys on some or all of the tables in a database, as well as on the database file itself.
-
dblocate – locates any SQL Anywhere database servers (consolidated or cluster) running over TCP/IP on the immediate network, and prints a list of the database servers and their addresses. This list includes alternate server names. Depending on your network, it may take several seconds for dblocate to print its results.
-
dbbackup – makes a backup copy of all files for a single database from a remote backup location. A simple database consists of two files: the main database file and the transaction log. If you mirrored the transaction log you need not back up this file. All backup file names are identical to database file names. The image backup contains a separate file for each backed-up file.
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.
- Validate the databases:
- Ensure there are no active connections to the server.
- Validate the consolidated database:
dbvalid.exe -c "DBF=default.db;UID=dba;PWD=SQL"
- Validate the cluster database:
dbvalid.exe -c "DBF=clusterdb.db;UID=dba;PWD=SQL"
- On the backup machine, verify that SQL Anywhere software is installed, and the PATH is set.
- Back up the databases to archive the system data:
- For consolidated 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
This creates defaullt.db, default.log, clusterdb.db, and clusterdb.log in the \SQLAnybackup directory on the backup computer.
- As a precaution, validate the backups are suitable for recovery:
- On the backup computer, create a temporary working directory (such as \tmp).
- 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.
- Copy *.log to these locations.
- 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.