Tuesday, May 17, 2011

On Which Port Sql Server Is listening on

though SQL server's default instance listen on port 1433
but some how if we want to check or know on which port an instance is running we can use

select local_tcp_port from sys.dm_exec_connections where local_tcp_port is not null
command to know the port number

we can also check it by using the Error log information
Managment Studio -> Managment ->SQL Server Logs->Current
and then looking for the Entry
Sql server is listening on 127.0.0.1 ipv4 1434

or we can use the following procedure (even the registery enteries)

DECLARE @tcp_port nvarchar(5)
EXEC xp_regread


@rootkey = 'HKEY_LOCAL_MACHINE',

@key = 'SOFTWARE\MICROSOFT\MSSQLSERVER\MSSQLSERVER\SUPERSOCKETNETLIB\TCP',

@value_name = 'TcpPort',

@value = @tcp_port OUTPUT

SELECT @tcp_port


if any of the above does not work then make sure
TCP\IP protocol is enabled , if it is disabled the enable it first
 

No comments:

Post a Comment