0

我能夠通過提及定價層來創建Azure Sql數據庫。如何通過Api爲Azure Sql數據庫設置DTU?

我想爲數據庫設置內存和DTU。

我無法找到正確的API,這裏是我試過

PUT : https://management.azure.com/subscriptions/<subscription-ID>/resourceGroups/<Resource-group-Name>/providers/Microsoft.Sql/servers/<Server-name>/databases/<Database-name>/?api-version=2014-04-01 

請求正文:

{ 
       "location": "East Asia", 
       "properties": { 
        "edition": "Premium", 
        "collation":"SQL_Latin1_General_CP1_CI_AS", 
       "sampleName": "blank database", 
       "serviceTierAdvisors":[ 
        { 
         "maxSizeInGB":"150", 
         "maxDtu":"500" 
        } 
        ] 
       } 
    } 

,我沒有得到正確的錯誤消息也,任何人都可以引導我用於在數據庫級別設置DTU的參數?

+0

會sql查詢爲您好嗎?或者你想通過API來做到這一點? –

+0

看來你有錯誤的負載檢查這個URL https://docs.microsoft.com/en-us/rest/api/sql/Databases/Update –

+0

@VolodymyrBilyachat:我正在驗證相同的URL對於api構造。你能告訴我設置DTU的參數嗎?我試過沒有任何工作。 「屬性」:{ \t \t \t \t \t \t \t \t 「版」: 「標準」, \t \t \t \t 「maxSizeBytes」: 「268435456000」 }數據庫的 尺寸我可以直接設置它像這樣,我如何設置DTU? –

回答

3

任何人都可以指導我在數據庫級設置DTU的參數?

正確的DTU參數應爲requestedServiceObjectiveName。它的類型是enum。您可以爲此屬性設置以下值。

Basic, 
S0, S1, S2, S3 
P1, P2, P4, P6, P11, P15 
System, System2 
ElasticPool 

請檢查相應的DTU值如下。

Basic(5DTU), 
S0(10DTU), S1(20DTU), S2(50DTU), S3(100DTU) 
P1(125DTU), P2(250DTU), P4(500DTU), P6(1000DTU), P11(1750DTU), P15(4000DTU) 
System, System2 
ElasticPool 
1

您需要使用API​​來更新數據庫,如this文章中所述。

例如:

{ 
    "parameters": { 
     "subscriptionId": "00000000-1111-2222-3333-444444444444", 
     "resourceGroupName": "sqlcrudtest-4799", 
     "serverName": "sqlcrudtest-5961", 
     "databaseName": "testdb", 
     "api-version": "2014-04-01", 
     "parameters": { 
      "properties": { 
       "edition": "Standard", 
       "status": "Online", 
       "createMode": "Default", 
       "serviceLevelObjective": "S0", 
       "collation": "SQL_Latin1_General_CP1_CI_AS", 
       "maxSizeBytes": "268435456000", 
       "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", 
         "requestedServiceObjectiveId": "dd6d99bb-f193-4ec1-86f2-43d3bccbc49c", 
              "requestedServiceObjectiveName": "Basic", 
       "defaultSecondaryLocation": "Japan West", 
       "earliestRestoreDate": "2017-02-10T01:52:52.923Z", 
       "containmentState": 2, 
       "readScale": "Disabled" 
      } 
     } 
    }, 
    "responses": { 
     "200": { 
      "body": { 
       "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdb", 
       "name": "testdb", 
       "type": "Microsoft.Sql/servers/databases", 
       "location": "Japan East", 
       "kind": "v12.0,user", 
       "properties": { 
        "edition": "Standard", 
        "status": "Online", 
        "serviceLevelObjective": "S0", 
        "collation": "SQL_Latin1_General_CP1_CI_AS", 
        "creationDate": "2017-02-24T22:39:46.547Z", 
        "maxSizeBytes": "268435456000", 
        "currentServiceObjectiveId": "f1173c43-91bd-4aaa-973c-54e79e15235b", 
        "requestedServiceObjectiveId": "dd6d99bb-f193-4ec1-86f2-43d3bccbc49c", 
        "requestedServiceObjectiveName": "Basic",     "sampleName": null, 
        "defaultSecondaryLocation": "Japan West", 
        "earliestRestoreDate": "2017-02-10T01:52:52.923Z", 
        "elasticPoolName": null, 
        "containmentState": 2, 
        "readScale": "Disabled", 
        "failoverGroupId": null 
       } 
      } 
     }, 
     "202": {} 
    } 
} 

在我從標準S0縮減爲基本層上面的例子。

希望這會有所幫助。

+0

感謝您的回覆阿爾貝託,這不回答我的問題阿爾貝託。我的問題很簡單。如何通過有效載荷傳遞數據庫DTU它的參數是什麼? –

+0

@VishnuRanganathan你不直接傳遞DTU。相反,您可以通過serviceLevelObjective參數來控制DTU。請參閱https://docs.microsoft.com/zh-CN/azure/sql-database/sql-database-service-tiers –