Article ID: 823938 - Last Review: September 25, 2009 - Revision: 6.0 How to configure an instance of SQL Server to listen on a specific TCP port or dynamic portOn This PageSUMMARYThis article describes static and dynamic port allocation
in Microsoft SQL Server 2000,in Microsoft SQL Server 2005 and in SQL Server 2008. It also discusses how to configure an instance of SQL
Server to use either a static port or a dynamic port. Static port allocationIf you configure an instance of SQL Server to use a static port, and you restart the instance of SQL Server, the instance of SQL Server listens only on the specified static port. The SQL Server clients must send all the requests only to the static port where the instance of SQL Server is listening.However, if an instance of SQL Server is configured to listen on a static port, and another program that is running on the computer is already using the specified static port when SQL Server is started, SQL Server does not listen on the specified static port. By default, the default instance of SQL Server listens for requests from SQL Server clients on static port 1433. Therefore, the client network libraries assume that either port 1433 or the global default port that is defined for that client computer is used to connect to the default instance of SQL Server. If a default instance of SQL Server is listening on a port other than port 1433, you must either define a server alias name or change the global default port by using the Client Network Utility. However, you can also make the default instance of SQL Server listen on multiple static ports. For more information about how to set up SQL Server to listen on multiple static TCP ports, click the following article number to view the article in the Microsoft Knowledge Base: 294453
(http://support.microsoft.com/kb/294453/
)
How to set up SQL Server to listen on multiple static TCP ports
The default instance of SQL Server does not
support dynamic port allocation. However, the named instances of SQL Server support allocation of both static and dynamic ports. By default, a named instance of SQL Server listens on a dynamic port. For a named instance of SQL Server, the SQL Server Browser service for SQL Server 2005/2008 or the SQL Server Resolution Protocol (SSRP) for SQL Server 2000 is always used to translate the instance name to a port, regardless of whether the port is static or dynamic. The Browser service or SSRP is never used for a default instance of SQL Server.Dynamic port allocationOnly named instances of SQL Server can use the dynamic port allocation process. In the dynamic port allocation process, when you start the instance of SQL Server for the first time, the port is set to zero (0). Therefore, SQL Server requests a free port number from the operating system. As soon as a port number is allocated to SQL Server, SQL Server starts listening on the allocated port.The allocated port number is written to the Windows registry. Every time that you start that named instance of SQL Server, it uses that allocated port number. However, in the unlikely case that another program that is already running on the computer is using that previously allocated (but not static) port number when you start SQL Server, SQL Server chooses another port. When you start the named instances of SQL Server the second time, SQL Server opens the listening port number that was started the first time, as follows:
If UDP port 1434 is disabled, the SQL Server client cannot dynamically determine the port of the named instance of SQL Server. Therefore, the SQL Server client may be unable to connect to the named instance of SQL Server. In this situation, the SQL Server client must specify the dynamically allocated port where the named instance of SQL Server 2000, SQL Server 2005, or SQL Server 2008 is listening. For more information, click the following article number to view the article in the Microsoft Knowledge Base: 265808
(http://support.microsoft.com/kb/265808/
)
How to connect to a named instance of SQL Server 2005 or SQL Server 2000 by using the client tools in the earlier version of SQL Server
Verifying the port configuration of an instance of SQL ServerNoteDefault instances of SQL Server always use a static port.First verify that your instance of SQL Server has the TCP/IP protocol enabled. Then, to find which TCP/IP port your instance of SQL Server is "listening on", examine the SQL Server error log. Additionally, in SQL Server 2005 and in later versions, you can check settings in the SQL Server Configuration Manager. If you wish to see the SQL error log from within a program, follow these steps. Note For SQL Server 2000, use Query analyzer to execute the following queries.
Configuring an instance of SQL Server to use a static portSQL Server 2005 and SQL Server 2008To configure an instance of SQL Server 2005 or SQL Server 2008 to use a static port, follow the steps that are described in the How to: Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager) topic in SQL Server 2005 Books Online or in SQL Server 2008 Books Online.To configure a static port for the specialized Dedicated Administrator Connection (DAC), you must update the registry key that corresponds to your instance. For example, the registry key may be the following: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.X\MSSQLServer\SuperSocketNetLib\AdminConnection\Tcp Note The "X" in "MSSQL.X" is a number that indicates the directory where the instance is installed for SQL Server 2005 or the instance name for SQL Server 2008.SQL Server 2000To configure an instance of SQL Server to use a static port, follow these steps:
Configuring an instance of SQL Server to use a dynamic portSQL Server 2005 and SQL Server 2008To configure your instance of SQL Server 2005 or your instance of SQL Server 2008 to use a dynamic port, use the similar method described in the "How to: Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager)" topic in SQL Server 2005 Books Online or in SQL Server 2008 Books Online. For more information, see the Server Network Configuration topic in SQL Server 2005 Books Online or in SQL Server 2008 Books Online.SQL Server 2000To configure your instance of SQL Server to use a dynamic port, follow these steps:
TroubleshootingIf the SQL Server clients cannot access an instance of SQL Server after you have configured it to use a static TCP/IP port, the following causes may exist:
REFERENCES
For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
286303
(http://support.microsoft.com/kb/286303/
)
Behavior of SQL Server 2000 network library during dynamic port detection
273673
(http://support.microsoft.com/kb/273673/
)
Description of SQL Virtual Server client connections
328383
(http://support.microsoft.com/kb/328383/
)
SQL Server clients may change protocols when the client computers try to connect to an instance of SQL Server
For more information about how to configure SQL Server to listen on different ports on different IP addresses, see the How to configure SQL server to listen on different ports on different IP addresses? topic on the following Microsoft SQL Server Support Blog Web site: http://blogs.msdn.com/sqlblog/archive/2009/07/17/how-to-configure-sql-server-to-listen-on-different-ports-on-different-ip-addresses.aspx
(http://blogs.msdn.com/sqlblog/archive/2009/07/17/how-to-configure-sql-server-to-listen-on-different-ports-on-different-ip-addresses.aspx)
APPLIES TO
| Article Translations
|
Back to the top
