你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Managed Databases - Create Or Update

创建新数据库或更新现有数据库。

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

URI 参数

名称 必需 类型 说明
databaseName
path True

string

数据库的名称。

managedInstanceName
path True

string

托管实例的名称。

resourceGroupName
path True

string

包含该资源的资源组名称。 可以从 Azure 资源管理器 API 或门户获取此值。

subscriptionId
path True

string

用于标识 Azure 订阅的订阅 ID。

api-version
query True

string

要用于请求的 API 版本。

请求正文

名称 必需 类型 说明
location True

string

资源位置。

properties.autoCompleteRestore

boolean

是否自动完成此托管数据库的还原。

properties.catalogCollation

CatalogCollationType

元数据目录的排序规则。

properties.collation

string

托管数据库的排序规则。

properties.createMode

ManagedDatabaseCreateMode

托管数据库创建模式。 PointInTimeRestore:通过还原现有数据库的时间点备份来创建数据库。 必须指定 SourceDatabaseName、SourceManagedInstanceName 和 PointInTime。 RestoreExternalBackup:通过从外部备份文件还原来创建数据库。 必须指定 Collation、StorageContainerUri 和 StorageContainerSasToken。 恢复:通过还原异地复制的备份来创建数据库。 RecoverableDatabaseId 必须指定为要还原的可恢复数据库资源 ID。 RestoreLongTermRetentionBackup:通过从长期保留备份还原 (所需的 longTermRetentionBackupResourceId) 来创建数据库。

properties.lastBackupName

string

用于还原此托管数据库的最后一个备份文件名。

properties.longTermRetentionBackupResourceId

string

要用于还原此托管数据库的长期保留备份的名称。

properties.recoverableDatabaseId

string

与此数据库的创建操作关联的可恢复数据库的资源标识符。

properties.restorableDroppedDatabaseId

string

创建此数据库时要还原的可还原已删除数据库资源 ID。

properties.restorePointInTime

string

条件。 如果 createMode 为 PointInTimeRestore,则此值是必需的。 指定要还原以创建新数据库的源数据库的时间点 (ISO8601 格式) 。

properties.sourceDatabaseId

string

与此数据库的创建操作关联的源数据库的资源标识符。

properties.storageContainerSasToken

string

条件。 如果 createMode 为 RestoreExternalBackup,则此值是必需的。 指定存储容器 sas 令牌。

properties.storageContainerUri

string

条件。 如果 createMode 为 RestoreExternalBackup,则此值是必需的。 指定存储此还原备份的存储容器的 URI。

tags

object

资源标记。

响应

名称 类型 说明
200 OK

ManagedDatabase

已成功更新数据库。

201 Created

ManagedDatabase

已成功创建数据库。

202 Accepted

已接受

Other Status Codes

错误响应:***

  • 400 PitrPointInTimeInvalid - 时间 {0} 点无效。 有效时间点范围为 {1} 早日到现在,而不是在源服务器创建时间之前。

  • 400 CannotUseTrailingWhitespacesInDatabaseName - 数据库名称验证失败。

  • 400 StorageAccountFull - 托管实例已达到基础 Azure 存储帐户的总容量。 Azure 高级存储帐户的分配空间限制为 35TB。

  • 400 AkvHostNotResolvingFromNode - 无法从服务器“”{0}上的 SQL 解析 AKV 主机“”。{1}

  • 400 InvalidBackupRetentionPeriod - 的保留天数 {0} 不是有效的配置。 有效的备份保留期(以天为单位)必须介于 和 之间{1}{2}

  • 400 ManagedDatabaseNameInUse - 数据库“”{0}已存在。 请选择其他数据库名称。

  • 400 NoMoreSpaceInManagedInstance - 托管实例已达到其存储限制。 托管实例的存储使用量不能超过 (%d) MB。

  • 400 ManagedInstanceUpdateSloInProgress - “无法完成操作,因为正在对托管实例'{0}'进行服务层级更改。' 请等待正常执行的操作完成,然后重试。”

  • 400 SameKeyMaterialNotFoundOnRemoteServer - 辅助服务器没有主服务器的加密保护程序的密钥材料。

  • 400 SourceDatabaseNotFound - 源数据库不存在。

  • 400 RegionDoesNotSupportVersion - 用户尝试在不支持该服务器版本的位置创建指定版本的服务器。

  • 400 PasswordNotComplex - 提供的密码不够复杂。

  • 400 CannotUseReservedDatabaseName - 此操作中无法使用保留的数据库名称。

  • 400 InvalidServerName - 指定的服务器名称无效。

  • 400 SourceServerNotFound - CreateDatabaseAsCopy API 调用中提供的源数据库 ID 的服务器部分不会映射到现有服务器。

  • 400 TokenTooLong - 提供的令牌太长。

  • 400 CurrentDatabaseSizeExceedsMaxSize - 用户尝试将数据库的最大大小减小到小于当前使用情况的大小。

  • 400 InvalidCollation - 服务器无法识别排序规则。

  • 400 AkvEndpointNotReachableFromNode - 服务器“”{0}上的 SQL 无法访问 AKV 终结点“”。{1}

  • 400 ServerNotFound - 找不到请求的服务器。

  • 400 UnsupportedServiceName - 指定的名称是无效名称,因为它包含一个或多个不受支持的 unicode 字符。

  • 400 CurrentDatabaseLogSizeExceedsMaxSize - 用户尝试将数据库更改为最大日志大小低于当前使用情况的 SKU。

  • 400 DatabaseNumberLimitReached - 达到SQL 数据库 托管实例的最大数据库数。

  • 400 InvalidDatabaseCreateOrUpdateRequest - 创建或更新数据库操作的请求正文无效。

  • 400 InvalidResourceId - 资源标识符无效。

  • 400 InvalidSourceDatabaseId - 源数据库标识符无效。

  • 400 InvalidRestorableDroppedDatabaseId - 无效的可还原已删除数据库标识符

  • 400 MismatchingResourceGroupNameWithUrl - 提供的资源组名称与 URL 中的名称不匹配。

  • 400 MismatchingServerNameWithUrl - 提供的服务器名称与 URL 中的名称不匹配。

  • 400 MismatchingSubscriptionWithUrl - 提供的订阅与 URL 中的订阅不匹配。

  • 400 MissingCollation - 需要排序规则。

  • 400 MissingSourceDatabaseId - 缺少源数据库标识符。

  • 400 MissingRestorePointInTime - 缺少还原时间点

  • 400 MissingStorageContainerSasToken - 缺少存储容器 SAS 令牌

  • 400 MissingStorageContainerUri - 缺少存储容器 URI

  • 400 RestorableDroppedDatabaseIdGivenForRestoreWithSourceDatabaseId - 在还原创建模式下已提供 sourceDatabaseId 时,无法指定 restorableDroppedDatabaseId

  • 400 CannotUseReservedDatabaseName - 此操作中无法使用保留的数据库名称。

  • 400 InvalidLongTermRetentionManagedInstanceBackupId - 托管实例的长期保留备份标识符无效。

  • 400 MiGeoRestoreWithWrongBackupStorageRedundancy - 具有 LRS/ZRS 备份存储冗余的托管实例不允许 Geo-Restore。

  • 400 UpdateingInstanceAndBackupRedundancy - 无法在同一请求中更新实例区域冗余和备份存储冗余。

  • 400 ProvisioningDisabled - 按原样显示来自资源操作授权者的错误消息,而不进行任何更改

  • 400 AadOnlyAuthenticationIsEnabled - 已启用仅限 Azure Active Directory 的身份验证。 请联系你的系统管理员。

  • 400 ManagementServiceFeatureDisabled - 用户尝试使用禁用的功能。

  • 400 TargetServerDoesNotExist - 目标服务器 {0} 不存在或尚未就绪。 请检查它是否存在,然后重试还原请求。

  • 400 TargetServerRestoreNotAllowed - 目标服务器 {0} 当前未处于允许启动还原的状态。

  • 400 BackupSetNotFound - 找不到用于还原数据库的备份。 请联系支持人员来还原数据库。

  • 400 FullBackupNotFound - 找不到完整备份。

  • 400 MissingThumbprint - 找不到服务器证书。

  • 400 RestoreFromStripedBackupsNotEnabled - 不支持从条带化备份还原。

  • 400 BackupSetBroken - 备份集已损坏。

  • 400 BrokenRestorePlanNoFullBackup - 还原计划已中断,因为没有完整备份。

  • 400 SqlRestoreError - 使用索引 {0} 还原备份时出现不可重试的错误 - {1}{2}

  • 400 BrokenRestorePlanWrongLogBackupLSN - 还原计划已中断,因为当前日志备份的 firstLsn 不 <= 下一个日志备份的 lastLsn。

  • 400 BrokenRestorePlanWrongDiffBackupLSN - 还原计划已中断,因为差异备份的 firstLsn 不 >= 完整备份的 firstLsn。

  • 400 BrokenRestorePlanGapInLogBackups - 还原计划已中断,因为当前日志备份的 firstLsn 不等于上一个日志备份的 lastLsn。

  • 400 PartiallyContainedDatabaseUnsupported - “不支持对部分包含的数据库进行备份。”

  • 400 RequiredBackupIsNotLastRestored - 无法完成迁移,因为提供的备份文件名不是还原的最后一个备份文件的名称。

  • 400 XtpInitializedDuringRestore - 内存优化文件组必须为空,才能在SQL 数据库 托管实例常规用途层还原。

  • 400 FullBackupMissingChecksum - 提供的完整备份缺少校验和。

  • 400 FullBackupDamaged - 提供的完整备份已损坏。

  • 400 MissingStripeInBackupSet - 提供的备份集缺少一个或多个条带。

  • 400 BrokenRestorePlanWrongDiffBaseGUID - 还原计划已中断,因为差异备份的 DifferentialBaseGuid 与完整备份的 BackupSetGuid 不匹配。

  • 400 IncompatiblePhysicalLayoutTooFewDataFiles - 数据库备份包含不兼容的物理布局。 在备份中找不到数据文件。

  • 400 CorruptedPagesInBackupSet - 操作已中止,因为 RESTORE 在备份集中检测到一个或多个损坏的页面。

  • 400 IncompatiblePhysicalLayoutNonOnlineDataFilesExist - 数据库备份包含不兼容的物理布局。 存在非联机数据文件。

  • 400 CorruptedPagesListMaintenance - 操作已中止,因为在处理不带校验和的备份时发生内部错误。

  • 400 IncompatiblePhysicalLayoutWrongNumberOfLogFiles - 数据库备份包含不兼容的物理布局。 不支持多个日志文件。

  • 400 IncompatiblePhysicalLayoutNonOnlineLogFilesExist - 数据库备份包含不兼容的物理布局。 存在非联机日志文件。

  • 400 IncompatiblePhysicalLayoutTooManyNonDataLogFiles - 数据库备份包含不兼容的物理布局。 非数据/日志文件过多。

  • 400 ExternalBackupAlreadySignaledToComplete - 已向还原请求发出完成信号。

  • 400 ExternalBackupRestoreHasNotBeenStarted - 还原请求只能在还原开始后完成。

  • 400 ExternalBackupUpgradeInProgress - 无法完成还原请求,因为升级正在进行中。

  • 400 IncompatiblePhysicalLayoutTooManyXTPFiles - 数据库备份包含不兼容的物理布局。 在包含MEMORY_OPTIMIZED_DATA的文件组中找到多个文件。

  • 400 BlobStorageFailure - Blob 存储失败。

  • 400 BackupsFromMultipleDatabasesDetectedInTheContainerFromTheStart - 容器文件夹中有多个数据库的备份。 请确保容器文件夹具有来自单一数据库的备份。{0}

  • 400 ManagedIdentityIssueDetectedFromStart - 托管标识未正确设置。 请验证并重试。

  • 400 ManagedInstanceStorageLimitHit - 托管实例已达到其存储限制。

  • 400 AutoCompleteMissingLastBackupName - 自动完成还原请求必须提供 lastBackupName 参数。

  • 400 BlobStorageServerFailure - Blob 存储服务器发生故障。

  • 400 BackupsFromMultipleDatabasesDetectedInTheContainerWhileRestoreInProgress - 容器文件夹中有多个数据库的备份。 请确保容器文件夹具有来自单一数据库的备份。{0}

  • 400 ManagedIdentityIssueDetectedWhileRestoreInProgress - 未正确设置托管标识。 请验证并重试。

  • 404 SubscriptionDoesNotHaveServer - 找不到请求的服务器

  • 404 ServerNotInSubscriptionResourceGroup - 指定的服务器不存在于指定的资源组和订阅中。

  • 404 ResourceNotFound - 找不到请求的资源。

  • 404 CannotFindServerCertificateWithThumbprint - 找不到指纹为“”{0}的服务器证书。 请使用 PowerShell Cmdlet“Add-AzureRmSqlManagedInstanceTransparentDataEncryptionCertificate”创建证书。

  • 404 CannotFindObject - 找不到对象,因为它不存在或您没有权限

  • 404 SubscriptionNotFound - 找不到请求的订阅。

  • 404 DatabaseDoesNotExist - 用户已指定此服务器实例上不存在的数据库名称。

  • 404 ServerNotInSubscription - 指定的服务器不存在于指定的订阅中。

  • 404 RestoreSourceDatabaseNotFound - 在“”{0}时找不到可还原的数据库“{1}”。

  • 404 ServerNotInSubscriptionResourceGroup - 指定的服务器不存在于指定的资源组和订阅中。

  • 409 RemoteDatabaseExists - 目标服务器上已存在目标数据库名称。

  • 409 ConflictingDatabaseOperation - 数据库上已有一些操作,当前操作应等到操作完成。

  • 409 SubscriptionDisabled - 订阅已禁用。

  • 409 ManagementServiceDatabaseBusy - 数据库“”{0}正忙于另一个操作。 请稍后尝试操作。

  • 409 ConflictingSystemOperationInProgress - 数据库上的系统维护操作正在进行中,后续操作需要等待完成。

  • 409 ConflictingManagedInstanceOperation - 托管实例的操作当前正在进行中。

  • 409 BackupRedundancyUpdateAndInstanceRedundancyConflict - 实例是多 az,但备份存储正在从区域冗余更新为非区域冗余。

  • 409 InstanceRedundancyUpdateWhileBackupRedundancyUpdateInProgress - 无法更新实例冗余,因为备份存储冗余更新正在进行中。

  • 409 InstanceRedundancyUpdateAndBackupRedundancyConflict - 备份存储是非区域冗余的,但实例冗余正在更新为区域冗余。

  • 409 BackupRedundancyUpdateConflict - 无法更新备份存储冗余,因为备份存储冗余更新已在进行中。

  • 409 MiDropFailedOnAuthLocks - 用户尝试删除子网中的最后一个托管实例,该子网已对资源 () 应用了 Lock。

  • 409 MiCreateFailedNonDelegatedSubnet - 用户尝试在未委托给 Microsoft.Sql/managedInstances 的子网中部署托管实例或托管实例池。

  • 412 InstanceNotReadyForBackupRedundancyUpdate - 无法更新备份存储冗余,因为实例尚未就绪。

  • 429 SubscriptionTooManyCreateUpdateRequests - 超出可用资源可处理的最大请求数的请求数。

  • 429 SubscriptionTooManyRequests - 超出可用资源可处理的最大请求数的请求数。

  • 429 SubscriptionTooManyCreateUpdateRequests - 超出可用资源可处理的最大请求数的请求数。

  • 429 SubscriptionTooManyRequests - 超出可用资源可处理的最大请求数的请求数。

  • 429 ConflictingSubscriptionOperation - 订阅的操作当前正在进行中。

  • 500 ActivateOrDeactivateWorkflowThrottling - 激活或停用工作流失败,因为并发工作流太多

  • 503 DatabaseUnavailable - 操作失败,因为数据库不可用。

  • 503 TooManyRequests - 超出可用资源可处理的最大请求数的请求数。

  • 503 TooManyRequests - 超出可用资源可处理的最大请求数的请求数。

  • 504 RequestTimeout - 服务请求超出允许的超时。

  • 504 RequestTimeout - 服务请求超出允许的超时。

示例

Creates a new managed database by restoring from an external backup
Creates a new managed database from restoring a geo-replicated backup
Creates a new managed database from restoring a long term retention backup
Creates a new managed database using point in time restore
Creates a new managed database with maximal properties
Creates a new managed database with minimal properties

Creates a new managed database by restoring from an external backup

Sample Request

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

{
  "properties": {
    "createMode": "RestoreExternalBackup",
    "storageContainerUri": "https://myaccountname.blob.core.windows.net/backups",
    "storageContainerSasToken": "sv=2015-12-11&sr=c&sp=rl&sig=1234",
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "autoCompleteRestore": true,
    "lastBackupName": "last_backup_name"
  },
  "location": "southeastasia"
}

Sample Response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database from restoring a geo-replicated backup

Sample Request

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

{
  "location": "southeastasia",
  "properties": {
    "createMode": "Recovery",
    "recoverableDatabaseId": "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb"
  }
}

Sample Response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/server1/recoverableDatabases/testdb_recovered",
  "name": "testdb_recovered",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2018-11-07T04:41:33.937Z"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb_recovered",
  "name": "testdb_recovered",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2018-11-07T04:41:33.937Z"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database from restoring a long term retention backup

Sample Request

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

{
  "properties": {
    "createMode": "RestoreExternalBackup",
    "storageContainerUri": "https://myaccountname.blob.core.windows.net/backups",
    "storageContainerSasToken": "sv=2015-12-11&sr=c&sp=rl&sig=1234",
    "collation": "SQL_Latin1_General_CP1_CI_AS"
  },
  "location": "southeastasia"
}

Sample Response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database using point in time restore

Sample Request

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

{
  "location": "southeastasia",
  "properties": {
    "createMode": "PointInTimeRestore",
    "sourceDatabaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb",
    "restorePointInTime": "2017-07-14T05:35:31.503Z"
  }
}

Sample Response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database with maximal properties

Sample Request

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

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia"
}

Sample Response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database with minimal properties

Sample Request

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

{
  "location": "southeastasia"
}

Sample Response

{
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

定义

名称 说明
CatalogCollationType

元数据目录的排序规则。

ManagedDatabase

托管数据库资源。

ManagedDatabaseCreateMode

托管数据库创建模式。 PointInTimeRestore:通过还原现有数据库的时间点备份来创建数据库。 必须指定 SourceDatabaseName、SourceManagedInstanceName 和 PointInTime。 RestoreExternalBackup:通过从外部备份文件还原来创建数据库。 必须指定 Collation、StorageContainerUri 和 StorageContainerSasToken。 恢复:通过还原异地复制的备份来创建数据库。 RecoverableDatabaseId 必须指定为要还原的可恢复数据库资源 ID。 RestoreLongTermRetentionBackup:通过从长期保留备份还原 (所需的 longTermRetentionBackupResourceId) 来创建数据库。

ManagedDatabaseStatus

数据库的状态。

CatalogCollationType

元数据目录的排序规则。

名称 类型 说明
DATABASE_DEFAULT

string

SQL_Latin1_General_CP1_CI_AS

string

ManagedDatabase

托管数据库资源。

名称 类型 说明
id

string

资源 ID。

location

string

资源位置。

name

string

资源名称。

properties.autoCompleteRestore

boolean

是否自动完成此托管数据库的还原。

properties.catalogCollation

CatalogCollationType

元数据目录的排序规则。

properties.collation

string

托管数据库的排序规则。

properties.createMode

ManagedDatabaseCreateMode

托管数据库创建模式。 PointInTimeRestore:通过还原现有数据库的时间点备份来创建数据库。 必须指定 SourceDatabaseName、SourceManagedInstanceName 和 PointInTime。 RestoreExternalBackup:通过从外部备份文件还原来创建数据库。 必须指定 Collation、StorageContainerUri 和 StorageContainerSasToken。 恢复:通过还原异地复制的备份来创建数据库。 RecoverableDatabaseId 必须指定为要还原的可恢复数据库资源 ID。 RestoreLongTermRetentionBackup:通过从长期保留备份还原 (所需的 longTermRetentionBackupResourceId) 来创建数据库。

properties.creationDate

string

数据库的创建日期。

properties.defaultSecondaryLocation

string

地理配对区域。

properties.earliestRestorePoint

string

时间点还原的最早还原时间点。

properties.failoverGroupId

string

此托管数据库所属的实例故障转移组资源标识符。

properties.lastBackupName

string

用于还原此托管数据库的最后一个备份文件名。

properties.longTermRetentionBackupResourceId

string

要用于还原此托管数据库的长期保留备份的名称。

properties.recoverableDatabaseId

string

与此数据库的创建操作关联的可恢复数据库的资源标识符。

properties.restorableDroppedDatabaseId

string

创建此数据库时要还原的可还原已删除数据库资源 ID。

properties.restorePointInTime

string

条件。 如果 createMode 为 PointInTimeRestore,则此值是必需的。 指定要还原以创建新数据库的源数据库的时间点 (ISO8601 格式) 。

properties.sourceDatabaseId

string

与此数据库的创建操作关联的源数据库的资源标识符。

properties.status

ManagedDatabaseStatus

数据库的状态。

properties.storageContainerSasToken

string

条件。 如果 createMode 为 RestoreExternalBackup,则此值是必需的。 指定存储容器 sas 令牌。

properties.storageContainerUri

string

条件。 如果 createMode 为 RestoreExternalBackup,则此值是必需的。 指定存储此还原备份的存储容器的 URI。

tags

object

资源标记。

type

string

资源类型。

ManagedDatabaseCreateMode

托管数据库创建模式。 PointInTimeRestore:通过还原现有数据库的时间点备份来创建数据库。 必须指定 SourceDatabaseName、SourceManagedInstanceName 和 PointInTime。 RestoreExternalBackup:通过从外部备份文件还原来创建数据库。 必须指定 Collation、StorageContainerUri 和 StorageContainerSasToken。 恢复:通过还原异地复制的备份来创建数据库。 RecoverableDatabaseId 必须指定为要还原的可恢复数据库资源 ID。 RestoreLongTermRetentionBackup:通过从长期保留备份还原 (所需的 longTermRetentionBackupResourceId) 来创建数据库。

名称 类型 说明
Default

string

PointInTimeRestore

string

Recovery

string

RestoreExternalBackup

string

RestoreLongTermRetentionBackup

string

ManagedDatabaseStatus

数据库的状态。

名称 类型 说明
Creating

string

Inaccessible

string

Offline

string

Online

string

Restoring

string

Shutdown

string

Updating

string