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 –