Azure ARM 模板 SQL Server 自动调整部署错误

标签 azure azure-devops azure-rm-template

我正在部署带有 SQL Server 自动调优的 ARM 模板,我正在启用创建索引、删除索引和强制最后一个好的计划。这是我的 ARM 模板代码。

 {
  "apiVersion": "2014-04-01",
  "name": "[variables('databaseServerName')]",
  "type": "Microsoft.Sql/servers",
  "location": "[variables('databaseServerLocation')]",
  "tags":{
    "displayName": "SqlServer" 
  },
  "properties": {
    "administratorLogin": "[variables('databaseAdminLogin')]",
    "administratorLoginPassword": "[variables('databaseAdminPassword')]",
    "version": "12.0"
  },
  "resources": [
    {
      "apiVersion": "2015-01-01",
      "name": "[variables('databaseName')]",
      "type": "databases",
      "location": "[variables('databaseServerLocation')]",
      "tags": {
        "displayName": "Database"
      },
      "dependsOn": [
        "[concat('Microsoft.Sql/servers/', variables('databaseServerName'))]"
      ],
      "properties": {
        "edition": "[parameters('databaseEdition')]",
        "collation": "SQL_Latin1_General_CP1_CI_AS",
        "requestedServiceObjectiveName": "[parameters('databaseRequestedServiceObjectiveName')]"
      }
    },
    {
      "type": "firewallRules",
      "apiVersion": "2014-04-01",
      "dependsOn": [
        "[concat('Microsoft.Sql/servers/', variables('databaseServerName'))]"
      ],
      "location": "[variables('databaseServerLocation')]",
      "name": "AllowAllWindowsAzureIps",
      "properties": {
          "endIpAddress": "0.0.0.0",
          "startIpAddress": "0.0.0.0"
      }
    },
    {
      "type": "advisors",
      "name": "ForceLastGoodPlan",
      "apiVersion": "2014-04-01",
      "properties": {
        "autoExecuteValue": "Enabled"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', variables('databaseServerName'))]"
      ]
    },
    {
      "type": "advisors",
      "name": "CreateIndex",
      "apiVersion": "2014-04-01",
      "properties": {
        "autoExecuteValue": "Enabled"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', variables('databaseServerName'))]"
      ]
    },
    {
      "type": "advisors",
      "name": "DropIndex",
      "apiVersion": "2014-04-01",
      "properties": {
        "autoExecuteValue": "Enabled"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', variables('databaseServerName'))]"
      ]
    }
  ]
},

当我尝试部署模板时遇到此错误。据我了解,如果我尝试在短时间内部署两次,可能会发生此错误。然而,第一次部署是在 24 小时前。

BadRequest {
  "code": "45363",
  "message": "Server automatic tuning settings from previous request have not propagated to all databases yet. Please try again in few minutes.",
  "target": null,
  "details": [{
    "code": "45363",
    "message": "Server automatic tuning settings from previous request have not propagated to all databases yet. Please try again in few minutes.",
    "target": null,
    "severity": "16"
  }],
  "innererror": []
}

任何人都可以提供一些有关如何避免此错误的见解吗?当我在几分钟后再次尝试时,它确实起作用了,但它也导致应用程序关闭了几分钟。

最佳答案

{
  "type": "advisors",
  "name": "ForceLastGoodPlan",
  "apiVersion": "2014-04-01",
  "properties": {
    "autoExecuteValue": "Enabled"
  },
  "dependsOn": [
    "[resourceId('Microsoft.Sql/servers', variables('databaseServerName'))]",
    "CreateIndex"
  ]
},
{
  "type": "advisors",
  "name": "CreateIndex",
  "apiVersion": "2014-04-01",
  "properties": {
    "autoExecuteValue": "Enabled"
  },
  "dependsOn": [
    "[resourceId('Microsoft.Sql/servers', variables('databaseServerName'))]",
    "DropIndex"
  ]
},
{
  "type": "advisors",
  "name": "DropIndex",
  "apiVersion": "2014-04-01",
  "properties": {
    "autoExecuteValue": "Enabled"
  },
  "dependsOn": [
    "[resourceId('Microsoft.Sql/servers', variables('databaseServerName'))]",
    "[variables('databaseName')]"
  ]
}

我会尝试使用这些子资源创建一个 dependentOn 链。

关于Azure ARM 模板 SQL Server 自动调整部署错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54031421/

相关文章:

python - Azure功能不使用可用主机实例

Azure Kubernetes 服务 ARM 模板不是幂等的

azure - 无法删除 Azure VM

azure - 如何在 ARM 模板中引用在 Azure 门户中创建的现有存储帐户

azure - 如何使用非默认功能键?

visual-studio-2010 - Azure VM角色问题

azure - 防止 Azure Live Metrics Stream 将每个轮询记录到队列

azure - 在 CD 管道中,从 drop 文件夹需要下载特定文件而不是整个 drop 文件夹

azure-devops - Azure Devops 警告内联 shell 脚本

visual-studio - 在多个 TFS 服务器之间切换是否有任何负面影响?