Databases - Get
取得資料庫。
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}?api-version=2014-04-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}?api-version=2014-04-01&$expand={$expand}
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
database
|
path | True |
string |
要擷取的資料庫名稱。 |
|
resource
|
path | True |
string |
包含資源的資源群組名稱。 您可以從 Azure Resource Manager API 或入口網站取得此值。 |
|
server
|
path | True |
string |
伺服器的名稱。 |
|
subscription
|
path | True |
string |
識別 Azure 訂用帳戶的訂用帳戶標識碼。 |
|
api-version
|
query | True |
string |
要用於要求的 API 版本。 |
|
$expand
|
query |
string |
要展開回應中子物件的逗號分隔清單。 可能的屬性:serviceTierAdvisors、transparentDataEncryption。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
還行 |
範例
Get a database
範例要求
GET https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-9187?api-version=2014-04-01
範例回覆
{
"tags": {
"tagKey1": "TagValue1"
},
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-9187",
"name": "sqlcrudtest-9187",
"type": "Microsoft.Sql/servers/databases",
"location": "Japan East",
"kind": "v12.0,user",
"properties": {
"databaseId": "200216b2-dc19-4866-85aa-f73fe4a1ebac",
"edition": "Basic",
"status": "Online",
"serviceLevelObjective": "Basic",
"collation": "SQL_Latin1_General_CP1_CI_AS",
"maxSizeBytes": "2147483648",
"creationDate": "2017-02-10T00:56:19.2Z",
"currentServiceObjectiveId": "dd6d99bb-f193-4ec1-86f2-43d3bccbc49c",
"requestedServiceObjectiveId": "dd6d99bb-f193-4ec1-86f2-43d3bccbc49c",
"requestedServiceObjectiveName": "Basic",
"sampleName": null,
"defaultSecondaryLocation": "Japan West",
"earliestRestoreDate": "2017-02-10T01:06:29.78Z",
"elasticPoolName": null,
"containmentState": 2,
"readScale": "Disabled",
"failoverGroupId": null
}
}
定義
| 名稱 | Description |
|---|---|
|
Create |
指定資料庫建立模式。 默認值:定期建立資料庫。 複製:建立資料庫做為現有資料庫的複本。 sourceDatabaseId 必須指定為源資料庫的資源標識碼。 OnlineSecondary/NonReadableSecondary:建立資料庫做為現有資料庫的次要複本(可讀取或不可讀取的)。 sourceDatabaseId 必須指定為現有主資料庫的資源標識碼。 PointInTimeRestore:藉由還原現有資料庫的時間點備份來建立資料庫。 sourceDatabaseId 必須指定為現有資料庫的資源標識符,而且必須指定 restorePointInTime。 復原:藉由還原異地復寫備份來建立資料庫。 sourceDatabaseId 必須指定為要還原的可復原資料庫資源標識符。 還原:藉由還原已刪除資料庫的備份來建立資料庫。 必須指定sourceDatabaseId。 如果 sourceDatabaseId 是資料庫的原始資源識別碼,則必須指定 sourceDatabaseDeletionDate。 否則,sourceDatabaseId 必須是可還原的卸除資料庫資源標識符,而且會忽略 sourceDatabaseDeletionDate。 restorePointInTime 也可以指定為從先前的時間點還原。 RestoreLongTermRetentionBackup:從長期保留保存庫還原來建立資料庫。 recoveryServicesRecoveryPointResourceId 必須指定為恢復點資源標識符。 DataWarehouse 版本不支援 Copy、NonReadableSecondary、OnlineSecondary 和 RestoreLongTermRetentionBackup。 |
| Database |
表示資料庫。 |
|
Database |
資料庫的版本。 DatabaseEditions 列舉包含所有有效的版本。 如果 createMode 為 NonReadableSecondary 或 OnlineSecondary,則會忽略此值。 SKU 清單可能會因區域和支援供應項目而異。 若要判斷 Azure 區域中訂用帳戶可用的 SKU(包括 SKU 名稱、層/版本、系列和容量),請使用
|
|
Operation |
執行建議索引動作的估計影響。 |
|
Read |
有條件的。 如果資料庫是異地輔助資料庫,readScale 會指出是否允許此資料庫的唯讀連線。 DataWarehouse 版本不支援。 |
|
Recommended |
此資料庫的建議索引。 |
|
Recommended |
建議的索引動作。 您可以建立遺漏的索引、卸除未使用的索引,或重建現有的索引以改善其效能。 |
|
Recommended |
目前的建議狀態。 |
|
Recommended |
索引的類型(CLUSTERED、NONCLUSTERED、COLUMNSTORE、CLUSTERED COLUMNSTORE) |
|
Sample |
指出建立這個資料庫時要套用的範例架構名稱。 如果 createMode 不是 Default,則會忽略此值。 DataWarehouse 版本不支援。 |
|
Service |
資料庫所設定服務等級目標的名稱。 這是在套用至資料庫的過程中的服務等級目標。 成功更新之後,它會比對 serviceLevelObjective 屬性的值。 SKU 清單可能會因區域和支援供應項目而異。 若要判斷 Azure 區域中訂用帳戶可用的 SKU(包括 SKU 名稱、層/版本、系列和容量),請使用
|
|
Service |
此資料庫的服務層級建議程式清單。 展開的屬性 |
|
Slo |
取得或設定 Service Tier Advisor 的 serviceLevelObjectiveUsageMetrics。 |
|
Transparent |
此資料庫的透明數據加密資訊。 |
|
Transparent |
資料庫透明數據加密的狀態。 |
CreateMode
指定資料庫建立模式。
默認值:定期建立資料庫。
複製:建立資料庫做為現有資料庫的複本。 sourceDatabaseId 必須指定為源資料庫的資源標識碼。
OnlineSecondary/NonReadableSecondary:建立資料庫做為現有資料庫的次要複本(可讀取或不可讀取的)。 sourceDatabaseId 必須指定為現有主資料庫的資源標識碼。
PointInTimeRestore:藉由還原現有資料庫的時間點備份來建立資料庫。 sourceDatabaseId 必須指定為現有資料庫的資源標識符,而且必須指定 restorePointInTime。
復原:藉由還原異地復寫備份來建立資料庫。 sourceDatabaseId 必須指定為要還原的可復原資料庫資源標識符。
還原:藉由還原已刪除資料庫的備份來建立資料庫。 必須指定sourceDatabaseId。 如果 sourceDatabaseId 是資料庫的原始資源識別碼,則必須指定 sourceDatabaseDeletionDate。 否則,sourceDatabaseId 必須是可還原的卸除資料庫資源標識符,而且會忽略 sourceDatabaseDeletionDate。 restorePointInTime 也可以指定為從先前的時間點還原。
RestoreLongTermRetentionBackup:從長期保留保存庫還原來建立資料庫。 recoveryServicesRecoveryPointResourceId 必須指定為恢復點資源標識符。
DataWarehouse 版本不支援 Copy、NonReadableSecondary、OnlineSecondary 和 RestoreLongTermRetentionBackup。
| 值 | Description |
|---|---|
| Copy | |
| Default | |
| NonReadableSecondary | |
| OnlineSecondary | |
| PointInTimeRestore | |
| Recovery | |
| Restore | |
| RestoreLongTermRetentionBackup |
Database
表示資料庫。
| 名稱 | 類型 | Description |
|---|---|---|
| id |
string |
資源標識碼。 |
| kind |
string |
資料庫種類。 這是用於 Azure 入口網站體驗的元數據。 |
| location |
string |
資源位置。 |
| name |
string |
資源名稱。 |
| properties.collation |
string |
資料庫的定序。 如果 createMode 不是 Default,則會忽略此值。 |
| properties.containmentState |
integer (int64) |
資料庫的內含項目狀態。 |
| properties.createMode |
指定資料庫建立模式。 默認值:定期建立資料庫。 複製:建立資料庫做為現有資料庫的複本。 sourceDatabaseId 必須指定為源資料庫的資源標識碼。 OnlineSecondary/NonReadableSecondary:建立資料庫做為現有資料庫的次要複本(可讀取或不可讀取的)。 sourceDatabaseId 必須指定為現有主資料庫的資源標識碼。 PointInTimeRestore:藉由還原現有資料庫的時間點備份來建立資料庫。 sourceDatabaseId 必須指定為現有資料庫的資源標識符,而且必須指定 restorePointInTime。 復原:藉由還原異地復寫備份來建立資料庫。 sourceDatabaseId 必須指定為要還原的可復原資料庫資源標識符。 還原:藉由還原已刪除資料庫的備份來建立資料庫。 必須指定sourceDatabaseId。 如果 sourceDatabaseId 是資料庫的原始資源識別碼,則必須指定 sourceDatabaseDeletionDate。 否則,sourceDatabaseId 必須是可還原的卸除資料庫資源標識符,而且會忽略 sourceDatabaseDeletionDate。 restorePointInTime 也可以指定為從先前的時間點還原。 RestoreLongTermRetentionBackup:從長期保留保存庫還原來建立資料庫。 recoveryServicesRecoveryPointResourceId 必須指定為恢復點資源標識符。 DataWarehouse 版本不支援 Copy、NonReadableSecondary、OnlineSecondary 和 RestoreLongTermRetentionBackup。 |
|
| properties.creationDate |
string (date-time) |
資料庫的建立日期(ISO8601格式)。 |
| properties.currentServiceObjectiveId |
string (uuid) |
資料庫的目前服務等級目標標識碼。 這是目前作用中之服務等級目標的標識符。 |
| properties.databaseId |
string (uuid) |
資料庫的標識碼。 |
| properties.defaultSecondaryLocation |
string |
這個資料庫的預設次要區域。 |
| properties.earliestRestoreDate |
string (date-time) |
這會記錄此資料庫最早的開始日期和時間(ISO8601格式)。 |
| properties.edition |
資料庫的版本。 DatabaseEditions 列舉包含所有有效的版本。 如果 createMode 為 NonReadableSecondary 或 OnlineSecondary,則會忽略此值。 SKU 清單可能會因區域和支援供應項目而異。 若要判斷 Azure 區域中訂用帳戶可用的 SKU(包括 SKU 名稱、層/版本、系列和容量),請使用
|
|
| properties.elasticPoolName |
string |
資料庫位於的彈性集區名稱。 如果 elasticPoolName 和 requestedServiceObjectiveName 都已更新,則會忽略 requestedServiceObjectiveName 的值。 DataWarehouse 版本不支援。 |
| properties.failoverGroupId |
string |
包含此資料庫的故障轉移群組資源標識碼。 |
| properties.maxSizeBytes |
string |
以位元組表示的資料庫大小上限。 如果 createMode 不是 Default,則會忽略此值。 若要查看可能的值,請查詢 operationId 所參考的功能 API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities):“Capabilities_ListByLocation”。 |
| properties.readScale |
有條件的。 如果資料庫是異地輔助資料庫,readScale 會指出是否允許此資料庫的唯讀連線。 DataWarehouse 版本不支援。 |
|
| properties.recommendedIndex |
此資料庫的建議索引。 |
|
| properties.recoveryServicesRecoveryPointResourceId |
string |
有條件的。 如果 createMode 為 RestoreLongTermRetentionBackup,則需要此值。 指定要從中還原之恢復點的資源標識碼。 |
| properties.requestedServiceObjectiveId |
string (uuid) |
資料庫已設定的服務等級目標標識碼。 這是在套用至資料庫的過程中的服務等級目標。 成功更新之後,它會比對 currentServiceObjectiveId 屬性的值。 如果同時更新 requestedServiceObjectiveId 和 requestedServiceObjectiveName,requestedServiceObjectiveId 的值會覆寫 requestedServiceObjectiveName 的值。 SKU 清單可能會因區域和支援供應項目而異。 若要判斷 Azure 區域中訂用帳戶可用的服務目標標識碼,請使用 |
| properties.requestedServiceObjectiveName |
資料庫所設定服務等級目標的名稱。 這是在套用至資料庫的過程中的服務等級目標。 成功更新之後,它會比對 serviceLevelObjective 屬性的值。 SKU 清單可能會因區域和支援供應項目而異。 若要判斷 Azure 區域中訂用帳戶可用的 SKU(包括 SKU 名稱、層/版本、系列和容量),請使用
|
|
| properties.restorePointInTime |
string (date-time) |
有條件的。 如果 createMode 是 PointInTimeRestore,則需要此值。 如果 createMode 為 Restore,這個值是選擇性的。 指定要還原以建立新資料庫的源資料庫的時間點(ISO8601格式)。 必須大於或等於源資料庫的最早RestoreDate 值。 |
| properties.sampleName |
指出建立這個資料庫時要套用的範例架構名稱。 如果 createMode 不是 Default,則會忽略此值。 DataWarehouse 版本不支援。 |
|
| properties.serviceLevelObjective |
資料庫目前的服務等級目標。 |
|
| properties.serviceTierAdvisors |
此資料庫的服務層級建議程式清單。 展開的屬性 |
|
| properties.sourceDatabaseDeletionDate |
string (date-time) |
有條件的。 如果 createMode 為 Restore,且 sourceDatabaseId 是已刪除的資料庫原始資源標識符,當它存在時,它就會成為已刪除的資料庫標識碼(與其目前可還原的已卸除資料庫標識符相反),則需要此值。 指定刪除資料庫的時間。 |
| properties.sourceDatabaseId |
string |
有條件的。 如果 createMode 為 Copy、NonReadableSecondary、OnlineSecondary、PointInTimeRestore、Recovery 或 Restore,則需要此值。 指定源資料庫的資源識別碼。 如果 createMode 為 NonReadableSecondary 或 OnlineSecondary,源資料庫的名稱必須與所建立的新資料庫相同。 |
| properties.status |
string |
資料庫的狀態。 |
| properties.transparentDataEncryption |
此資料庫的透明數據加密資訊。 |
|
| properties.zoneRedundant |
boolean |
此資料庫是否為區域備援,這表示此資料庫的複本會分散到多個可用性區域。 |
| tags |
object |
資源標籤。 |
| type |
string |
資源類型。 |
DatabaseEdition
資料庫的版本。 DatabaseEditions 列舉包含所有有效的版本。 如果 createMode 為 NonReadableSecondary 或 OnlineSecondary,則會忽略此值。
SKU 清單可能會因區域和支援供應項目而異。 若要判斷 Azure 區域中訂用帳戶可用的 SKU(包括 SKU 名稱、層/版本、系列和容量),請使用 Capabilities_ListByLocation REST API 或下列其中一個命令:
az sql db list-editions -l <location> -o table
Get-AzSqlServerServiceObjective -Location <location>
| 值 | Description |
|---|---|
| Web | |
| Business | |
| Basic | |
| Standard | |
| Premium | |
| PremiumRS | |
| Free | |
| Stretch | |
| DataWarehouse | |
| System | |
| System2 | |
| GeneralPurpose | |
| BusinessCritical | |
| Hyperscale |
OperationImpact
執行建議索引動作的估計影響。
| 名稱 | 類型 | Description |
|---|---|---|
| changeValueAbsolute |
number (double) |
維度的絕對影響。 |
| changeValueRelative |
number (double) |
維度的相對影響(如果不適用則為 null) |
| name |
string |
影響維度的名稱。 |
| unit |
string |
測量維度預估影響所在的單位。 |
ReadScale
有條件的。 如果資料庫是異地輔助資料庫,readScale 會指出是否允許此資料庫的唯讀連線。 DataWarehouse 版本不支援。
| 值 | Description |
|---|---|
| Enabled | |
| Disabled |
RecommendedIndex
此資料庫的建議索引。
| 名稱 | 類型 | Description |
|---|---|---|
| id |
string |
資源標識碼。 |
| name |
string |
資源名稱。 |
| properties.action |
建議的索引動作。 您可以建立遺漏的索引、卸除未使用的索引,或重建現有的索引以改善其效能。 |
|
| properties.columns |
string[] |
要建置索引的數據行 |
| properties.created |
string (date-time) |
顯示此資源建立時間的 UTC 日期時間(ISO8601格式)。 |
| properties.estimatedImpact |
執行建議索引動作的估計影響。 |
|
| properties.includedColumns |
string[] |
要包含在索引中的數據行名稱清單 |
| properties.indexScript |
string |
完整組建索引腳本 |
| properties.indexType |
索引的類型(CLUSTERED、NONCLUSTERED、COLUMNSTORE、CLUSTERED COLUMNSTORE) |
|
| properties.lastModified |
string (date-time) |
上次變更此資源的 UTC 日期時間(ISO8601格式)。 |
| properties.reportedImpact |
索引動作完成之後所報告的值。 |
|
| properties.schema |
string |
要在其中建置索引的架構 |
| properties.state |
目前的建議狀態。 |
|
| properties.table |
string |
要建置索引的數據表。 |
| type |
string |
資源類型。 |
RecommendedIndexAction
建議的索引動作。 您可以建立遺漏的索引、卸除未使用的索引,或重建現有的索引以改善其效能。
| 值 | Description |
|---|---|
| Create | |
| Drop | |
| Rebuild |
RecommendedIndexState
目前的建議狀態。
| 值 | Description |
|---|---|
| Active | |
| Pending | |
| Executing | |
| Verifying | |
| Pending Revert | |
| Reverting | |
| Reverted | |
| Ignored | |
| Expired | |
| Blocked | |
| Success |
RecommendedIndexType
索引的類型(CLUSTERED、NONCLUSTERED、COLUMNSTORE、CLUSTERED COLUMNSTORE)
| 值 | Description |
|---|---|
| CLUSTERED | |
| NONCLUSTERED | |
| COLUMNSTORE | |
| CLUSTERED COLUMNSTORE |
SampleName
指出建立這個資料庫時要套用的範例架構名稱。 如果 createMode 不是 Default,則會忽略此值。 DataWarehouse 版本不支援。
| 值 | Description |
|---|---|
| AdventureWorksLT |
ServiceObjectiveName
資料庫所設定服務等級目標的名稱。 這是在套用至資料庫的過程中的服務等級目標。 成功更新之後,它會比對 serviceLevelObjective 屬性的值。
SKU 清單可能會因區域和支援供應項目而異。 若要判斷 Azure 區域中訂用帳戶可用的 SKU(包括 SKU 名稱、層/版本、系列和容量),請使用 Capabilities_ListByLocation REST API 或下列其中一個命令:
az sql db list-editions -l <location> -o table
Get-AzSqlServerServiceObjective -Location <location>
| 值 | Description |
|---|---|
| System | |
| System0 | |
| System1 | |
| System2 | |
| System3 | |
| System4 | |
| System2L | |
| System3L | |
| System4L | |
| Free | |
| Basic | |
| S0 | |
| S1 | |
| S2 | |
| S3 | |
| S4 | |
| S6 | |
| S7 | |
| S9 | |
| S12 | |
| P1 | |
| P2 | |
| P3 | |
| P4 | |
| P6 | |
| P11 | |
| P15 | |
| PRS1 | |
| PRS2 | |
| PRS4 | |
| PRS6 | |
| DW100 | |
| DW200 | |
| DW300 | |
| DW400 | |
| DW500 | |
| DW600 | |
| DW1000 | |
| DW1200 | |
| DW1000c | |
| DW1500 | |
| DW1500c | |
| DW2000 | |
| DW2000c | |
| DW3000 | |
| DW2500c | |
| DW3000c | |
| DW6000 | |
| DW5000c | |
| DW6000c | |
| DW7500c | |
| DW10000c | |
| DW15000c | |
| DW30000c | |
| DS100 | |
| DS200 | |
| DS300 | |
| DS400 | |
| DS500 | |
| DS600 | |
| DS1000 | |
| DS1200 | |
| DS1500 | |
| DS2000 | |
| ElasticPool |
ServiceTierAdvisor
此資料庫的服務層級建議程式清單。 展開的屬性
| 名稱 | 類型 | Description |
|---|---|---|
| id |
string |
資源標識碼。 |
| name |
string |
資源名稱。 |
| properties.activeTimeRatio |
number (double) |
適用於服務層建議程式的 activeTimeRatio。 |
| properties.avgDtu |
number (double) |
取得或設定服務層建議程式的avgDtu。 |
| properties.confidence |
number (double) |
取得或設定服務層級建議程式的信心。 |
| properties.currentServiceLevelObjective |
string |
取得或設定服務層級建議程式目前的ServiceLevelObjective。 |
| properties.currentServiceLevelObjectiveId |
string (uuid) |
取得或設定服務層級建議程式目前的ServiceLevelObjectiveId。 |
| properties.databaseSizeBasedRecommendationServiceLevelObjective |
string |
取得或設定服務層級建議程序的資料庫SizeBasedRecommendationServiceLevelObjective。 |
| properties.databaseSizeBasedRecommendationServiceLevelObjectiveId |
string (uuid) |
取得或設定服務層級建議程序的資料庫SizeBasedRecommendationServiceLevelObjectiveId。 |
| properties.disasterPlanBasedRecommendationServiceLevelObjective |
string |
取得或設定 service tier Advisor 的 disasterPlanBasedRecommendationServiceLevelObjective。 |
| properties.disasterPlanBasedRecommendationServiceLevelObjectiveId |
string (uuid) |
取得或設定 service tier Advisor 的 disasterPlanBasedRecommendationServiceLevelObjectiveId。 |
| properties.maxDtu |
number (double) |
取得或設定服務層建議程式的最大Dtu。 |
| properties.maxSizeInGB |
number (double) |
取得或設定 Service Tier Advisor 的 maxSizeInGB。 |
| properties.minDtu |
number (double) |
取得或設定服務層建議程式 minDtu。 |
| properties.observationPeriodEnd |
string (date-time) |
觀察期間開始(ISO8601格式)。 |
| properties.observationPeriodStart |
string (date-time) |
觀察期間開始(ISO8601格式)。 |
| properties.overallRecommendationServiceLevelObjective |
string |
取得或設定服務層級建議程序的整體RecommendationServiceLevelObjective。 |
| properties.overallRecommendationServiceLevelObjectiveId |
string (uuid) |
取得或設定服務層級建議程序的整體RecommendationServiceLevelObjectiveId。 |
| properties.serviceLevelObjectiveUsageMetrics |
取得或設定 Service Tier Advisor 的 serviceLevelObjectiveUsageMetrics。 |
|
| properties.usageBasedRecommendationServiceLevelObjective |
string |
取得或設定 Service Tier Advisor 的 usageBasedRecommendationServiceLevelObjective。 |
| properties.usageBasedRecommendationServiceLevelObjectiveId |
string (uuid) |
取得或設定 Service Tier Advisor 的 usageBasedRecommendationServiceLevelObjectiveId。 |
| type |
string |
資源類型。 |
SloUsageMetric
取得或設定 Service Tier Advisor 的 serviceLevelObjectiveUsageMetrics。
| 名稱 | 類型 | Description |
|---|---|---|
| inRangeTimeRatio |
number (double) |
取得或設定 SLO 使用計量的 inRangeTimeRatio。 |
| serviceLevelObjective |
SLO 使用計量的 serviceLevelObjective。 |
|
| serviceLevelObjectiveId |
string (uuid) |
SLO 使用計量的 serviceLevelObjectiveId。 |
TransparentDataEncryption
此資料庫的透明數據加密資訊。
| 名稱 | 類型 | Description |
|---|---|---|
| id |
string |
資源標識碼。 |
| location |
string |
資源位置。 |
| name |
string |
資源名稱。 |
| properties.status |
資料庫透明數據加密的狀態。 |
|
| type |
string |
資源類型。 |
TransparentDataEncryptionStatus
資料庫透明數據加密的狀態。
| 值 | Description |
|---|---|
| Enabled | |
| Disabled |