在没有ElasticPool的情况下部署Azure SQL Server辅助数据库

时间:2019-06-20 14:23:35

标签: azure azure-resource-manager

我正在尝试部署具有弹性池的SQL azure数据库,而没有弹性池的辅助数据库,但出现此错误:

 {
  "status": "Failed",
  "error": {
    "code": "ResourceDeploymentFailure",
    "message": "The resource operation completed with terminal provisioning state 'Failed'.",
    "details": [
      {
        "code": "TargetElasticPoolDoesNotExist",
        "message": "The operation could not be completed because elastic pool 'mypool' does not exist on a target server 'myserverreplica'."
      }
    ]
  }
}

这是我正在使用的模板(为简单起见,我删除了参数)

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        ....
    },
    "variables": {
        "sqlServerHostNameReplica": "[concat(parameters('sqlServerHostName'),'replica')]",
        "collation": "SQL_Latin1_General_CP1_CI_AS"
    },
    "resources": [
        {
            "type": "Microsoft.Sql/servers",
            "apiVersion": "2015-05-01-preview",
            "name": "[parameters('sqlServerHostName')]",
            "location": "[resourceGroup().location]",
            "tags": {
                "displayName": "SqlServer Primary",
                "Environment": "[parameters('environment')]"
            },
            "kind": "v12.0",
            "properties": {
                "administratorLogin": "[parameters('sqlServerAdminLogin')]",
                "administratorLoginPassword": "[parameters('sqlServerAdminLoginPassword')]",
                "version": "12.0"
            },
            "resources": [
                {
                    "type": "firewallRules",
                    "apiVersion": "2015-05-01-preview",
                    "name": "AllowAllWindowsAzureIps",
                    "dependsOn": [
                        "[resourceId('Microsoft.Sql/servers', parameters('sqlServerHostName'))]"
                    ],
                    "properties": {
                        "startIpAddress": "0.0.0.0",
                        "endIpAddress": "0.0.0.0"
                    }
                }
            ]
        },
        {
            "type": "Microsoft.Sql/servers",
            "apiVersion": "2015-05-01-preview",
            "name": "[variables('sqlServerHostNameReplica')]",
            "location": "[parameters('sqlServerReplicaLocation')]",
            "tags": {
                "displayName": "SqlServer Replica",
                "Environment": "[parameters('environment')]"
            },
            "kind": "v12.0",
            "properties": {
                "administratorLogin": "[parameters('sqlServerAdminLogin')]",
                "administratorLoginPassword": "[parameters('sqlServerAdminLoginPassword')]",
                "version": "12.0"
            },
            "resources": [
                {
                    "type": "firewallRules",
                    "apiVersion": "2015-05-01-preview",
                    "name": "AllowAllWindowsAzureIps",
                    "dependsOn": [
                        "[resourceId('Microsoft.Sql/servers', variables('sqlServerHostNameReplica'))]"
                    ],
                    "properties": {
                        "startIpAddress": "0.0.0.0",
                        "endIpAddress": "0.0.0.0"
                    }
                }
            ],
            "dependsOn": [
                "[resourceId('Microsoft.Sql/servers', parameters('sqlServerHostName'))]",
                "[resourceId('Microsoft.Sql/servers/elasticPools', parameters('sqlServerHostName'), parameters('sqlServerElasticPoolName'))]",
                "poolDBs"
            ]
        },
        {
            "type": "Microsoft.Sql/servers/elasticPools",
            "name": "[concat(parameters('sqlServerHostName'), '/', parameters('sqlServerElasticPoolName'))]",
            "apiVersion": "2014-04-01",
            "location": "[resourceGroup().location]",
            "tags": {
                "displayName": "ElasticPool Primary",
                "Environment": "[parameters('environment')]"
            },
            "properties": {
                "edition": "[parameters('sqlServerElasticPoolEdition')]",
                "dtu": "[parameters('sqlServerElasticPoolDtu')]",
                "databaseDtuMin": "[parameters('sqlServerDbDtuMin')]",
                "databaseDtuMax": "[parameters('sqlServerDbDtuMax')]"
            },
            "dependsOn": [
                "[resourceId('Microsoft.Sql/servers', parameters('sqlServerHostName'))]"
            ]
        },
        {
            "type": "Microsoft.Sql/servers/databases",
            "apiVersion": "2017-03-01-preview",
            "name": "[concat(parameters('sqlServerHostName'),'/', parameters('sqlServerDatabases')[copyIndex()].Name)]",
            "location": "[resourceGroup().location]",
            "tags": {
                "displayName": "Databases Primary",
                "Environment": "[parameters('environment')]"
            },
            "copy": {
                "name": "poolDBs",
                "count": "[length(parameters('sqlServerDatabases'))]"
            },
            "dependsOn": [
                "[resourceId('Microsoft.Sql/servers', parameters('sqlServerHostName'))]",
                "[resourceId('Microsoft.Sql/servers/elasticpools', parameters('sqlServerHostName'), parameters('sqlServerElasticPoolName'))]"
            ],
            "kind": "v12.0,user",
            "properties": {
                "collation": "[variables('collation')]",
                "maxSizeBytes": 268435456000,
                "catalogCollation": "[variables('collation')]",
                "zoneRedundant": false,
                "requestedServiceObjectiveName": "ElasticPool",
                "elasticPoolId": "[resourceId('Microsoft.Sql/servers/elasticpools', parameters('sqlServerHostName'), parameters('sqlServerElasticPoolName'))]"
            },
            "resources": [
            ]
        },
        {
            "condition": "[parameters('sqlServerDatabases')[copyIndex()].Replica]",
            "type": "Microsoft.Sql/servers/databases",
            "apiVersion": "2017-03-01-preview",
            "name": "[concat(variables('sqlServerHostNameReplica'),'/', parameters('sqlServerDatabases')[copyIndex()].Name)]",
            "location": "[parameters('sqlServerReplicaLocation')]",
            "tags": {
                "displayName": "Databases Replica",
                "Environment": "[parameters('environment')]"
            },
            "copy": {
                "name": "replicaDBs",
                "count": "[length(parameters('sqlServerDatabases'))]"
            },
            "dependsOn": [
                "[resourceId('Microsoft.Sql/servers/databases/', parameters('sqlServerHostName'),parameters('sqlServerDatabases')[copyIndex()].Name)]",
                "[resourceId('Microsoft.Sql/servers', variables('sqlServerHostNameReplica'))]"
            ],
            "kind": "v12.0,user",
                "North Europe"
            "properties": {
                "createMode": "OnlineSecondary",
                "sourceDatabaseId": "[resourceId('Microsoft.Sql/servers/databases/', parameters('sqlServerHostName'),parameters('sqlServerDatabases')[copyIndex()].Name)]",
                "edition": "Standard",
                "status": "Online",
                "collation": "[variables('collation')]",
                "maxSizeBytes": 268435456000,
                "requestedServiceObjectiveName": "S1",
                "containmentState": 2
            },
            "resources": []
        }
    ]
}

link(我的重点)

  

每个辅助数据库可以分别参与一个弹性池   或完全没有弹性。每个池的选择   辅助数据库是独立的,不依赖于   其他任何辅助数据库的配置(无论是主数据库还是   次要)。每个弹性池都包含在一个区域中,   因此,同一拓扑中的多个辅助数据库永远无法   共享一个弹性池。

我设法做到这一点的唯一方法是通过在辅助服务器上创建一个具有相同名称的弹性池,但是文档建议应该没有池的辅助池也可以。

我看错文档了吗?

谢谢

0 个答案:

没有答案