Save restore points
Before you can save restore points, you must first create an archive to store them. Archives store the restore points in descending chronological order based on the times at which the restore points were saved. Each restore can be identified by its unique identifier or the index in the archive, where an index of 1 specifies the most recently saved restore point.
Caution
Because restore points are stored in-database, they are lost if the database's storage is compromised. To create backups to external storage locations, use thevbr
tool.
Create an archive
The CREATE ARCHIVE statement, which requires superuser privileges, creates an archive and assigns the creator as the archive's owner. This statement requires you to specify an archive name and optionally to set a limit to the number of restore points that can be saved to an archive. For example, the following statement creates an archive named vertica-restore
and sets the maximum restore point limit to 15:
=> CREATE ARCHIVE vertica-restore LIMIT 15;
To view all archives in your database, you can query the ARCHIVES system table:
=> SELECT * FROM ARCHIVES;
name | limit_count | owner | object_inclusion_rules | data_inclusion_rules
-----------------+-------------+-----------+------------------------+----------------------
vertica-restore | 15 | 450359926 | |
(1 row)
You can modify an archive's owner or change the restore point limit using the ALTER ARCHIVE statement. To drop an archive, use DROP ARCHIVE. The drop statement returns an error if the archive contains any restore points, unless you specify CASCADE, in which case the archive and any restore points it contains are all dropped.
Save restore point to an archive
After you have created an archive, you can use the SAVE RESTORE POINT TO ARCHIVE function to save a restore point:
=> SAVE RESTORE POINT TO ARCHIVE vertica-restore;
SAVE RESTORE POINT
If an archive contains the maximum number of restore points and a new restore point is saved, the oldest restore point in the archive is deleted. To view all restore points in your database, query the ARCHIVE_RESTORE_POINTS system table, which provides the unique identifiers for each restore point—the object ID and the index in its archive:
=> SELECT * FROM ARCHIVE_RESTORE_POINTS;
id | save_time | index | archive | state | vertica_version
--------------------------------------+----------------------------+-------+-----------------+----------+-------------------------
2616f6cd-e98c-472c-8d5c-a7f459dff82b | 2023-11-30 10:19:58.565311 | 1 | vertica-restore | COMPLETE | v24.4.0
116066cc-29cb-4ce5-9a27-170538ba95cf | 2023-11-10 11:02:48.059941 | 2 | vertica-restore | COMPLETE | v24.4.0
(2 rows)
For details about using restore points to revive a database, see Revive from a restore point.
Remove restore points from an archive
To remove a restore point from an archive, use the REMOVE RESTORE POINT FROM ARCHIVE statement. This statement requires you to specify either the restore point's index in the archive or its unique object ID. If neither of these identifiers are provided, the newest restore point in the archive is removed:
=> REMOVE RESTORE POINT FROM ARCHIVE vertica-restore;
REMOVE RESTORE POINT
Query the ARCHIVE_RESTORE_POINTS table to confirm the status of the removal. If the remove operation is still in progress, the restore point appears with a status of REMOVING. After the operation completes, the restore point is no longer listed in the table:
=> SELECT * FROM ARCHIVE_RESTORE_POINTS;
id | save_time | index | archive | state
--------------------------------------+----------------------------+-------+-----------+----------
116066cc-29cb-4ce5-9a27-170538ba95cf | 2023-11-10 11:02:48.059941 | 1 | verticadb | COMPLETE
(2 rows)