DELETE v2.6
The DELETE
subcommand removes the subdirectory and data files from the BART backup catalog for the specified backups along with archived WAL files.
Syntax:
bart DELETE –s <server_name> -i { all | [']{ <backup_id> | <backup_name> },... }['] } [ -n ]
Note that when invoking the DELETE
subcommand, you must specify a database server.
For database servers under a retention policy, there are conditions where certain backups may not be deleted. For more information, see the EDB Backup and Recovery User Guide available at the EDB website.
The following table describes the DELETE
options:
Options | Description |
---|---|
-s <server_name> --server <server_name> | <server_name> is the name of the database server whose backups are to be deleted. |
-i { all | [']{ <backup_id> | <backup_name> }',... }[`] } --backupid { all | [']{ <backup_id> | <backup_name> }',... }[`] } | <backup_id> is the backup identifier of the backup to be deleted. <backup_name> is the user-defined alphanumeric name for the backup.Multiple backup identifiers and backup names may be specified in a comma-separated list. The list must be enclosed within single quotes if there is any white space appearing before or after each comma (see Example). If all is specified, all backups and their archived WAL files for the specified database server are deleted. |
-n --dry-run | Performs the test run and displays the results prior to physically removing files; no files are actually deleted. |
Example
The following code sample demonstrates deleting a backup from the specified database server:
[edb@localhost bin]$ ./bart DELETE -s acctg -i acctg_2019-08-27 INFO: deleting backup 'acctg_2019-08-27' of server 'acctg' INFO: deleting backup '1566900093665' INFO: WALs of deleted backup(s) will belong to prior backup(if any), or will be marked unused WARNING: not marking any WALs as unused WALs, the WAL file '/home/edb/bkup_new/acctg/archived_wals/000000010000000000000025' is required, yet not available in archived_wals directory INFO: backup(s) deleted [edb@localhost bin]$
After the deletion, the BART backup catalog for the database server no longer contains the corresponding directory for the deleted backup ID
. The following code sample displays information about archived_wals
subdirectory that no longer contains the backup WAL files:
[edb@localhost acctg]$ ls -l total 16 drwxrwxr-x. 3 edb edb 4096 Aug 27 06:03 1566900199604 drwxrwxr-x. 3 edb edb 4096 Aug 27 06:03 1566900204377 drwxrwxr-x. 3 edb edb 4096 Aug 27 06:03 1566900209087 drwxrwxr-x. 3 edb edb 4096 Aug 27 06:05 1566900321228 drwxrwxr-x. 2 edb edb 6 Aug 27 06:01 archived_wals
The following code sample demonstrates deleting multiple backups from the database server.
[edb@localhost bin]$ ./bart DELETE -s acctg -i `1566988095633,1566988100760, acctg_2019-08-28` INFO: deleting backup `1566988095633` of server `acctg` INFO: deleting backup `1566988095633` INFO: WALs of deleted backup(s) will belong to prior backup(if any), or will be marked unused WARNING: not marking any WALs as unused WALs, the WAL file `/home/edb/bkup_new/acctg/archived_wals/000000010000000000000037` is required, yet not available in archived_wals directory INFO: backup(s) deleted INFO: deleting backup `1566988100760` of server `acctg` INFO: deleting backup `1566988100760` INFO: WALs of deleted backup(s) will belong to prior backup(if any), or will be marked unused WARNING: not marking any WALs as unused WALs, the WAL file `/home/edb/bkup_new/acctg/archived_wals/000000010000000000000039` is required, yet not available in archived_wals directory INFO: backup(s) deleted INFO: deleting backup `acctg_2019-08-28` of server `acctg` INFO: deleting backup `1566988115512` INFO: WALs of deleted backup(s) will belong to prior backup(if any), or will be marked unused WARNING: not marking any WALs as unused WALs, the WAL file `/home/edb/bkup_new/acctg/archived_wals/00000001000000000000003C` is required, yet not available in archived_wals directory INFO: backup(s) deleted [edb@localhost bin]$ [edb@localhost bin]$ [edb@localhost bin]$ [edb@localhost acctg]$ [edb@localhost acctg]$ ls -l total 8 drwxrwxr-x. 3 edb edb 4096 Aug 28 06:28 1566988105086 drwxrwxr-x. 3 edb edb 4096 Aug 28 06:28 1566988109477 drwxrwxr-x. 2 edb edb 6 Aug 28 06:09 archived_wals [edb@localhost acctg]$
Deleting Multiple Backups with Space Characters
The following code sample demonstrates deleting multiple backups; since there are space characters in the comma-separated list, the entire list must be enclosed within single quotes:
[edb@localhost bin]$ ./bart DELETE -s acctg -i `1566900199604,1566900204377,1566900209087`; INFO: deleting backup `1566900199604` of server `acctg` INFO: deleting backup `1566900199604` INFO: WALs of deleted backup(s) will belong to prior backup(if any), or will be marked unused WARNING: not marking any WALs as unused WALs, the WAL file `/home/edb/bkup_new/acctg/archived_wals/000000010000000000000028` is required, yet not available in archived_wals directory INFO: backup(s) deleted INFO: deleting backup `1566900204377` of server `acctg` INFO: deleting backup `1566900204377` INFO: WALs of deleted backup(s) will belong to prior backup(if any), or will be marked unused WARNING: not marking any WALs as unused WALs, the WAL file `/home/edb/bkup_new/acctg/archived_wals/00000001000000000000002A` is required, yet not available in archived_wals directory INFO: backup(s) deleted INFO: deleting backup `1566900209087` of server `acctg` INFO: deleting backup `1566900209087` INFO: WALs of deleted backup(s) will belong to prior backup(if any), or will be marked unused WARNING: not marking any WALs as unused WALs, the WAL file `/home/edb/bkup_new/acctg/archived_wals/00000001000000000000002C` is required, yet not available in archived_wals directory INFO: backup(s) deleted [edb@localhost bin]$ [edb@localhost bin]$ [edb@localhost acctg]$ ls -l total 4 drwxrwxr-x. 3 edb edb 4096 Aug 27 06:05 1566900321228 drwxrwxr-x. 2 edb edb 6 Aug 27 06:01 archived_wals [edb@localhost acctg]$