August 4, 2006 at 9:17 am
I need to verify that the listener for SQL Server if active and listening on port 1434. I have used the netstat command, and it will show the main port being used(1433 ususally), but it does not show this port. I have check on other servers(clustered and non-clustered) that sre accessed remotely and they do not show this port either. Is there a way to display the listener and ports that SQL Server is using?
August 4, 2006 at 2:09 pm
i know the default UDP port is 1434, but could not find it anywhere in my registry;
i've pasted a script below that finds the TCPIP ports being used, but i don't know how to detect which UDP port is used.
[edited] SQL server always responds to UDP port 1434, regardless; it is similar to DNS, which is always port 53; the service must be known in order to use it, so i guess you trade a tiny bit of security, as it is vulnerable to attacks if the port is exposed via the firewall, as a trade fof for services provided.
CREATE TABLE #GetPort
(
token varchar(100),
value varchar(20))
go
DECLARE @inst varchar(200)
DECLARE @inst1 varchar(100)
--Determine registry path and key
IF(charindex('\',@@servername) > 0)
BEGIN
SELECT @inst = substring(@@servername,charindex('\',@@servername) ,50)
SELECT @inst = 'SOFTWARE\Microsoft\Microsoft SQL Server'+@inst+'\MSSQLServer\SuperSocketNetLib\Tcp'
--SELECT @inst1 = 'TcpDynamicPorts'
SELECT @inst1 = 'TcpPort'
END
ELSE
BEGIN
if SUBSTRING(@@VERSION,23,1) = '7'
begin
SELECT @inst = 'SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib\VIA'
SELECT @inst1 = 'DefaultServerPort'
end
else
begin
SELECT @inst = 'SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib\Tcp'
SELECT @inst1 = 'DefaultPort'
end
END
print @inst + '\\\\////'+ @inst1
INSERT #GetPort
EXEC master..xp_regread 'HKEY_LOCAL_MACHINE', @inst, @inst1
SELECT substring(@@servername,1,25) as ServerName, value as port FROM #GetPort
DROP TABLE #GetPort
Lowell
August 6, 2006 at 10:09 pm
I always look into SQL ErrorLog to find the port on which my SQL Server is listening.
you can use sp_readerrorlog procedure to read errorlogs from query analyzer.
This should exist in registry key mentioned by Lowell.
HTH
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply