配置远程访问服务器配置选项Configure the remote access Server Configuration Option

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

本主题提供有关“远程访问”功能的信息。This topic is about the "Remote Access" feature. 此配置选项是一个模糊不清的 SQL ServerSQL ServerSQL ServerSQL Server 的通信功能,该功能已弃用,而且你可能不应当使用它。This configuration option is an obscure SQL ServerSQL Server to SQL ServerSQL Server communication feature that is deprecated, and you probably shouldn't be using it. 如果你由于无法连接到 SQL ServerSQL Server而访问此页,请参阅以下主题之一:If you reached this page because you are having trouble connecting to SQL ServerSQL Server, see one of the following topics instead:

程序员可能对以下主题感兴趣:Programmers may be interested in the following topics:

本主题的正文从此处开始。The main body of this topic starts here.

本主题说明了如何使用 SQL ServerSQL Server 中配置 SQL Server Management StudioSQL Server Management Studio “远程访问” Transact-SQLTransact-SQL服务器配置选项。This topic describes how to configure the remote access server configuration option in SQL ServerSQL Server by using SQL Server Management StudioSQL Server Management Studio or Transact-SQLTransact-SQL. “远程访问” 选项从运行 SQL ServerSQL Server 实例的本地或远程服务器上控制存储过程的执行。The remote access option controls the execution of stored procedures from local or remote servers on which instances of SQL ServerSQL Server are running. 该选项的默认值为 1。This default value for this option is 1. 这将授权允许从远程服务器执行本地存储过程或从本地服务器执行远程存储过程。This grants permission to run local stored procedures from remote servers or remote stored procedures from the local server. 若要阻止本地存储过程在远程服务器上执行或远程存储过程在本地服务器上执行,请将此选项设置为 0。To prevent local stored procedures from being run from a remote server or remote stored procedures from being run on the local server, set the option to 0.

重要

下一版本的 Microsoft SQL Server 将删除该功能。This feature will be removed in the next version of Microsoft SQL Server. 请不要在新的开发工作中使用该功能,并尽快修改当前还在使用该功能的应用程序。Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. 改用 sp_addlinkedserverUse sp_addlinkedserver instead.

本主题内容In This Topic

开始之前Before You Begin

限制和局限Limitations and Restrictions

  • “远程访问” 选项仅适用于使用 sp_addserver 添加的服务器,包括此选项是为了向后兼容。The remote access option only applies to servers that are added by using sp_addserver, and is included for backward compatibility.

SecuritySecurity

权限Permissions

默认情况下,所有用户都具备不带参数或仅带第一个参数的 sp_configure 的执行权限。Execute permissions on sp_configure with no parameters or with only the first parameter are granted to all users by default. 若要执行带两个参数的 sp_configure 以更改配置选项或运行 RECONFIGURE 语句,则用户必须具备 ALTER SETTINGS 服务器级别的权限。To execute sp_configure with both parameters to change a configuration option or to run the RECONFIGURE statement, a user must be granted the ALTER SETTINGS server-level permission. ALTER SETTINGS 权限由 sysadminserveradmin 固定服务器角色隐式持有。The ALTER SETTINGS permission is implicitly held by the sysadmin and serveradmin fixed server roles.

使用 SQL Server Management StudioUsing SQL Server Management Studio

配置远程访问选项To configure the remote access option

  1. 在对象资源管理器中,右键单击服务器并选择 “属性”In Object Explorer, right-click a server and select Properties.

  2. 单击 “连接” 节点。Click the Connections node.

  3. “远程服务器连接” 下,选中或清除 “允许远程连接到此服务器” 复选框。Under Remote server connections, select or clear the Allow remote connections to this server check box.

使用 Transact-SQLUsing Transact-SQL

配置远程访问选项To configure the remote access option

  1. 连接到 数据库引擎Database EngineConnect to the 数据库引擎Database Engine.

  2. 在标准菜单栏上,单击 “新建查询”From the Standard bar, click New Query.

  3. 将以下示例复制并粘贴到查询窗口中,然后单击“执行” 。Copy and paste the following example into the query window and click Execute. 此示例说明如何使用 sp_configureremote access 选项的值设置为 0This example shows how to use sp_configure to set the value of the remote access option to 0.

EXEC sp_configure 'remote access', 0 ;  
GO  
RECONFIGURE ;  
GO  
  

有关详细信息,请参阅 服务器配置选项 (SQL Server)版本的组合自动配置的最大工作线程数。For more information, see Server Configuration Options (SQL Server).

跟进:在配置远程访问选项之后Follow Up: After you configure the remote access option

此设置将在重启 SQL Server 之后生效。This setting does not take effect until you restart SQL Server.

另请参阅See Also

RECONFIGURE (Transact-SQL) RECONFIGURE (Transact-SQL)
服务器配置选项 (SQL Server) Server Configuration Options (SQL Server)
sp_configure (Transact-SQL)sp_configure (Transact-SQL)