# Incremental Backup and Restore with SQL

> Incremental backup and restore operations can be performed from any SQL client by executing the eXtremeSQL extensions BACKUP , VERIFY and RESTORE. (Also note that file backup can be performed for persistent databases by calling SQL function `file_backup()`.)

> ## BACKUP

> The BACKUP statement must specify the backup type as one of the following:

> - FULL backup (snapshot), which creates a backup record for the entire database,
> - INCREMENTAL (partial), which records only the database modifications since the previous backup, or
> - AUTO which creates a FULL or INCREMENTAL backup record depending on the content of the backup file: If there is no snapshot in the file yet the backup process will create one; otherwise a partial backup record is created.

> The statement and can also specify an optional label. For example:

>         BACKUP 'SimpleDb_backup' FULL 'Initial full'

>         or

>         BACKUP 'SimpleDb_backup' INCREMENTAL '06/15/2016'

>         or

>         BACKUP 'SimpleDb_backup' AUTO 'Autobkp'

> Note that a FULL backup must be done at least once before an INCREMENTAL backup can be done successfully.

> ## RESTORE a backup

> To restore the database the RESTORE statement specifies the backup file and an optional label (to restore the database contents up to that label only). For example:

>         RESTORE 'SimpleDb_backup' TO '06/15/2016'

> ## List the backup contents

> The SELECT statement can be used to list the contents of a backup file. For example:

>         SELECT * FROM BACKUP 'SimpleDb_backup'

> ## VERIFY a backup

> The VERIFY statement can be used to verify that a backup file will produce a successfully restored database. For example:

>         VERIFY 'SimpleDb_backup' LABEL '06/15/2016'