INF: How to Troubleshoot Orphaned Connections in SQL Server

ID: Q137983


The information in this article applies to:


SUMMARY

When a SQL Server client disconnects from a SQL Server, the connection process should be cleared up on the server side. If the connection processes are not cleared up for any reason, they become "orphaned" or "ghost" processes, which may use up valuable resources such as locks and user connections. The orphaned processes are typically caused by improper closing of client applications and network-related problems, and the remedies usually require troubleshooting client applications and fine- tuning network configurations.


MORE INFORMATION

When you troubleshoot this problem, keep the following in mind:

If you suspect orphaned processes exist on your SQL Server, the following are steps you can take to troubleshoot the problem:
  1. Identify the orphaned processes using sp_who, which may tell you which applications were associated with these processes through the host names.


  2. After you identify these orphaned processes, you may choose to either ignore them if they are not holding any locks or using many connections, or kill them using the SQL Server KILL command.


  3. Check with the application users for any improper procedures of closing applications, such as warm or cold restart of workstations without exiting the applications first. Check whether there is any history of the workstation becoming unstable, such as a general protection fault, and so forth. Correct those improper procedures or stability problems if they do exist.


  4. Check whether the IPC session is still active on the Windows NT Server computer where SQL Server is running. Depending on the IPCs you are using, the commands are different. For example, if you are using named pipes, the command is "NET SESSION" or "NET FILES"; if it is a TCP/IP sockets connection, you can use "NETSTAT" to display active TCP sessions; in case of IPX/SPX, you may have to use the Performance Monitor to monitor the "Connections Open" for "NWLink SPX."


  5. If the IPC sessions are still active on the Windows NT Server computer, it is perfectly normal for SQL Server to keep those connection processes. When Windows NT clears up the IPC sessions, SQL Server will be notified and clear up the connection processes accordingly. You may be able to adjust certain Windows NT network parameters to shorten the time period that Windows NT has to wait before clearing up the dead sessions.

    Again, depending on the IPCs you are using, the parameters involved are very different. For information on how to modify these registry settings to match those mentioned below, see the following articles in the Microsoft Knowledge Base:
    Q120642 : TCP/IP & NBT Configuration Parameters for Windows NT

    Q120642 : Tuning NWLINK Registry Parameters

    Please note that if the "keep alive" parameters for your IPCs are configured to never timeout, Windows NT will keep the IPC sessions indefinitely, even if the clients are completely shut down. In this case, SQL Server will keep these client processes indefinitely as well, which is expected.

    For further information about the parameters, please consult your Windows NT documentation or Windows NT Resource Kit. If you suspect your Windows NT Server computer does not clear up those sessions according to the configuration parameters, you can contact your primary Windows NT support provider for help.


  6. If the IPC session no longer exists on the Windows NT Server computer, but SQL Server still keeps client process as shown by sp_who, you can use the KILL command to clear up the process as a temporary solution, and contact your primary SQL Server support provider for further assistance.


Additional query words: sql6 connectivity gp gpf hang reboot time out


Keywords          : kbusage SSrvGPF SSrvLAN SSrvLock 
Version           : WINNT:4.21,6.0,6.5,7.0
Platform          : WINDOWS 
Issue type        : kbhowto kbinfo 

Last Reviewed: April 13, 1999