SQL Server Are there System Dynamic Management Views, Logs, and methods that can be used to diagnose transport-level errors in SQL?

2guxujil  于 2023-04-28  发布在  其他
关注(0)|答案(1)|浏览(86)

I am getting an intermittent transport-level error in SQL Server Management Studio (SSMS) Version 19.0.2 when executing the following query.

set nocount on

BEGIN TRY

    select  SD.OBSVALUE                                         'ServiceDate'
           ,year(SD.OBSVALUE)                                   'SD_Year'
           ,month(SD.OBSVALUE)                                  'SD_Month'
           ,SD.SDID
           ,SD.USRID
           ,SD.PID
    from OBS SD
        left join DOCUMENT D on SD.SDID=D.SDID
    where   SD.HDID = 1000086
            and SD.USRID not in (select Id from cusKnoxExcludeRecords where IdType = 'UsrId')
            and SD.PID not in (select Id from cusKnoxExcludeRecords where IdType = 'PId')

END TRY
BEGIN CATCH
    
    print N'An error has occurred.'

    SELECT
        SUSER_SNAME(),
        ERROR_NUMBER(),
        ERROR_STATE(),
        ERROR_SEVERITY(),
        ERROR_LINE(),
        ERROR_PROCEDURE(),
        ERROR_MESSAGE(),
        GETDATE()

END CATCH
  • The error (below) is intermittent. The same T-SQL query works for some runs and throws the transport-level error for other runs.
  • The CATCH is never executed for the transport-level error.
Msg 1236, Level 20, State 0, Line 0
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The network connection was aborted by the local system.)

I would like to identify the assignable cause(s) of the transport-level error. With assignable causes the transport-level error is reproducible and a solution is possible.

Are transport-level errors logged?

Ideally, there should be some useful information on the transport-level error somewhere. The date and time stamp on such messages could be helpful to cross-reference issues other logged issues.

There is no shortage of articles discussing different types of transport-level errors. Most point out that this is a connection error and offer a laundry list of potential solutions. For example:
...because there was a problem with connecting to the server.

What worked for one may not work for all.

It is possible to try every item in the laundry list and not solve the problem. This is because the solution for this instance is not in list or the problem is caused by the combination of two or more factors. When issues are caused by combinations of two or more factors the causes will not be identified by testing solutions one-factor-at-a-time.

Data and a diagnostic procedure would be useful for removing the guesswork.

Questions

  1. Are there existing procedures that can concisely identify the causes of transport-level errors (or connection issues)?
  2. Is there useful data on intermittent transport-level errors that is logged on the server or workstations? I have searched the following and have not found any information on transport-level errors:

a. The SQL Server Error Log at C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\LOG\

b. I have not found entries in The Event Viewer that logs transport-level errors.

c. SQL Dynamic Management Views. So far the only place I see the error is in the SSMS Messages pane.

d. SQL Server Management Reports - The "Number of Errors" reports
...Currently, there are no errors on this instance.

  1. Is it possible to catch and log transport-level errors in a .NET application?
  2. Ping and Ping Plotter do not show any obvious connection issues.
  3. We replaced network cables and checked network adapters.
kzipqqlq

kzipqqlq1#

SQL Server 2008 contains a new feature designed to help troubleshoot particularly tricky connectivity problems. This new feature, the Connectivity Ring Buffer, captures a record for each server-initiated connection closure, including each kill of a session or Login Failed event. To facilitate efficient troubleshooting, the ring buffer attempts to provide information to correlate between the client failure and the server’s closing action.

Connectivity troubleshooting in SQL Server 2008 with the Connectivity Ring Buffer

相关问题