Managed Databases - Update

Updates an existing database.

PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}?api-version=2021-11-01

URI Parameters

Name In Required Type Description
databaseName
path True

string

The name of the database.

managedInstanceName
path True

string

The name of the managed instance.

resourceGroupName
path True

string

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

subscriptionId
path True

string

The subscription ID that identifies an Azure subscription.

api-version
query True

string

The API version to use for the request.

Request Body

Name Type Description
properties.autoCompleteRestore

boolean

Whether to auto complete restore of this managed database.

properties.catalogCollation

CatalogCollationType

Collation of the metadata catalog.

properties.collation

string

Collation of the managed database.

properties.createMode

ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

properties.lastBackupName

string

Last backup file name for restore of this managed database.

properties.longTermRetentionBackupResourceId

string

The name of the Long Term Retention backup to be used for restore of this managed database.

properties.recoverableDatabaseId

string

The resource identifier of the recoverable database associated with create operation of this database.

properties.restorableDroppedDatabaseId

string

The restorable dropped database resource id to restore when creating this database.

properties.restorePointInTime

string

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

properties.sourceDatabaseId

string

The resource identifier of the source database associated with create operation of this database.

properties.storageContainerSasToken

string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token.

properties.storageContainerUri

string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

tags

object

Resource tags.

Responses

Name Type Description
200 OK

ManagedDatabase

Successfully updated the database.

202 Accepted

Updating the managed database is in progress.

Other Status Codes

*** Error Responses: ***

  • 400 PitrPointInTimeInvalid - The point in time {0} is not valid. Valid point in time range from {1} days early to now and not before source server creation time.

  • 400 CannotUseTrailingWhitespacesInDatabaseName - The database name validation failed.

  • 400 StorageAccountFull - Managed Instance has reached the total capacity of underlying Azure storage account. Azure Premium Storage account is limited to 35TB of allocated space.

  • 400 AkvHostNotResolvingFromNode - AKV host '{0}' is not resolvable from SQL, on server '{1}'.

  • 400 InvalidBackupRetentionPeriod - The retention days of {0} is not a valid configuration. Valid backup retention in days must be between {1} and {2}

  • 400 ManagedDatabaseNameInUse - Database '{0}' already exists. Choose a different database name.

  • 400 NoMoreSpaceInManagedInstance - The managed instance has reached its storage limit. The storage usage for the managed instance cannot exceed (%d) MBs.

  • 400 ManagedInstanceUpdateSloInProgress - "The operation could not be completed because a service tier change is in progress for managed instance '{0}.' Please wait for the operation in progress to complete and try again."

  • 400 SameKeyMaterialNotFoundOnRemoteServer - Secondary server does not have the key material of the primary server's encryption protector.

  • 400 SourceDatabaseNotFound - The source database does not exist.

  • 400 RegionDoesNotSupportVersion - A user attempted to create a server of a specified version in a location where that server version isn't supported.

  • 400 PasswordNotComplex - The provided password is not complex enough.

  • 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

  • 400 InvalidServerName - Invalid server name specified.

  • 400 SourceServerNotFound - The server part of a source database id provided in a CreateDatabaseAsCopy API call doesn't map to an existing server.

  • 400 TokenTooLong - The provided token is too long.

  • 400 CurrentDatabaseSizeExceedsMaxSize - User attempted to reduce the max size for a database to a size smaller than the current usage.

  • 400 InvalidCollation - Collation is not recognized by the server.

  • 400 AkvEndpointNotReachableFromNode - AKV endpoint '{0}' is not reachable from SQL, on server '{1}'.

  • 400 ServerNotFound - The requested server was not found.

  • 400 UnsupportedServiceName - The specified name is an invalid name because it contains one or more unsupported unicode characters.

  • 400 CurrentDatabaseLogSizeExceedsMaxSize - User attempted to change the database to a sku with lower max log size than the current usage.

  • 400 DatabaseNumberLimitReached - Maximum number of databases for SQL Database Managed Instance reached.

  • 400 InvalidDatabaseCreateOrUpdateRequest - The request body for the create or update database operation is invalid.

  • 400 InvalidResourceId - Invalid resource identifier.

  • 400 InvalidSourceDatabaseId - Invalid source database identifier.

  • 400 InvalidRestorableDroppedDatabaseId - Invalid restorable dropped database identifier

  • 400 MismatchingResourceGroupNameWithUrl - The provided resource group name did not match the name in the Url.

  • 400 MismatchingServerNameWithUrl - The provided server name did not match the name in the Url.

  • 400 MismatchingSubscriptionWithUrl - The provided subscription did not match the subscription in the Url.

  • 400 MissingCollation - Collation is required.

  • 400 MissingSourceDatabaseId - Missing source database identifier.

  • 400 MissingRestorePointInTime - Missing restore point in time

  • 400 MissingStorageContainerSasToken - Missing storage container SAS token

  • 400 MissingStorageContainerUri - Missing storage container URI

  • 400 RestorableDroppedDatabaseIdGivenForRestoreWithSourceDatabaseId - Cannot specify restorableDroppedDatabaseId when sourceDatabaseId is already given in restore create mode

  • 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

  • 404 SubscriptionDoesNotHaveServer - The requested server was not found

  • 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

  • 404 ResourceNotFound - The requested resource was not found.

  • 404 CannotFindServerCertificateWithThumbprint - Cannot find server certificate with thumbprint '{0}'. Please use PowerShell Cmdlet 'Add-AzureRmSqlManagedInstanceTransparentDataEncryptionCertificate' to create the certificate.

  • 404 CannotFindObject - Cannot find the object because it does not exist or you do not have permissions

  • 404 SubscriptionNotFound - The requested subscription was not found.

  • 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

  • 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

  • 404 RestoreSourceDatabaseNotFound - Could not find database '{0}' at time '{1}' that can be restored.

  • 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

  • 409 RemoteDatabaseExists - The destination database name already exists on the destination server.

  • 409 ConflictingDatabaseOperation - There is already some operation on the database and the current operation should wait till it is done.

  • 409 SubscriptionDisabled - Subscription is disabled.

  • 409 ManagementServiceDatabaseBusy - Database '{0}' is busy with another operation. Please try your operation later.

  • 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

  • 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

  • 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

  • 500 ActivateOrDeactivateWorkflowThrottling - Activation or deactivation workflow failed because there are too many concurrent workflows

  • 503 DatabaseUnavailable - The operation failed because the database is unavailable.

  • 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

  • 504 RequestTimeout - Service request exceeded the allowed timeout.

Examples

Updates a managed database with maximal properties
Updates a managed database with minimal properties

Updates a managed database with maximal properties

Sample Request

PATCH https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/testdb?api-version=2021-11-01

{
  "tags": {
    "tagKey1": "TagValue1"
  }
}

Sample Response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb",
  "name": "testdb"
}

Updates a managed database with minimal properties

Sample Request

PATCH https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/testdb?api-version=2021-11-01

{
  "tags": {
    "tagKey1": "TagValue1"
  }
}

Sample Response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb",
  "name": "testdb"
}

Definitions

Name Description
CatalogCollationType

Collation of the metadata catalog.

ManagedDatabase

A managed database resource.

ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

ManagedDatabaseStatus

Status of the database.

ManagedDatabaseUpdate

An managed database update.

CatalogCollationType

Collation of the metadata catalog.

Name Type Description
DATABASE_DEFAULT

string

SQL_Latin1_General_CP1_CI_AS

string

ManagedDatabase

A managed database resource.

Name Type Description
id

string

Resource ID.

location

string

Resource location.

name

string

Resource name.

properties.autoCompleteRestore

boolean

Whether to auto complete restore of this managed database.

properties.catalogCollation

CatalogCollationType

Collation of the metadata catalog.

properties.collation

string

Collation of the managed database.

properties.createMode

ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

properties.creationDate

string

Creation date of the database.

properties.defaultSecondaryLocation

string

Geo paired region.

properties.earliestRestorePoint

string

Earliest restore point in time for point in time restore.

properties.failoverGroupId

string

Instance Failover Group resource identifier that this managed database belongs to.

properties.lastBackupName

string

Last backup file name for restore of this managed database.

properties.longTermRetentionBackupResourceId

string

The name of the Long Term Retention backup to be used for restore of this managed database.

properties.recoverableDatabaseId

string

The resource identifier of the recoverable database associated with create operation of this database.

properties.restorableDroppedDatabaseId

string

The restorable dropped database resource id to restore when creating this database.

properties.restorePointInTime

string

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

properties.sourceDatabaseId

string

The resource identifier of the source database associated with create operation of this database.

properties.status

ManagedDatabaseStatus

Status of the database.

properties.storageContainerSasToken

string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token.

properties.storageContainerUri

string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

tags

object

Resource tags.

type

string

Resource type.

ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

Name Type Description
Default

string

PointInTimeRestore

string

Recovery

string

RestoreExternalBackup

string

RestoreLongTermRetentionBackup

string

ManagedDatabaseStatus

Status of the database.

Name Type Description
Creating

string

Inaccessible

string

Offline

string

Online

string

Restoring

string

Shutdown

string

Updating

string

ManagedDatabaseUpdate

An managed database update.

Name Type Description
properties.autoCompleteRestore

boolean

Whether to auto complete restore of this managed database.

properties.catalogCollation

CatalogCollationType

Collation of the metadata catalog.

properties.collation

string

Collation of the managed database.

properties.createMode

ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

properties.creationDate

string

Creation date of the database.

properties.defaultSecondaryLocation

string

Geo paired region.

properties.earliestRestorePoint

string

Earliest restore point in time for point in time restore.

properties.failoverGroupId

string

Instance Failover Group resource identifier that this managed database belongs to.

properties.lastBackupName

string

Last backup file name for restore of this managed database.

properties.longTermRetentionBackupResourceId

string

The name of the Long Term Retention backup to be used for restore of this managed database.

properties.recoverableDatabaseId

string

The resource identifier of the recoverable database associated with create operation of this database.

properties.restorableDroppedDatabaseId

string

The restorable dropped database resource id to restore when creating this database.

properties.restorePointInTime

string

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

properties.sourceDatabaseId

string

The resource identifier of the source database associated with create operation of this database.

properties.status

ManagedDatabaseStatus

Status of the database.

properties.storageContainerSasToken

string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token.

properties.storageContainerUri

string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

tags

object

Resource tags.