設定 remote access 伺服器組態選項Configure the remote access Server Configuration Option

適用於: 是SQL Server 否Azure SQL Database 否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 remote access 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. remote access 選項會控制本機或遠端伺服器 ( 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.

安全性Security

權限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. 系統管理員 (sysadmin)serveradmin 固定伺服器角色會隱含 ALTER SETTINGS 權限。The ALTER SETTINGS permission is implicitly held by the sysadmin and serveradmin fixed server roles.

使用 SQL Server Management StudioUsing SQL Server Management Studio

設定 remote access 選項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

設定 remote access 選項To configure the remote access option

  1. 連接到 Database EngineDatabase EngineConnect to the Database EngineDatabase Engine.

  2. 在標準列中,按一下 [新增查詢]From the Standard bar, click New Query.

  3. 複製下列範例並將其貼到查詢視窗中,然後按一下 [執行]Copy and paste the following example into the query window and click Execute. 此範例示範如何使用 sp_configure 將 [ remote 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)