Home > Software engineering >  Find connection from specific port number connecting to SQL Server
Find connection from specific port number connecting to SQL Server

Time:12-27

I have a requirement to find if any traffic is hitting my SQL Server on a specific port number 8082. If not, I will block that port.

The problem is I am not able to identify any way to check if any traffic from that port number is sent to my SQL Server.

Please if anyone can suggest a way how to identify traffic coming from a specific port number in SQL Server.

I have tried using profiler but there is no such counter which shows port number of connections.

CodePudding user response:

SQL Server does have a DMV which may be of use to you:

SELECT Session_ID, most_recent_session_id, connect_time, client_net_address, client_tcp_port, local_net_address, local_tcp_port
  FROM sys.dm_exec_connections

The documentation for it can be found here: https://learn.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-exec-connections-transact-sql?view=sql-server-ver16

  • Related