Routine Backups

Code samples, background information, and tips for standard backup options.

FULL Backups

FULL backups make a complete copy of the database. The FULL keyword is optional. This example backs up a database to two tape devices:
BACKUP DATABASE
    TO '/dev/rmt/0'
    TO '/dev/rmt/1'
WITH COMMENT 'Jan 18 full backup of iquser'
This example restores the database:
RESTORE DATABASE 'iquser' 
    FROM '/dev/rmt/0' 
    FROM '/dev/rmt/1'

INCREMENTAL Backup

INCREMENTAL backups copy all transactions since the last backup of any type. To make an incremental backup, use the INCREMENTAL keyword. This example creates an incremental backup of the database onto one tape device:
BACKUP DATABASE
INCREMENTAL
    TO '/dev/rmt/0' SIZE 150
WITH COMMENT 'Jan 30 incremental backup of iquser'
The SIZE parameter specifies the maximum storage capacity per output device.

INCREMENTAL SINCE FULL Backups

INCREMENTAL SINCE FULL backups back up all changes to the database since the last full backup. This example backs up the database to two tape devices:
BACKUP DATABASE  
INCREMENTAL SINCE FULL 
TO '/dev/rmt/0' SIZE 10000000 
TO '/dev/rmt/2' SIZE 15000000
All blocks changed since the last full backup are saved to separate tape devices.

Read-Only Files and Dbspaces

The READWRITE and READONLY keywords limit backups to read-write or read-only files or dbspaces. The read-write dbspaces and files must be SAP Sybase IQ dbspaces.

Back up a read-only dbspace to a tape device:
BACKUP DATABASE READONLY DBSPACES dsp1 
TO '/dev/rmt/0'
Restore the dbspace:
RESTORE DATABASE READONLY DBSPACES dsp1 
FROM '/dev/rmt/0'
Back up read-only files to bkp.f1f2:
BACKUP DATABASE READONLY FILES dsp1_f1, dsp1_f2 
TO 'bkp.f1f2'
Back up read-only dbspaces and read-only files to bkp.RO:
BACKUP DATABASE READONLY DBSPACES dsp2, dsp3 READONLY FILES dsp4_f1, dsp5_f2 
TO 'bkp.RO'
Related concepts
Cache Dbspace Backup
System-Level Backups
Virtual Backups