> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ALTER BACKUP

Any of the following facets of a [backup](https://docs.kinetica.com/content/sql/backup_restore/create-backup.md#sql-backup-create) can
be altered, via a given [data sink](https://docs.kinetica.com/content/sql/ddl/create-data-sink.md#sql-create-data-sink):

* *Backup snapshots* can be merged into a single *full snapshot*.
* *Backup snapshots* can be individually deleted
* *Backup* options can be set

```sql title="ALTER BACKUP Syntax" theme={null}
ALTER BACKUP <backup name>
DATA SINK = <data sink name>
< MERGE | PURGE <backup id> | SET <property name> = '<property value>'[,...] >
[WITH OPTIONS (<alter option name> = '<alter option value>'[,...])]
```

## Parameters

> [accordion] \<backup name>
>
> Name of the [backup](https://docs.kinetica.com/content/sql/backup_restore/create-backup.md#sql-backup-create) to alter.

> [accordion] \<data sink name>
>
> Name of the [data sink](https://docs.kinetica.com/content/sql/ddl/create-data-sink.md#sql-create-data-sink) used to alter the database *backup* files
> on the remote file store.

> [accordion] MERGE
>
> Merges all *snapshots* of a given *backup* into a single, *full snapshot*.  An error will be
> reported if the *backup* contains only one *full snapshot*.

> [accordion] PURGE
>
> Deletes the *snapshot* identified with `backup id`.  Only applicable to *incremental* and
> *differential snapshots*.

> [accordion] SET
>
> Sets the given list of properties to their given corresponding values.
>
> > [!NOTE]
> >
> > These settings will affect future *snapshots* of the given *backup*; existing
> > *snapshots* will remain unchanged.
>
> Alterable properties include:
>
> <table>
>   <thead>
>     <tr>
>       <th>Property</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>`CHECKSUM`</td>
>       <td>Whether or not to calculate checksums on backed-up objects.</td>
>     </tr>
>
>     <tr>
>       <td>`DDL_ONLY`</td>
>       <td>Whether or not to only back up DDL for any tables.</td>
>     </tr>
>
>     <tr>
>       <td>`MAX_INCREMENTAL_BACKUPS_TO_KEEP`</td>
>       <td>Maximum number of *incremental snapshots* to keep.</td>
>     </tr>
>   </tbody>
> </table>

> [accordion] WITH OPTIONS
>
> Optional indicator that a comma-delimited list of alteration option name/value assignments will
> follow.
>
> Alter options include:
>
> <table>
>   <thead>
>     <tr>
>       <th>Option</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>`COMMENT`</td>
>       <td>A new comment for the *backup* that is created by a `MERGE`; only valid for `MERGE` operations.</td>
>     </tr>
>
>     <tr>
>       <td>`DRY_RUN`</td>
>       <td>Whether or not to execute a dry run of a *backup* alteration and not actually alter the *backup*.</td>
>     </tr>
>   </tbody>
> </table>

## Examples

For example, to merge all *snapshots* of a *backup* into a single
*full snapshot* and add a comment to the merged *backup*:

```sql MERGE Backup Example theme={null}
ALTER BACKUP schema_backup
DATA SINK = backup_ds
MERGE
WITH OPTIONS (COMMENT = 'Merged last 30 days of backups')
```

To purge a given *snapshot* by ID number:

```sql PURGE Backup Example theme={null}
ALTER BACKUP schema_backup
DATA SINK = backup_ds
PURGE 1654321012345
```

To set the maximum number of *incremental snapshots* of a *backup* to keep to
`5`:

```sql SET Backup Properties Example theme={null}
ALTER BACKUP schema_backup
DATA SINK = backup_ds
SET MAX_INCREMENTAL_BACKUPS_TO_KEEP = 5
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.