Azure 的 Windows 虚拟机上运行的 SQL Server 常见问题解答Frequently asked questions for SQL Server running on Windows virtual machines in Azure

本文提供有关在 Azure 的 Windows 虚拟机上运行 SQL Server 时出现的一些最常见问题的解答。This article provides answers to some of the most common questions about running SQL Server on Windows Virtual Machines in Azure.

Note

本文重点阐述在 Windows VM 上运行 SQL Server 的特定问题。 如果在 Linux VM 上运行 SQL Server,请参阅 Linux 常见问题

如果本文未解决你的 Azure 问题,请访问 MSDN 和 CSDN 上的 Azure 论坛。If your Azure issue is not addressed in this article, visit the Azure forums on MSDN and CSDN. 可以在这些论坛上发布问题。You can post your issue in these forums. 还可提交 Azure 支持请求。You also can submit an Azure support request. 若要提交支持请求,请在 Azure 支持页上提交。To submit a support request, on the Azure support page.

映像Images

  1. 有哪些 SQL Server 虚拟机库映像可用?What SQL Server virtual machine gallery images are available?

    Azure 为所有 Windows 和 Linux 版本中的所有受支持 SQL Server 主要发行版维护虚拟机映像。Azure maintains virtual machine images for all supported major releases of SQL Server on all editions for both Windows and Linux. 有关详细信息,请参阅 Windows VM 映像Linux VM 映像的完整列表。For more information, see the complete list of Windows VM images and Linux VM images.

  2. 现有的 SQL Server 虚拟机库映像是否会更新?Are existing SQL Server virtual machine gallery images updated?

    每隔两个月,都会使用最新的 Windows 和 Linux 更新对虚拟机库中的 SQL Server 映像进行更新。Every two months, SQL Server images in the virtual machine gallery are updated with the latest Windows and Linux updates. 对于 Windows 映像,这包括 Windows 更新中标记为重要的任何更新,以及重要的 SQL Server 安全更新和 Service Pack。For Windows images, this includes any updates that are marked important in Windows Update, including important SQL Server security updates and service packs. 对于 Linux 映像,这包括最新的系统更新。For Linux images, this includes the latest system updates. Linux 和 Windows 的 SQL Server 累积更新以不同的方式进行处理。SQL Server cumulative updates are handled differently for Linux and Windows. 对于 Linux,SQL Server 累积更新也包含在刷新中。For Linux, SQL Server cumulative updates are also included in the refresh. 但目前,Windows VM 不会连同 SQL Server 或 Windows Server 累积更新一起更新。But at this time, Windows VMs are not updated with SQL Server or Windows Server cumulative updates.

  3. 是否可以从库中删除 SQL Server 虚拟机映像?Can SQL Server virtual machine images get removed from the gallery?

    是的。Yes. Azure 只为每个主要版本维护一个映像。Azure only maintains one image per major version and edition. 例如,发布新的 SQL Server Service Pack 时,Azure 会将新映像添加到该 Service Pack 的库。For example, when a new SQL Server service pack is released, Azure adds a new image to the gallery for that service pack. 先前 Service Pack 的 SQL Server 映像将立即从 Azure 门户中删除。The SQL Server image for the previous service pack is immediately removed from the Azure portal. 但是,在接下来的三个月,仍可以通过 PowerShell 预配该映像。However, it is still available for provisioning from PowerShell for the next three months. 三个月之后,先前的 Service Pack 映像不再可用。After three months, the previous service pack image is no longer available. 如果 SQL Server 版本由于生命周期结束而不受支持,则也会应用此删除策略。This removal policy would also apply if a SQL Server version becomes unsupported when it reaches the end of its lifecycle.

  4. 是否可以部署 Azure 门户中不可见的较旧的 SQL Server 映像?Is it possible to deploy an older image of SQL Server that is not visible in the Azure portal?

    是的,使用 PowerShell。Yes, by using PowerShell. 有关使用 PowerShell 部署 SQL Server VM 的详细信息,请参阅如何使用 Azure PowerShell 预配 SQL Server 虚拟机For more information about deploying SQL Server VMs using PowerShell, see How to provision SQL Server virtual machines with Azure PowerShell.

  5. 是否可以从 SQL Server VM 创建 VHD 映像?Can I create a VHD image from a SQL Server VM?

    可以,但需注意以下事项。Yes, but there are a few considerations. 如果将此 VHD 部署到 Azure 中的新 VM,则无法在门户网站中获取 SQL Server 配置部分。If you deploy this VHD to a new VM in Azure, you do not get the SQL Server Configuration section in the portal. 此时必须通过 PowerShell 管理 SQL Server 配置选项。You must then manage the SQL Server configuration options through PowerShell. 此外,将会按该映像最初基于的 SQL VM 的费率进行计费。Also, you will be charged for at the rate of the SQL VM your image was originally based on. 即使在部署前已从 VHD 中删除 SQL Server,也是如此。This is true even if you remove SQL Server from the VHD before deploying.

  6. 是否可以设置虚拟机库中未显示的配置(例如 Windows 2008 R2 + SQL Server 2012)?Is it possible to set up configurations not shown in the virtual machine gallery (For example Windows 2008 R2 + SQL Server 2012)?

    否。No. 对于包含 SQL Server 的虚拟机图库映像,必须通过 Azure 门户或 PowerShell 选择提供的某个映像。For virtual machine gallery images that include SQL Server, you must select one of the provided images either through the Azure portal or via PowerShell.

创建Creation

  1. 如何创建装有 SQL Server 的 Azure 虚拟机?How do I create an Azure virtual machine with SQL Server?

    最简单的解决方法是创建包含 SQL Server 的虚拟机。The easiest solution is to create a Virtual Machine that includes SQL Server. 有关注册 Azure 并从门户创建 SQL VM 的教程,请参阅在 Azure 门户中预配 SQL Server 虚拟机For a tutorial on signing up for Azure and creating a SQL VM from the portal, see Provision a SQL Server virtual machine in the Azure portal. 可选择使用按秒付费 SQL Server 许可的虚拟机映像,或者可以使用允许自带 SQL Server 许可证的映像。You can select a virtual machine image that uses pay-per-second SQL Server licensing, or you can use an image that allows you to bring your own SQL Server license. 此外,你也可以选用免费许可版(开发人员版或速成版),或通过重新使用本地许可证在 VM 上手动安装 SQL Server。You also have the option of manually installing SQL Server on a VM with either a freely licensed edition (Developer or Express) or by reusing an on-premises license. 如果自带许可,必须在 Azure 上通过软件保障实现许可证移动性If you bring your own license, you must have License Mobility through Software Assurance on Azure. 有关详细信息,请参阅 SQL Server Azure VM 定价指南For more information, see Pricing guidance for SQL Server Azure VMs.

  2. 如何将本地 SQL Server 数据库迁转到云中?How can I migrate my on-premises SQL Server database to the Cloud?

    首先,请创建装有 SQL Server 实例的 Azure 虚拟机。First create an Azure virtual machine with a SQL Server instance. 然后将本地数据库迁转到该实例。Then migrate your on-premises databases to that instance. 有关数据迁移策略,请参阅 将 SQL Server 数据库迁移到 Azure VM 中的 SQL ServerFor data migration strategies, see Migrate a SQL Server database to SQL Server in an Azure VM.

许可Licensing

  1. 如何在 Azure VM 上安装 SQL Server 的许可版本?How can I install my licensed copy of SQL Server on an Azure VM?

    可通过两种方式来执行此操作。There are two ways to do this. 可以预配支持许可证的虚拟机映像之一,也称为自带许可 (BYOL)。You can provision one of the virtual machine images that supports licenses, which is also known as bring-your-own-license (BYOL). 另一种做法是将 SQL Server 安装媒体复制到 Windows Server VM,然后在该 VM 上安装 SQL Server。Another option is to copy the SQL Server installation media to a Windows Server VM, and then install SQL Server on the VM. 但是,如果手动安装 SQL Server,则没有门户集成,并且不支持 SQL Server IaaS 代理扩展,因此“自动备份”和“自动修补”等功能在此方案中不起作用。However, if you install SQL Server manually, there is no portal integration and the SQL Server IaaS Agent Extension is not supported, so features such as Automated Backup and Automated Patching will not work in this scenario. 出于此原因,我们建议使用 BYOL 库映像之一。For this reason, we recommend using one of the BYOL gallery images. 要在 Azure VM 上使用 BYOL 或自己的 SQL Server 媒体,必须获得 Azure 上通过软件保障实现的许可移动性To use BYOL or your own SQL Server media on an Azure VM, you must have License Mobility through Software Assurance on Azure. 有关详细信息,请参阅 SQL Server Azure VM 定价指南For more information, see Pricing guidance for SQL Server Azure VMs.

  2. 如果 Azure VM 仅供备用/故障转移,是否必须支持该 VM 上的 SQL Server 许可费?Do I have to pay to license SQL Server on an Azure VM if it is only being used for standby/failover?

    如果有虚拟机许可常见问题解答中所述的“软件保障”并且使用“许可证移动性”,则无需付费即可为在 HA 部署中作为被动次要副本参与的 SQL Server 授予许可。If you have Software Assurance and use License Mobility as described in Virtual Machine Licensing FAQ, then you do not have to pay to license one SQL Server participating as a passive secondary replica in an HA deployment. 否则,你需要付费才可为其授予许可。Otherwise, you need to pay to license it.

  1. 我应该使用 BYOL 映像还是 SQL VM RP 来创建新的 SQL VM?Should I use BYOL images or SQL VM RP to create new SQL VM?

    仅自带许可 (BYOL) 映像可供 EA 客户使用。Bring-your-own-license (BYOL) images are only available for EA customers. 其他有软件保障的客户应该使用 SQL VM 资源提供程序来创建包含 Azure 混合权益 (AHB) 的 SQL VM。Other customers who have Software Assurance should use the SQL VM resource provider to create a SQL VM with Azure Hybrid Benefit (AHB).

  1. 将 VM 注册到新的 SQL VM 资源提供程序是否需额外付费?Will registering my VM with the new SQL VM resource provider bring additional costs?

    否。No. SQL VM 资源提供程序只是为 Azure VM 上的 SQL Server 启用更多的可管理性,不额外收费。The SQL VM resource provider just enables additional manageability for SQL Server on Azure VM with no additional charges.

  2. SQL VM 资源提供程序是否适用于所有客户?Is the SQL VM resource provider available for all customers?

    是的。Yes. 所有客户都可以将 VM 注册到新的 SQL VM 资源提供程序。All customers are able to register with the new SQL VM resource provider. 但是,只有享受软件保障权益的客户能够在 SQL Server VM 上激活 Azure 混合权益 (AHB)(或 BYOL)。However, only customers with Software Assurance Benefit can activate the Azure Hybrid Benefit (AHB) (or BYOL) on a SQL Server VM.

  3. 如果移动或删除 VM 资源,Microsoft.SqlVirtualMachine 资源会发生什么情况?What happens to the Microsoft.SqlVirtualMachine resource if the VM resource is moved or dropped?

    删除或移动 Microsoft.Compute/VirtualMachine 资源时,会通知关联的 Microsoft.SqlVirtualMachine 资源以异步方式复制此操作。When the Microsoft.Compute/VirtualMachine resource is dropped or moved, then the associated Microsoft.SqlVirtualMachine resource is notified to asynchronously replicate the operation.

  4. 如果删除 Microsoft.SqlVirtualMachine 资源,VM 会发生什么情况?What happens to the VM if the Microsoft.SqlVirtualMachine resource is dropped?

    删除 Microsoft.SqlVirtualMachine 资源时,Microsoft.Compute/VirtualMachine 资源不受影响。The Microsoft.Compute/VirtualMachine resource is not impacted when the Microsoft.SqlVirtualMachine resource is dropped. 但是,许可更改会默认回退到原始的映像源。However, the licensing changes will default back to the original image source.

  5. 是否可以将自行部署的 SQL Server VM 注册到 SQL VM 资源提供程序?Is it possible to register self-deployed SQL Server VMs with the SQL VM resource provider?

    是的。Yes. 如果从自己的媒体部署 SQL Server,并安装 SQL IaaS 扩展,则可将 SQL Server VM 注册到资源提供程序,以便获取 SQL IaaS 扩展提供的可管理性权益。If you deployed SQL Server from your own media, and installed the SQL IaaS extension you can register your SQL Server VM with the resource provider to get the manageability benefits provided by the SQL IaaS extension. 但是,不能将自行部署的 SQL VM 转换为标准预付费套餐。However, you are unable to convert a self-deployed SQL VM to Standard Pay-in-Advance Offer.

管理Administration

  1. 是否可以在同一 VM 上安装另一个 SQL Server 实例?是否可以更改默认实例的已安装功能?Can I install a second instance of SQL Server on the same VM? Can I change installed features of the default instance?

    可以。Yes. SQL Server 安装介质位于 C 驱动器上的某个文件夹中。The SQL Server installation media is located in a folder on the C drive. 可从该位置运行 Setup.exe 以添加新的 SQL Server 实例,或更改计算机上 SQL Server 的其他已安装功能。Run Setup.exe from that location to add new SQL Server instances or to change other installed features of SQL Server on the machine. 请注意,某些功能(例如自动备份、自动修补和 Azure Key Vault 集成)仅对默认实例或者正确配置的命名实例起作用(请参阅“问题 3”)。Note that some features, such as Automated Backup, Automated Patching, and Azure Key Vault Integration, only operate against the default instance, or a named instance that was configured properly (See Question 3).

  2. 是否可以卸载 SQL Server 的默认实例?Can I uninstall the default instance of SQL Server?

    可以,但需注意以下事项。Yes, but there are some considerations. 如前面的解答中所述,某些功能依赖于 SQL Server IaaS 代理扩展As stated in the previous answer, there are features that rely on the SQL Server IaaS Agent Extension. 如果卸载默认实例但未同时删除 IaaS 扩展,该扩展会继续查找默认实例并可能生成事件日志错误。If you uninstall the default instance without removing the IaaS extension also, the extension continues to look for it and may generate event log errors. 这些错误来自以下两个源:Microsoft SQL Server 凭据管理和 Microsoft SQL Server IaaS 代理 。These errors are from the following two sources: Microsoft SQL Server Credential Management and Microsoft SQL Server IaaS Agent. 其中一个错误可能类似于以下内容:One of the errors might be similar to the following:

    建立与 SQL Server 的连接时,出现网络相关或特定于实例的错误。A network-related or instance-specific error occurred while establishing a connection to SQL Server. 找不到或无法访问服务器。The server was not found or was not accessible.

    如果决定卸载默认实例,还要卸载 SQL Server IaaS 代理扩展If you do decide to uninstall the default instance, also uninstall the SQL Server IaaS Agent Extension as well.

  3. 是否可将 SQL Server 的命名实例与 IaaS 扩展配合使用Can I use a named instance of SQL Server with the IaaS extension?

    如果该命名实例是 SQL Server 上的唯一实例,并且正确卸载了原始的默认实例,则可以这样做。Yes, if the named instance is the only instance on the SQL Server, and if the original default instance was uninstalled properly. 如果没有默认实例,但是在单个 SQL Server VM 上有多个命名实例,则此扩展无法安装。If there is no default instance and there are multiple named instances on a single SQL Server VM, the IaaS extension will fail to install.

  4. 是否可从 SQL VM 完全删除 SQL Server?Can I remove SQL Server completely from a SQL VM?

    是的,但仍将按照 SQL Server Azure VM 的定价指南收取 SQL VM 费用。Yes, but you will continue to be charged for your SQL VM as described in Pricing guidance for SQL Server Azure VMs. 如果不再需要 SQL Server,可以部署新的虚拟机并将数据和应用程序迁移到新的虚拟机。If you no longer need SQL Server, you can deploy a new virtual machine and migrate the data and applications to the new virtual machine. 然后可以删除 SQL Server 虚拟机。Then you can remove the SQL Server virtual machine.

更新和修补Updating and Patching

  1. 如何更改为 Azure VM 中 SQL Server 的新版本?How do I change to a new version/edition of the SQL Server in an Azure VM?

    享有软件保障的客户可以使用批量许可门户中的安装媒体对 Azure VM 上运行的 SQL Server 执行就地升级。Customers with Software Assurance are able to do in-place upgrades of their SQL Server running on an Azure VM using the installation media in the Volume Licensing Portal. 但是,目前没有任何办法可以更改 SQL Server 实例的版本。However, currently, there is no way to change the edition of an instance of SQL Server. 请使用所需的 SQL Server 版本创建新的 Azure 虚拟机,然后使用标准数据迁移技术,将数据库迁移到新的服务器。Create a new Azure virtual machine with the desired SQL Server edition, and then migrate your databases to the new server using standard data migration techniques.

  2. 如何将更新和服务包应用于 SQL Server VM?How are updates and service packs applied on a SQL Server VM?

    虚拟机允许控制主机,包括应用更新的时间与方法。Virtual machines give you control over the host machine, including when and how you apply updates. 对于操作系统,可以手动应用 Windows 更新,或者启用名为自动修补的计划服务。For the operating system, you can manually apply windows updates, or you can enable a scheduling service called Automated Patching. 自动修补将安装任何标记为重要的更新,包括该类别中的 SQL Server 更新。Automated Patching installs any updates that are marked important, including SQL Server updates in that category. 必须手动安装其他可选的 SQL Server 更新。Other optional updates to SQL Server must be installed manually.

常规General

  1. Azure VM 是否支持 SQL Server 故障转移群集实例 (FCI)?Are SQL Server Failover Cluster Instances (FCI) supported on Azure VMs?

    是的。Yes. 可在 Windows Server 2016 上创建 Windows 故障转移群集 ,并将存储空间直通 (S2D) 用于群集存储。You can create a Windows Failover Cluster on Windows Server 2016 and use Storage Spaces Direct (S2D) for the cluster storage. 或者,可使用第三方群集或存储解决方案,如 Azure 虚拟机中 SQL Server 的高可用性和灾难恢复中所述。Alternatively, you can use third-party clustering or storage solutions as described in High availability and disaster recovery for SQL Server in Azure Virtual Machines.

    Important

    目前,Azure 上的 SQL Server FCI 不支持 SQL Server IaaS 代理扩展。 建议从参与 FCI 的 VM 中卸载此扩展。 此扩展支持自动备份和修补之类的功能,以及适用于 SQL 的某些门户功能。 卸载代理以后,这些功能将不适用于 SQL VM。

  2. SQL VM 与 SQL 数据库服务之间的差别是什么?What is the difference between SQL VMs and the SQL Database service?

    从概念上讲,在 Azure 虚拟机上运行 SQL Server 与在远程数据中心运行 SQL Server 并没什么不同。Conceptually, running SQL Server on an Azure virtual machine is not that different from running SQL Server in a remote datacenter. 相比之下, SQL 数据库 可提供数据库即服务。In contrast, SQL Database offers database-as-a-service. 使用 SQL 数据库时,无法访问托管数据库的计算机。With SQL Database, you do not have access to the machines that host your databases. 有关完整比较,请参阅选择云 SQL Server 选项:Azure SQL (PaaS) 数据库或 Azure VM 上的 SQL Server (IaaS)For a full comparison, see Choose a cloud SQL Server option: Azure SQL (PaaS) Database or SQL Server on Azure VMs (IaaS).

  3. 如何在 Azure VM 上安装 SQL Data Tools?How do I install SQL Data tools on my Azure VM?

    Microsoft SQL Server 数据工具 - Visual Studio 2013 商业智能下载并安装 SQL 数据工具。Download and install the SQL Data tools from Microsoft SQL Server Data Tools - Business Intelligence for Visual Studio 2013.

资源Resources

Windows VMWindows VMs:

Linux VMLinux VMs: