# Set a new PITR backup retention period on an active individual database
# Valid backup retention must be 1 to 35 days
az sql midb short-term-retention-policy set \
--resource-group myresourcegroup \
--managed-instance myinstance \
--name mymanageddb \
--retention-days 1 \
使用以下示例更改托管实例中所有活动数据库的 PITR 备份保留期:
# Set a new PITR backup retention period for all active databases
# Valid backup retention must be 1 to 35 days
az sql midb short-term-retention-policy set \
--resource-group myresourcegroup \
--managed-instance myinstance \
--retention-days 1 \
若要更改托管实例中单个活动数据库的 PITR 备份保留,请使用以下 PowerShell 示例:
# Set a new PITR backup retention period on an active individual database
# Valid backup retention must be 1 to 35 days
Set-AzSqlInstanceDatabaseBackupShortTermRetentionPolicy -ResourceGroupName resourceGroup -InstanceName testserver -DatabaseName testDatabase -RetentionDays 1
若要更改托管实例中所有活动数据库的 PITR 备份保留,请使用以下 PowerShell 示例:
# Set a new PITR backup retention period for all active databases
# Valid backup retention must be 1 to 35 days
Get-AzSqlInstanceDatabase -ResourceGroupName resourceGroup -InstanceName testserver | Set-AzSqlInstanceDatabaseBackupShortTermRetentionPolicy -RetentionDays 1
若要更改托管实例中单个已删除数据库的 PITR 备份保留,请使用以下 PowerShell 示例:
# Set a new PITR backup retention on an individual deleted database
# Valid backup retention must be 0 (no retention) to 35 days. Valid retention rate can only be lower than the retention period when database was active, or the remaining backup days of a deleted database.
Get-AzSqlDeletedInstanceDatabaseBackup -ResourceGroupName resourceGroup -InstanceName testserver -DatabaseName testDatabase | Set-AzSqlInstanceDatabaseBackupShortTermRetentionPolicy -RetentionDays 0
若要更改托管实例中所有已删除数据库的 PITR 备份保留,请使用以下 PowerShell 示例:
# Set a new PITR backup retention for all deleted databases
# Valid backup retention must be 0 (no retention) to 35 days. Valid retention rate can only be lower than the retention period when database was active, or the remaining backup days of a deleted database
Get-AzSqlDeletedInstanceDatabaseBackup -ResourceGroupName resourceGroup -InstanceName testserver | Set-AzSqlInstanceDatabaseBackupShortTermRetentionPolicy -RetentionDays 0
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup/providers/Microsoft.Sql/servers/testserver/databases/testDatabase/backupShortTermRetentionPolicies/default?api-version=2017-10-01-preview