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

时间:2019-01-03 23:55:22

标签: azure azure-devops arm-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": []
}

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

1 个答案:

答案 0 :(得分:2)

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        // Add this line
        super.onActivityResult(requestCode, resultCode, data);

        // This all remains the same
        if (requestCode == 1) {
            if(resultCode == RESULT_OK) {
                MyCustomDialogFragment newPopup = new MyCustomDialogFragment();
                newPopup.setMyClickListener(MainActivity.this);
                FragmentManager fragmentManager = getSupportFragmentManager();
                newPopup.show(fragmentManager, "CashReceivePopup");  
          } 
       }
   }

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