.alter database policy retention command
Applies to: ✅ Azure Data Explorer
Changes the database's retention policy. The retention policy controls the mechanism that automatically removes data from tables or materialized views. The policy removes data whose relevance is age-based.
The retention policy can be configured for a specific table or materialized view, or for an entire database. The policy then applies to all tables in the database that don't override it.
Permissions
You must have at least Database Admin permissions to run this command.
Syntax
.alter
database
DatabaseName policy
retention
PolicyObject
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
DatabaseName | string |
✔️ | The name of the database for which to alter the retention policy. |
PolicyObject | string |
✔️ | A policy object that defines the retention policy. For more information, see retention policy. |
Example
Sets a retention policy with a 10 day soft-delete period, and enable data recoverability:
.alter database MyDatabase policy retention
```
{
"SoftDeletePeriod" : "10.00:00:00",
"Recoverability" : "Enabled"
}
```