documentation/query/sql/backup.md
import { EnterpriseNote } from "@site/src/components/EnterpriseNote"
<EnterpriseNote> Object storage backups with incremental and point-in-time recovery support. </EnterpriseNote>BACKUP - start and abort incremental backups to object storage.
Looking for a detailed guide on backup creation and restoration? Check out our Backup and Restore guide!
BACKUP DATABASE;
BACKUP ABORT;
Starts a new incremental backup. Returns immediately with the backup timestamp. The backup runs asynchronously in the background.
Aborts a running backup. Returns a single row:
| Column | Type | Description |
|---|---|---|
status | VARCHAR | aborted or not running |
backup_id | TIMESTAMP | Timestamp of aborted backup, or NULL |
Example when backup was running:
| status | backup_id |
|---|---|
| aborted | 2024-01-15T10:30:00.000000Z |
Example when no backup was running:
| status | backup_id |
|---|---|
| not running | NULL |
Use the backups() table function to monitor backup progress and history:
SELECT * FROM backups();
Returns:
| Column | Type | Description |
|---|---|---|
status | VARCHAR | Current status (see below) |
progress_percent | INT | Completion percentage (0-100) |
start_ts | TIMESTAMP | When the backup started |
end_ts | TIMESTAMP | When the backup completed (NULL if running) |
backup_error | VARCHAR | Error message if backup failed |
cleanup_error | VARCHAR | Error message if cleanup failed |
backup in progress, backup complete, backup failed, cleanup in progress,
cleanup complete, cleanup failed
See status values in the Backup guide for descriptions and recommended actions.
Start a backup:
BACKUP DATABASE;
Result:
| backup_timestamp |
|---|
| 2024-08-24T12:34:56.789123Z |
Check current backup status:
SELECT status, progress_percent FROM backups() ORDER BY start_ts DESC LIMIT 1;
Backups must be configured before use. At minimum:
backup.enabled=true
backup.object.store=s3::bucket=my-bucket;region=eu-west-1;...
See the Backup and Restore guide for full configuration options.
backup_instance_name)