question

mikelanders avatar image
mikelanders asked

Enable Remote Access

I am working on procedures for creating a new server. One of the things I constantly have to do each time SQL is installed is enable remote connections. Is there a way to do this with T-SQL rather than using the GUI? I would like to have a script to do as much of the administrative stuff as possible. SQL 2005/2008 are the environments I am concerned with.
sql-server-2008sql-server-2005t-sql
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Tim avatar image
Tim answered
Yes this can be done with T-SQL. EXEC sys.sp_configure N'remote access', N'1' GO RECONFIGURE WITH OVERRIDE GO
6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I have to challenge you a little on this one. IASE database checklist requires this setting to be disabled if linked servers are not in use. I have a production cluster where this is disabled, cause we do not use linked servers. Their web servers are still allowed to connect to SQL Server. Going by what BOL says "remote access" setting will be depreciated ( http://msdn.microsoft.com/en-us/library/ms187660(v=SQL.100).aspx). Then also reading through this article ( http://msdn.microsoft.com/en-us/library/ms190944(v=SQL.100).aspx) for SQL Server 2008, all you need to do is enable TCP/IP and Named Pipes protocol to allow remote connections. With SQL Server 2005 you have to use Surface Area Configuration to enable remote connection through TCP/IP and Named Pipes, otherwise it will only accept local connections.
1 Like 1 ·
Isn't that setting regarding allow linked server access? Is he referring to enable remote access on TCIP/IP and named pipes, as you would do through Surface Area Configuration Manager on SQL 2005? That is disabled by default on installation. Because BOL does show this setting is going away in future releases.
0 Likes 0 ·
The query above is not related to linked server, but rather allowing connections other than the local server through shared memory to connect. If TCP/IP and Named Pipes are enabled then those connections could be made if the "remote access" is enabled. I have updated my answer with a screen shot of the setting in the GUI using SSMS 2008. I right clicked on the server, chose properties, and click connections. OK, so it won't let me attach the image.
0 Likes 0 ·
You do bring up a valid point @meltondba. I am not sure what @mikelanders justification or reasoning is for needing to turn that on unless his environment. But I do think the response I gave him is what he was asking for. How to enable remote access from within TSQL rather than the GUI. I recall getting messages before when I first installed SQL 2005 trying to connect from SSMS from another workstation that gave me a message about having to enable remote connections. I am going to fire up a VM and play with this.
0 Likes 0 ·
Thanks guys. @meltondba you bring up some valid points with the links. @trad, yes this is what I needed.
0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.