Databases - Get

取得資料庫。

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

URI 參數

名稱 位於 必要 類型 Description
databaseName
path True

string

資料庫的名稱。

resourceGroupName
path True

string

包含資源的資源群組名稱。 您可以從 Azure 資源管理員 API 或入口網站取得這個值。

serverName
path True

string

伺服器的名稱。

subscriptionId
path True

string

可識別 Azure 訂用帳戶的訂用帳戶識別碼。

api-version
query True

string

要用於要求的 API 版本。

回應

名稱 類型 Description
200 OK

Database

已成功擷取指定的資料庫。

Other Status Codes

錯誤回應: ≦

  • 404 SubscriptionDoesNotHaveServer - 找不到要求的伺服器

  • 404 ServerNotInSubscriptionResourceGroup - 指定的伺服器不存在於指定的資源群組和訂用帳戶中。

  • 404 ResourceNotFound - 找不到所要求的資源。

範例

Gets a database.

Sample Request

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

Sample Response

{
  "sku": {
    "name": "BC_Gen5",
    "tier": "BusinessCritical",
    "capacity": 2
  },
  "kind": "v12.0,user,vcore",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "maxSizeBytes": 268435456000,
    "status": "Online",
    "databaseId": "6c764297-577b-470f-9af4-96d3d41e2ba3",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "currentServiceObjectiveName": "BC_Gen5_2",
    "requestedServiceObjectiveName": "BC_Gen5_2",
    "defaultSecondaryLocation": "North Europe",
    "catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
    "licenseType": "LicenseIncluded",
    "maxLogSizeBytes": 104857600,
    "isInfraEncryptionEnabled": false,
    "zoneRedundant": false,
    "readScale": "Enabled",
    "earliestRestoreDate": "2017-06-07T04:51:33.937Z",
    "maintenanceConfigurationId": "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1",
    "currentSku": {
      "name": "BC_Gen5",
      "tier": "BusinessCritical",
      "capacity": 2
    },
    "currentBackupStorageRedundancy": "Geo",
    "requestedBackupStorageRedundancy": "Geo",
    "isLedgerOn": false
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb",
  "name": "testdb",
  "type": "Microsoft.Sql/servers/databases"
}

定義

名稱 Description
BackupStorageRedundancy

用來儲存此資料庫的備份的記憶體帳戶類型。

CatalogCollationType

元資料目錄的定序。

CreateMode

指定資料庫建立模式。

默認值:一般資料庫建立。

複製:建立資料庫做為現有資料庫的複本。 sourceDatabaseId 必須指定為源資料庫的資源標識碼。

次要:建立資料庫做為現有資料庫的次要複本。 sourceDatabaseId 必須指定為現有主資料庫的資源標識碼。

PointInTimeRestore:藉由還原現有資料庫的時間點備份來建立資料庫。 sourceDatabaseId 必須指定為現有資料庫的資源標識符,而且必須指定 restorePointInTime。

復原:藉由還原異地復寫備份來建立資料庫。 sourceDatabaseId 必須指定為可復原的資料庫資源標識碼,才能還原。

還原:藉由還原已刪除資料庫的備份來建立資料庫。 必須指定sourceDatabaseId。 如果 sourceDatabaseId 是資料庫的原始資源識別碼,則必須指定 sourceDatabaseDeletionDate。 否則,sourceDatabaseId 必須是可還原的卸除資料庫資源標識符,而且會忽略 sourceDatabaseDeletionDate。 restorePointInTime 也可以指定從先前的時間點還原。

RestoreLongTermRetentionBackup:從長期保留保存庫還原來建立資料庫。 recoveryServicesRecoveryPointResourceId 必須指定為恢復點資源標識符。

DataWarehouse 版本不支援 Copy、Secondary 和 RestoreLongTermRetentionBackup。

Database

資料庫資源。

DatabaseIdentity

資源的 Azure Active Directory 身分識別設定。

DatabaseIdentityType

身分識別類型

DatabaseLicenseType

要套用此資料庫的授權類型。 LicenseIncluded如果您需要授權,或BasePrice如果您有授權且符合 Azure Hybrid Benefit 資格。

DatabaseReadScale

唯讀路由的狀態。 如果啟用,讓應用程式意圖在其 連接字串 中設定為唯讀的連線,可能會路由傳送至相同區域中的唯讀次要複本。 不適用於彈性集區內的超大規模資料庫。

DatabaseStatus

資料庫的狀態。

DatabaseUserIdentity

資源的 Azure Active Directory 身分識別設定。

SampleName

建立此資料庫時要套用的範例架構名稱。

SecondaryType

如果資料庫是次要資料庫,則為次要類型。 有效值為 Geo 和 Named。

Sku

ARM 資源 SKU。

BackupStorageRedundancy

用來儲存此資料庫的備份的記憶體帳戶類型。

名稱 類型 Description
Geo

string

GeoZone

string

Local

string

Zone

string

CatalogCollationType

元資料目錄的定序。

名稱 類型 Description
DATABASE_DEFAULT

string

SQL_Latin1_General_CP1_CI_AS

string

CreateMode

指定資料庫建立模式。

默認值:一般資料庫建立。

複製:建立資料庫做為現有資料庫的複本。 sourceDatabaseId 必須指定為源資料庫的資源標識碼。

次要:建立資料庫做為現有資料庫的次要複本。 sourceDatabaseId 必須指定為現有主資料庫的資源標識碼。

PointInTimeRestore:藉由還原現有資料庫的時間點備份來建立資料庫。 sourceDatabaseId 必須指定為現有資料庫的資源標識符,而且必須指定 restorePointInTime。

復原:藉由還原異地復寫備份來建立資料庫。 sourceDatabaseId 必須指定為可復原的資料庫資源標識碼,才能還原。

還原:藉由還原已刪除資料庫的備份來建立資料庫。 必須指定sourceDatabaseId。 如果 sourceDatabaseId 是資料庫的原始資源識別碼,則必須指定 sourceDatabaseDeletionDate。 否則,sourceDatabaseId 必須是可還原的卸除資料庫資源標識符,而且會忽略 sourceDatabaseDeletionDate。 restorePointInTime 也可以指定從先前的時間點還原。

RestoreLongTermRetentionBackup:從長期保留保存庫還原來建立資料庫。 recoveryServicesRecoveryPointResourceId 必須指定為恢復點資源標識符。

DataWarehouse 版本不支援 Copy、Secondary 和 RestoreLongTermRetentionBackup。

名稱 類型 Description
Copy

string

Default

string

OnlineSecondary

string

PointInTimeRestore

string

Recovery

string

Restore

string

RestoreExternalBackup

string

RestoreExternalBackupSecondary

string

RestoreLongTermRetentionBackup

string

Secondary

string

Database

資料庫資源。

名稱 類型 Description
id

string

資源識別碼。

identity

DatabaseIdentity

資料庫的 Azure Active Directory 身分識別。

kind

string

資料庫種類。 這是用於 Azure 入口網站 體驗的元數據。

location

string

資源位置。

managedBy

string

管理資料庫的資源。

name

string

資源名稱。

properties.autoPauseDelay

integer

在幾分鐘后自動暫停資料庫的時間。 值為 -1 表示自動暫停已停用

properties.catalogCollation

CatalogCollationType

元資料目錄的定序。

properties.collation

string

資料庫的定序。

properties.createMode

CreateMode

指定資料庫建立模式。

默認值:一般資料庫建立。

複製:建立資料庫做為現有資料庫的複本。 sourceDatabaseId 必須指定為源資料庫的資源標識碼。

次要:建立資料庫做為現有資料庫的次要複本。 sourceDatabaseId 必須指定為現有主資料庫的資源標識碼。

PointInTimeRestore:藉由還原現有資料庫的時間點備份來建立資料庫。 sourceDatabaseId 必須指定為現有資料庫的資源標識符,而且必須指定 restorePointInTime。

復原:藉由還原異地復寫備份來建立資料庫。 sourceDatabaseId 必須指定為可復原的資料庫資源標識碼,才能還原。

還原:藉由還原已刪除資料庫的備份來建立資料庫。 必須指定sourceDatabaseId。 如果 sourceDatabaseId 是資料庫的原始資源識別碼,則必須指定 sourceDatabaseDeletionDate。 否則,sourceDatabaseId 必須是可還原的卸除資料庫資源標識符,而且會忽略 sourceDatabaseDeletionDate。 restorePointInTime 也可以指定從先前的時間點還原。

RestoreLongTermRetentionBackup:從長期保留保存庫還原來建立資料庫。 recoveryServicesRecoveryPointResourceId 必須指定為恢復點資源標識符。

DataWarehouse 版本不支援 Copy、Secondary 和 RestoreLongTermRetentionBackup。

properties.creationDate

string

資料庫 (ISO8601 格式) 的建立日期。

properties.currentBackupStorageRedundancy

BackupStorageRedundancy

用來儲存此資料庫的備份的記憶體帳戶類型。

properties.currentServiceObjectiveName

string

資料庫目前的服務等級目標名稱。

properties.currentSku

Sku

SKU 的名稱和層級。

properties.databaseId

string

資料庫的識別碼。

properties.defaultSecondaryLocation

string

此資料庫的預設次要區域。

properties.earliestRestoreDate

string

這會記錄此資料庫可用的最早開始日期和時間 (ISO8601 格式) 。

properties.elasticPoolId

string

包含此資料庫之彈性集區的資源標識碼。

properties.failoverGroupId

string

此資料庫所屬的故障轉移群組資源標識碼。

properties.federatedClientId

string

每個資料庫 CMK 案例用於跨租使用者的用戶端識別碼

properties.highAvailabilityReplicaCount

integer

與用來提供高可用性之資料庫相關聯的次要複本數目。 不適用於彈性集區內的超大規模資料庫。

properties.isInfraEncryptionEnabled

boolean

此資料庫已啟用基礎結構加密。

properties.isLedgerOn

boolean

不論此資料庫是否為總賬資料庫,這表示資料庫中的所有數據表都是總賬數據表。 注意:建立資料庫之後,無法變更此屬性的值。

properties.licenseType

DatabaseLicenseType

要套用此資料庫的授權類型。 LicenseIncluded如果您需要授權,或BasePrice您有授權且符合 Azure Hybrid Benefit 資格。

properties.longTermRetentionBackupResourceId

string

與此資料庫建立作業相關聯的長期保留備份資源標識符。

properties.maintenanceConfigurationId

string

指派給資料庫的維護組態標識碼。 此組態會定義維護更新發生的期間。

properties.maxLogSizeBytes

integer

此資料庫的記錄大小上限。

properties.maxSizeBytes

integer

以位元組表示的資料庫大小上限。

properties.minCapacity

number

資料庫一律已配置的最小容量,如果未暫停,則為

properties.pausedDate

string

用戶設定或動作暫停資料庫的日期, (ISO8601 格式) 。 如果資料庫已就緒,則為 Null。

properties.readScale

DatabaseReadScale

唯讀路由的狀態。 如果已啟用,則應用程式意圖設定為唯讀的連線 連接字串 可能會路由傳送至相同區域中的唯讀次要複本。 不適用於彈性集區內的超大規模資料庫。

properties.recoverableDatabaseId

string

與此資料庫建立作業相關聯的可復原資料庫資源標識符。

properties.recoveryServicesRecoveryPointId

string

與此資料庫建立作業相關聯的恢復點資源標識碼。

properties.requestedBackupStorageRedundancy

BackupStorageRedundancy

用來儲存此資料庫的備份的記憶體帳戶類型。

properties.requestedServiceObjectiveName

string

資料庫所要求的服務等級目標名稱。

properties.restorableDroppedDatabaseId

string

與這個資料庫的建立作業相關聯的可還原卸除資料庫資源標識符。

properties.restorePointInTime

string

指定將還原以建立新資料庫之源資料庫) 格式 (ISO8601 時間點。

properties.resumedDate

string

使用者動作或資料庫登入 (ISO8601 格式) 繼續資料庫的日期。 如果資料庫已暫停,則為 Null。

properties.sampleName

SampleName

建立此資料庫時要套用的範例架構名稱。

properties.secondaryType

SecondaryType

如果資料庫是次要資料庫,則為次要類型。 有效值為 Geo 和 Named。

properties.sourceDatabaseDeletionDate

string

指定刪除資料庫的時間。

properties.sourceDatabaseId

string

與此資料庫建立作業相關聯的源資料庫資源標識符。

properties.sourceResourceId

string

與此資料庫建立作業相關聯的來源資源標識符。

只有 DataWarehouse 版本才支援此屬性,並允許跨訂用帳戶還原。

指定 sourceResourceId 時,sourceDatabaseId、recoverableDatabaseId、restoreableDroppedDatabaseId 和 sourceDatabaseDeletionDate 不得指定,而且 CreateMode 必須是 PointInTimeRestore、Restore 或 Recover。

當 createMode 是 PointInTimeRestore 時,sourceResourceId 必須是現有資料庫或現有 sql 集區的資源標識碼,而且必須指定 restorePointInTime。

當 createMode 為 Restore 時,sourceResourceId 必須是可還原卸除資料庫的資源識別碼或可還原的卸除 SQL 集區。

當 createMode 為 Recovery 時,sourceResourceId 必須是可復原資料庫或可復原 SQL 集區的資源標識符。

當來源訂用帳戶屬於與目標訂用帳戶不同的租使用者時,“x-ms-authorization-auxiliary” 標頭必須包含來源租使用者的驗證令牌。 如需有關 「x-ms-authorization-auxiliary」 標頭的詳細資訊,請參閱 https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant

properties.status

DatabaseStatus

資料庫的狀態。

properties.zoneRedundant

boolean

不論此資料庫是否為區域備援,這表示此資料庫的複本將會分散到多個可用性區域。

sku

Sku

資料庫 SKU。

SKU 清單可能會因區域和支援供應專案而有所不同。 若要判斷 SKU (包括 SKU 名稱、層/版本、系列和容量) ,這些 SKU 可供您在 Azure 區域中的訂用帳戶使用,請使用 Capabilities_ListByLocation REST API 或下列其中一個命令:

az sql db list-editions -l <location> -o table
Get-AzSqlServerServiceObjective -Location <location>
tags

object

資源標籤。

type

string

資源類型。

DatabaseIdentity

資源的 Azure Active Directory 身分識別設定。

名稱 類型 Description
tenantId

string

Azure Active Directory 租用戶標識符。

type

DatabaseIdentityType

身分識別類型

userAssignedIdentities

<string,  DatabaseUserIdentity>

要使用的使用者指派身分識別的資源標識碼

DatabaseIdentityType

身分識別類型

名稱 類型 Description
None

string

UserAssigned

string

DatabaseLicenseType

要套用此資料庫的授權類型。 LicenseIncluded如果您需要授權,或BasePrice如果您有授權且符合 Azure Hybrid Benefit 資格。

名稱 類型 Description
BasePrice

string

LicenseIncluded

string

DatabaseReadScale

唯讀路由的狀態。 如果啟用,讓應用程式意圖在其 連接字串 中設定為唯讀的連線,可能會路由傳送至相同區域中的唯讀次要複本。 不適用於彈性集區內的超大規模資料庫。

名稱 類型 Description
Disabled

string

Enabled

string

DatabaseStatus

資料庫的狀態。

名稱 類型 Description
AutoClosed

string

Copying

string

Creating

string

Disabled

string

EmergencyMode

string

Inaccessible

string

Offline

string

OfflineChangingDwPerformanceTiers

string

OfflineSecondary

string

Online

string

OnlineChangingDwPerformanceTiers

string

Paused

string

Pausing

string

Recovering

string

RecoveryPending

string

Restoring

string

Resuming

string

Scaling

string

Shutdown

string

Standby

string

Starting

string

Stopped

string

Stopping

string

Suspect

string

DatabaseUserIdentity

資源的 Azure Active Directory 身分識別設定。

名稱 類型 Description
clientId

string

Azure Active Directory 用戶端標識符。

principalId

string

Azure Active Directory 主體標識符。

SampleName

建立此資料庫時要套用的範例架構名稱。

名稱 類型 Description
AdventureWorksLT

string

WideWorldImportersFull

string

WideWorldImportersStd

string

SecondaryType

如果資料庫是次要資料庫,則為次要類型。 有效值為 Geo 和 Named。

名稱 類型 Description
Geo

string

Named

string

Sku

ARM 資源 SKU。

名稱 類型 Description
capacity

integer

特定 SKU 的容量。

family

string

如果服務有不同層代的硬體,則針對相同的SKU,則可以在這裡擷取。

name

string

SKU 的名稱,通常是字母 + 數字代碼,例如 P3。

size

string

特定 SKU 的大小

tier

string

特定 SKU 的層級或版本,例如基本、進階。