Linux 上的 SQL Server 的常见问题解答 (FAQ)SQL Server on Linux Frequently Asked Questions (FAQ)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) - Linux适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) - Linux

以下部分提供了有关 Linux 上运行的 SQL Server 的常见问题和解答。The following sections provide common questions and answers for SQL Server running on Linux.

常规问题General Questions

  1. 支持哪些 Linux 平台?What Linux platforms are supported?

    SQL Server 目前在 Red Hat Enterprise Server、SUSE Linux Enterprise Server 和 Ubuntu 上受支持。SQL Server is currently supported on Red Hat Enterprise Server, SUSE Linux Enterprise Server, and Ubuntu. 还支持使用 Docker 在容器中运行。It also supported running in a container with Docker. 有关支持的版本的最新信息,请参阅支持的平台For the latest information about the supported versions, see Supported platforms.

  2. Linux 上的 SQL Server 未来是否可以在其他平台上运行?Will SQL Server on Linux work on other platforms?

    SQL Server 在 Linux 上针对之前列出的发行版进行了测试且受支持。SQL Server is tested and supported on Linux for the previously listed distributions. 其他 Linux 发行版密切相关并且可能可以运行 SQL Server(例如,CentOS 与 Red Hat Enterprise Server 密切相关)。Other Linux distributions are closely related and might be able to run SQL Server (for example, CentOS is closely related to Red Hat Enterprise Server). 但是,如果选择在不受支持的操作系统上安装 SQL Server,请查看 Microsoft SQL Server 的技术支持策略的“支持策略”部分,以了解支持含义。But if you choose to install SQL Server on an unsupported operating system, please review the Support policy section of the Technical support policy for Microsoft SQL Server to understand the support implications. 另请注意,如果基础操作系统出现故障,一些社区维护的 Linux 发行版将没有获得支持的正式途径。Also note that some community-maintained Linux distributions do not have a formal way to receive support if the underlying operating system is the problem.

  3. Linux 与 Windows 上的 SQL Server 是否相同?Is SQL Server on Linux the same as on Windows?

    SQL Server 的核心数据库引擎在 Linux 上与在 Windows 上是相同的。The core Database Engine for SQL Server is the same on Linux as it is on Windows. 不过,Linux 当前不支持某些功能。However, some features are currently not supported on Linux. 有关 Linux 不支持的功能的列表,请参阅不支持的功能和服务For a list of features that are not supported on Linux, see the Unsupported features & services. 另请参阅已知问题Also review the Known issues. 除非在这些列表中指定,否则 Linux 均支持其他 SQL Server 功能和服务。Unless specified in these lists, other SQL Server features and services are supported on Linux.

  4. SQL Server 的支持策略是什么?What is the support policy for SQL Server?

    若要了解支持策略,请参阅 SQL Server 的技术支持策略To understand the support policy, review the Technical Support Policy for SQL Server.

  5. 我一直使用 Windows SQL Server。是否有可帮助了解如何使用 Linux 上的 SQL Server 的相关资源?I am coming from a Windows SQL Server background. Are there resources to help learn how to use SQL Server on Linux?

    快速入门中提供了有关如何在 Linux 上安装 SQL Server 和运行 Transact-SQL 查询的分步说明。The quickstarts provide step-by-step instructions on how to install SQL Server on Linux and run Transact-SQL queries. 其他教程提供了有关在 Linux 上使用 SQL Server 的其他说明。Other tutorials provide additional instructions on using SQL Server on Linux. 要获取第三方提示列表,请参阅 Linux 上的 SQL Server 的 MSSQLTIPS 列表提示For a third-party list of tips, see the MSSQLTIPS list of SQL Server on Linux Tips.

授权Licensing

  1. 如何在 Linux 上授予许可?How does licensing work on Linux?

    在 Windows 和 Linux 上为 SQL Server 授予许可的方法是相同的。SQL Server is licensed the same way for both Windows and Linux. 事实上,为 SQL Server 授予许可后,即可在所选的平台上使用该许可。In fact, you license SQL Server and then you can choose to use that license on the platform of your choice. 有关详细信息,请参阅如何为 SQL Server 授与许可For more information, see How to license SQL Server.

  2. 在已购买 SQL Server 时应选择哪个版本?What edition of SQL Server should I choose when I already purchased it?

    运行 mssql-conf 安装程序时,会显示以下选项:When you run mssql-conf setup you are presented with the following options:

    Choose an edition of SQL Server:
       1. Evaluation (free, no production use rights, 180-day limit)
       2. Developer (free, no production use rights)
       3. Express (free)
       4. Web (PAID)
       5. Standard (PAID)
       6. Enterprise (PAID)
       7. Enterprise Core (PAID)
       8. I bought a license through a retail sales channel and have a product key to enter.
    

    如果已通过批量许可(在企业协议中)或通过 MSDN 订阅获得许可证,则需要选择选项 4 到 7。If you have obtained your license through volume licensing as part of an Enterprise Agreement or through your MSDN subscription, you need to select options 4 through 7. 此步骤不会要求输入许可证,但必须先为配置购买相应的许可证。This step does not ask you to enter the license, but you must have previously purchased the appropriate license for your configuration. 如果已通过零售渠道购买了标准版,请选择选项 8。If you have purchased Standard edition through a retail channel, select option 8. 此选项会提示输入密钥。This option does prompt you to enter a key.

  3. 如何验证已安装的版本和 Linux 上的 SQL Server 的版本?How do I verify the installed version and edition of SQL Server on Linux?

    使用 sqlcmd、mssql-cli 或 Visual Studio Code 等客户端工具连接到 SQL Server 实例 。Connect to the SQL Server instance with a client tool such as sqlcmd, mssql-cli, or Visual Studio Code. 然后,运行以下 Transact-SQL 查询以验证版本和正在运行的 SQL Server 的版本:Then run the following Transact-SQL query to verify the version and edition of SQL Server that you are running:

    SELECT @@VERSION
    SELECT SERVERPROPERTY('Edition')
    

安装Installation

  1. 如何在我的 Linux 服务器上安装 SQL Server?How do I get SQL Server installed on my Linux servers?

    Microsoft 维护用于安装 SQL Server 的包存储库,并支持通过本机包管理器(如 yum、zypper 和 apt)进行安装。Microsoft maintains package repositories for installing SQL Server and supports installation via native package managers such as yum, zypper, and apt. 若要快速安装,请参阅其中一篇快速入门文章。To quickly install, see one of the quickstarts.

  2. 能否在 Windows 10 的 Linux 子系统上安装 SQL Server?Can I install SQL Server on the Linux Subsystem for Windows 10?

    不是。No. 在 Windows 10 上运行的 Linux 目前不是 SQL Server 及其相关工具的受支持平台。Linux running on Windows 10 is currently not a supported platform for SQL Server and related tools.

  3. SQL Server 可以将哪些 Linux 文件系统用于数据文件?Which Linux file systems can SQL Server use for data files?

    Linux 上的 SQL Server 目前支持 ext4 和 XFS。Currently SQL Server on Linux supports ext4 and XFS. 将来会按需添加对其他文件系统的支持。Support for other file systems will be added as needed in the future.

  4. 是否可以下载安装包以脱机安装 SQL Server?Can I download the installation packages to install SQL Server offline?

    是的。Yes. 有关详细信息,请参阅发行说明中的包下载链接。For more information, see the package download links in the Release notes. 另请参阅脱机安装说明Also, review the instructions for offline installations.

  5. 是否可以在 Linux 上执行无人参与安装 SQL Server?Can I perform an unattended installation of SQL Server on Linux?

    是的。Yes. 有关无人参与安装的介绍,请参阅 Linux 上的 SQL Server 的安装指南For a discussion of unattended installation, see Installation guidance for SQL Server on Linux. 请参阅 Red HatSUSE Linux Enterprise ServerUbuntu 的示例脚本。See the sample scripts for Red Hat, SUSE Linux Enterprise Server, and Ubuntu. 还可以查看 SQL Server 客户顾问团队创建的此示例脚本You can also review this sample script created by the SQL Server Customer Advisory Team.

工具Tools

  1. 是否可以使用 Windows 上的 SQL Server Management Studio 客户端访问 Linux 上的 SQL Server?Can I use the SQL Server Management Studio client on Windows to access SQL Server on Linux?

    可以。可以使用在 Windows 上运行的所有现有工具来访问 Linux 上的 SQL Server。Yes, you can use all your existing tools that run on Windows to access SQL Server on Linux. 其中包括 Microsoft 提供的工具(如 SQL Server Management Studio (SSMS)、SQL Server Data Tools (SSDT) 和 OSS)以及第三方工具。These include tools from Microsoft such as SQL Server Management Studio (SSMS), SQL Server Data Tools (SSDT), and OSS and third-party tools.

  2. 是否有可在 Linux 上运行的类似 SSMS 的工具?Is there a tool like SSMS that runs on Linux?

    新 Azure Data Studio 是一款用于管理 SQL Server 的跨平台工具。The new Azure Data Studio is a cross-platform tool for managing SQL Server. 有关详细信息,请参阅什么是 Azure Data StudioFor more information, see What is Azure Data Studio.

  3. Linux 上是否提供 sqlcmd 和 bcp 等命令?Are commands like sqlcmd and bcp available on Linux?

    提供。Linux、macOS 和 Windows 上本机提供 sqlcmd 和 bcpYes, sqlcmd and bcp are natively available on Linux, macOS, and Windows. 此外,可使用 Linux、macOS 或 Windows 上的新 mssql-scripter 命令行工具为在任何位置运行的 SQL 数据库生成 T-SQL 脚本。In addition, use the new mssql-scripter command-line tool on Linux, macOS, or Windows to generate T-SQL scripts for your SQL database running anywhere. 另请参阅 mssql-cli 的预览版本。Also, see the preview release for mssql-cli.

  4. 通过 Windows 上的 SSMS 进行连接时,是否可以针对 Linux 上运行的实例查看 Activity Monitor?Is it possible to view Activity Monitor when connected through SSMS on Windows for an instance running on Linux?

    可以。可以使用 Windows 上的 SSMS 进行远程连接,并对 Linux 实例使用 Activity Monitor 命令之类的工具/功能。Yes, you can use SSMS on Windows to connect remotely, and use tools/ features such as Activity Monitor commands on a Linux instance.

  5. 有哪些工具可用于监视 Linux 上的 SQL Server 性能?What tools are available to monitor SQL Server performance on Linux?

    可使用系统动态管理视图 (DMV) 收集有关 SQL Server 的各种类型的信息,包括 Linux 进程信息。You can use system dynamic management views (DMVs) to collect various types of information about SQL Server, including Linux process information. 可使用查询存储提高查询性能。You can use Query Store to improve query performance. 其他工具(例如,内置性能仪表板)可在 Windows 的 SQL Server Management Studio (SSMS) 中远程工作。Other tools, such as the built-in Performance Dashboard, work remotely in SQL Server Management Studio (SSMS) from Windows.

    提示

    正确配置 Linux 操作系统和 SQL Server 实例是提高性能的一种方法。One way to improve performance is to properly configure your Linux operating system and the SQL Server insance. 有关详细信息,请参阅 Linux 上的 SQL Server 的性能最佳做法和配置指南For more information, see Performance best practices and configuration guidelines for SQL Server on Linux.

管理Administration

  1. Microsoft 是否在 Linux 上创建了类似 SQL Server 配置管理器的应用?Has Microsoft created an app like the SQL Server Configuration Manager on Linux?

    是的,存在适用于 Linux 上的 SQL Server 的配置工具:mssql-confYes, there is a configuration tool for SQL Server on Linux: mssql-conf.

  2. Linux 上的 SQL Server 是否支持同一主机上的多个实例?Does SQL Server on Linux support multiple instances on the same host?

    我们建议在主机上运行多个容器以获得多个不同的实例。We recommend running multiple containers on a host to have multiple distinct instances. 使用 docker 很容易实现这一点,但每个容器都需要侦听不同的端口。This is easily achieved using docker, but each container needs to listen on a different port. 有关详细信息,请参阅运行多个 SQL Server 容器For more information, see Run multiple SQL Server containers.

  3. Linux 上是否支持 Active Directory 身份验证?Is Active Directory Authentication supported on Linux?

    是的。Yes. 有关详细信息,请参阅对 Linux 上的 SQL Server 使用 Active Directory 身份验证For more information, see Active Directory Authentication with SQL Server on Linux.

  4. Linux 是否支持 Always On 和群集?Are Always On and clustering supported in Linux?

    Linux 上使用 Pacemaker 实现故障转移群集和高可用性。Failover clustering and high availability on Linux are achieved with Pacemaker on Linux. 有关详细信息,请参阅 业务连续性和数据库恢复 - Linux 上的 SQL ServerFor more information, see Business continuity and database recovery - SQL Server on Linux.

  5. 是否可以配置 Linux 与 Windows 之间的相互复制?Is it possible to configure replication from Linux to Windows and vice versa?

    可以在 Windows 和 Linux 之间使用读取规模副本进行单向数据复制。Read-scale replicas can be used between Windows and Linux for one-way data replication.

  6. 是否可以将旧版 SQL Server 中的现有数据库从 Windows 迁移到 Linux?Is it possible to migrate existing databases in older versions of SQL Server from Windows to Linux?

    可以。可以通过几种方法实现此目的。Yes, there are several methods of achieving this.

  7. 是否可以将 Oracle 和其他数据库引擎中的数据迁移到 Linux 上的 SQL Server?Can I migrate my data from Oracle and other database engines to SQL Server on Linux?

    是的。Yes. SSMA 支持从几种类型的数据库引擎进行迁移:Microsoft Access、DB2、MySQL、Oracle 和 SAP ASE(以前称为 SAP Sybase ASE)。SSMA supports migration from several types of database engines: Microsoft Access, DB2, MySQL, Oracle, and SAP ASE (formerly SAP Sybase ASE). 有关如何使用 SSMA 的示例,请参阅使用 SQL Server 迁移助手将 Oracle 架构迁移到 Linux 上的 SQL ServerFor an example of how to use SSMA, see Migrate an Oracle schema to SQL Server on Linux with the SQL Server Migration Assistant.

  8. SQL Server 文件需要哪些权限?What permissions are required for SQL Server files?

    /var/opt/mssql 文件夹中的所有文件都应归 mssql 用户所有且属于 mssql 组 。All files in the /var/opt/mssql file folder should be owned by the mssql user and belong to the mssql group. mssql 用户和组都应具有所有文件和目录的读写权限。Both the mssql user and group should have read-write permissions of all files and directories. 请注意以下涉及文件和目录权限的特殊情况:Note the following special scenarios involving file and directory permissions:

    • 用于存储 SQL Server 文件的已装载网络共享必须拥有 mssql 所有者和组的权限。Permissions for mssql owner and group are required for mounted network shares that are used to store SQL Server files.
    • 如果在非默认目录中找到数据库文件或备份,则也必须为该目录设置权限。If you locate database files or backups in a non-default directory, you must also set permissions for that directory.
    • 如果更改 0022 中的默认根 umask,则安装后 SQL Server 配置将失败。If you change the default root umask from 0022, SQL Server configuration fails after installation. 然后,必须手动将所需权限应用于 SQL Server 启动帐户。You must then manually apply required permissions to SQL Server startup account.
  9. 是否可以更改已安装的 mssql 帐户和组中的 SQL Server 文件和目录的所有权?Can I change the ownership of SQL Server files and directories from the installed mssql account and group?

    我们不支持更改默认安装中的 SQL Server 目录和文件的所有权。We do not support changing the ownership of SQL Server directory and files from the default installation. mssql 帐户和组专门用于 SQL Server 且不支持交互式登录访问。The mssql account and group is specifically used for SQL Server and has no interactive login access.

  10. SQL Server 数据和日志目录是否支持符号链接?Is Symbolic links supported for SQL Server data and log directories?

    否,SQL Server 数据和日志目录不支持符号链接。No, symbolic links are not supported for SQL Server data and log directories. 若要更改默认数据和日志目录,请参阅更改默认数据或日志目录位置To change the default data and log directories, see Change the default data or log directory location.

获取帮助