BACKUP DATABASE Statement

Backs up an SAP Sybase IQ database on one or more archive devices.

Quick Links:

Go to Parameters

Go to Examples

Go to Usage

Go to Standards

Go to Permissions

Syntax

BACKUP DATABASEbackup-option … ]
   TO archive_devicearchive-option... ]
   … [ WITH COMMENT string ]

backup-option - (back to Syntax)READWRITE FILES ONLY | 
   READONLY dbspace-or-file [, … ] }
   CRCON | OFF }
   ATTENDEDON | OFF }
   BLOCK FACTOR integerFULL | INCREMENTAL | INCREMENTAL SINCE FULL }
   VIRTUALDECOUPLED |  
   ENCAPSULATED ‘shell_command’ } 
   WITH COMMENT comment

dbspace-or-file - (back to backup-option)DBSPACES identifier-list | FILES identifier-list }

identifier-list - (back to dbspace-or-file)
   identifier [, … ]

archive-option - (back to Syntax) 
   SIZE integer STACKER integer

Parameters

(back to top)

Examples

(back to top)

Usage

(back to top)

The SAP Sybase IQ database might be open for use by many readers and writers when you execute a BACKUP DATABASE command. It acts as a read-only user and relies on the Table Level Versioning feature of SAP Sybase IQ to achieve a consistent set of data.

BACKUP DATABASE implicitly issues a CHECKPOINT prior to commencing, and then it backs up the catalog tables that describe the database (and any other tables you have added to the catalog store). During this first phase, SAP Sybase IQ does not allow any metadata changes to the database (such as adding or dropping columns and tables). Correspondingly, a later RESTORE DATABASE of the backup restores only up to that initial CHECKPOINT.

The BACKUP DATABASE command lets you specify full or incremental backups. You can choose two kinds of incremental backups. INCREMENTAL backsup only those blocks that have changed and committed since the last backup of any type (incremental or full). INCREMENTAL SINCE FULL backs up all of the blocks that have changed since the last full backup. The first type of incremental backup can be smaller and faster to do for BACKUP DATABASE commands, but slower and more complicated for RESTORE DATABASE commands. The opposite is true for the other type of incremental backup. The reason is that the first type generally results in N sets of incremental backup archives for each full backup archive. If a restore is required, a user with the SERVER OPERATOR system privilege must restore the full backup archive first, and then each incremental archive in the proper order. (SAP Sybase IQ keeps track of which ones are needed.) The second type requires the user with the SERVER OPERATOR system privilege to restore only the full backup archive and the last incremental archive.

Incremental virtual backup is supported using the VIRTUAL DECOUPLED and VIRTUAL ENCAPSULATED parameters of the BACKUP DATABASE statement.

Although you can perform an OS-level copy of tablespaces to make a virtual backup of one or more read-only dbspaces, use the virtual backup statement, because it records the backup in the SAP Sybase IQ system tables.

BACKUP DATABASE and RESTORE DATABASE write your SAP Sybase IQ data in parallel to or from all of the archive devices you specify. The catalog store is written serially to the first device. Faster backups and restores result from greater parallelism.

SAP Sybase IQ supports a maximum of 36 hardware devices for backup. For faster backups, specifying one or two devices per core will help to avoid hardware and IO contention. Set the SIZE parameter on the BACKUP DATABASE command to avoid creating multiple files per backup device and consider the value used in the BLOCK FACTOR clause on the BACKUP DATABASE command.

BACKUP DATABASE overwrites existing archive files unless you move the old files or use a different archive_device name or path.

The backup API DLL implementation lets you specify arguments to pass to the DLL when opening an archive device. For third-party implementations, the archive_device string has this format:

'DLLidentifier::vendor_specific_information'

A specific example:

'spsc::workorder=12;volname=ASD002'

The archive_device string length can be up to 1023 bytes. The DLLidentifier portion must be 1 to 30 bytes in length and can contain only alphanumeric and underscore characters. The vendor_specific_information portion of the string is passed to the third-party implementation without checking its contents. Do not specify the SIZE or STACKER clauses of the BACKUP DATABASE command when using third-party implementations, as that information should be encoded in the vendor_specific_information portion of the string.

Note: Only certain third-party products are certified with SAP Sybase IQ using this syntax. See the Release Bulletin for additional usage instructions or restrictions. Before using any third-party product to back up your SAP Sybase IQ database in this way, make sure it is certified. See the Release Bulletin, or see the SAP Sybase Certification Reports for the SAP Sybase IQ product in Technical Documents at http://www.sybase.com/support/techdocs/.

For the SAP Sybase IQ implementation of the backup API, you need to specify only the tape device name or file name. For disk devices, you should also specify the SIZE value, or SAP Sybase IQ assumes that each created disk file is no larger than 2GB on UNIX, or 1.5GB on Windows.

An example of an archive device for the SAP Sybase API DLL that specifies a tape device for certain UNIX systems is:

'/dev/rmt/0'

It is your responsibility to mount additional tapes if needed, or to ensure that the disk has enough space to accommodate the backup.

When multiple devices are specified, BACKUP DATABASE distributes the information across all devices. Other issues for BACKUP DATABASE include:

  • BACKUP DATABASE does not support raw devices as archival devices.
  • Windows systems support only fixed-length I/O operations to tape devices (for more information about this limitation, see your Installation and Configuration Guide). Although Windows supports tape partitioning, SAP Sybase IQ does not use it, so do not use another application to format tapes for BACKUP DATABASE. Windows has a simpler naming strategy for its tape devices, where the first tape device is \\.\tape0, the second is \\.\tape1, and so on.
    Warning!   For backup (and for most other situations) SAP Sybase IQ treats the leading backslash in a string as an escape character, when the backslash precedes an n, an x, or another backslash. For this reason, when you specify backup tape devices, you must double each backslash required by the Windows naming convention. For example, indicate the first Windows tape device you are backing up to as '\\\\.\\tape0', the second as '\\\\.\\tape1', and so on. If you omit the extra backslashes, or otherwise misspell a tape device name, and write a name that is not a valid tape device on your system, SAP Sybase IQ interprets this name as a disk file name.
  • SAP Sybase IQ does not rewind tapes before using them. You must ensure the tapes used for backup and restore are at the correct starting point before putting them in the tape device. SAP Sybase IQ does rewind tapes after using them on rewinding devices.
  • During backup and restore operations, if SAP Sybase IQ cannot open the archive device (for example, when it needs the media loaded) and the ATTENDED clause is ON, it waits for ten seconds and tries again. It continues these attempts indefinitely until either it is successful or the operation is terminated with a Ctrl+C.
  • If you enter Ctrl+C, BACKUP DATABASE fails and returns the database to the state it was in before the backup started.
  • If disk striping is used, such as on a RAID device, the striped disks are treated as a single device.
Side effects:
  • Automatic commit

Standards

(back to top)

  • SQL—Vendor extension to ISO/ANSI SQL grammar.
  • SAP Sybase Database product—Not supported by SAP Sybase Adaptive Server® Enterprise.

Permissions

(back to top)

Requires one of:
  • BACK UP DATABASE system privilege.
  • You own the database.