Git Product home page Git Product logo

css_sql_networking_tools's Introduction

Welcome

Welcome to the CSS SQL Networking team's tools repository.

Here, you will find a number of tools that we use when supporting our customers to help find solutions to problems faster and easier.

These tools all run locally and do not use any external services or report back to Microsoft or anyone else. For example, the SQL Network Analyzer tool reads a network trace on your local machine and writes the report to the same folder or to some location you explicitly designate. Some tools may connect to a SQL Server, such as SSPIClient and DBTest, or make some LDAP queries regarding account or machine properties, such as SQLCheck. Results are written to the console window or to a local file of the user's specification. More detail is provided in the individual tool documentation.

Tools

SQL Network Analyzer (SQLNA) - a command-line tool that reads a network trace (or series of chained traces) and produces a report indicating potential problems.

SQL Network Analyzer UI (SQLNAUI) - a GUI interface for SQL Network Analyzer.

SQL Check (SQLCHECK) - a command-line tool that records system information useful for analyzing SQL Server client-server connectivity issues.

SQL Trace (SQLTRACE) - a command-line tool that records network traffic and various driver and Windows events useful for analyzing SQL Server client-server connectivity issues.

SQL Benchmark Tool (SQLBENCH) - a command-line tool that performs a standard set of operations on a file folder/share or database, so you can compare systems and databases.

SQL Driver Security API Trace (SSPICLIENT) - an MFC Windows C++ Tool that can be run on client machines having SSPI or Kerberos errors and will log a detailed trace for analysis.

Database Connection Test (DBTEST) - a command-line tool that allows you to perform ad hoc database connection and command tests, and reliability tests to SQL Server and other OLE DB and ODBC data sources.

Various scripts referenced by workflows.

Documentation

The Wiki contains documentation for the tools on this site and workflows for solving many issues with SQL Server client-server connectivity.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

css_sql_networking_tools's People

Contributors

clintwon avatar jonburchel avatar malcolm-stewart avatar microsoftopensource avatar srinigajjela avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

css_sql_networking_tools's Issues

Implement StopOnCtrlC flag

If set, the start trace waits for Ctrl+C instead of termination. When Ctrl+C is pressed, run the stop trace method.

SQLCheck Provider and Driver TLS 1.2 Yes/No column may be wrong in some cases

Please check correctness of TLS 1.2 Yes/No for "SQLOLEDB" and "SQL Server" (supplied/updated with the operating system).
According to https://support.microsoft.com/en-us/topic/october-20-2020-kb4580390-os-build-17763-1554-preview-ac4799c9-838f-8665-a968-0f19b6cb1049 these providers support TLS 1.1 and 1.2:
"Adds support for the Transport Layer Security (TLS) 1.1 and 1.2 protocols when connecting to SQL Server using the data providers in Microsoft Data Access Components (MDAC)"
Tested with these providers from Windows 10 21H2 19044.2604 against SQL Server 2016 with extended event session sqlsni.trace:
SNISecurity Handshake Handshake succeeded. Protocol: TLS1.2
SQLCheck reports TLS 1.2 No:
Name Type Version Supported TLS 1.2
SQLOLEDB OLE DB 10.0.19041.2604 Deprecated No
SQL Server ODBC 10.0.19041.2604 Deprecated No

SQLCHECK & SSPICLIENT - Feature Request - Sanity check @@SERVERNAME is equivalent to the requested name

I have been banging my head against the wall for hours trying to figure out why SSPI connections to MS SQL servers suddenly started to fail.

From a blind guess troubleshooting from a completely different direction I found out that the @@SERVERNAME property of the MS SQL server/services/instance was different than what was being contacted in the client.

Knowing this would have saved me a lot of pain and it's something I believe the tools should be able to figure out. At the very least SQLCHECK -- SSPICLIENT may be a different story.

If you need clarification please let me know.

Implement a log folder command-line parameter, else date-time in current folder

For trace start.
Add a command-line parameter to accept an absolute or relative log folder name.
If the folder exists, check whether it's empty.
If not, prompt the user to delete the contents or use a datetimestamp-named folder.
Store the folder name in a system environment variable.

For trace stop, read the folder name from the system environment variable, if not supplied in the command-line.

SQLTrace suggestion

Since SQL Trace collects so many files, it may be beneficial to have the trace file zip everything at the end of the process so the customer can upload just that zip file. Before we had SQLTrace, I wrote out my own script with the following:

POWERSHELL -command "Compress-Archive -Path .\SQLTrace -DestinationPath .%computername%_SQLTrace.zip"

ECHO.
ECHO I have zipped the contents of this directory as %computername%_SQLTrace.zip, stored in the same directory you ran the batch file from.
ECHO Please upload this file to the DTM site provided by your support engineer.
ECHO I have also paused the batch file so you can review the command buffer.
ECHO.
PAUSE

SQLTrace update request

Can we update SQLTrace to simplify the BIDProviderList and all an "all" option to capture every known driver, even those we don't have standalone options for?

Unable to view or redirect SQLCHECK output

I am running on Windows 10 Pro.

When I run SQLCHECK, it opens a new window, generates a report, and immediately closes the window. There is no way to view the output.

If I attempt to redirect the output using "sqlcheck > sqlcheck.log", then it creates an empty file.

Implement a Write-Info, Write-Warning, Write-Error to log to console and a file

Create a SQLTrace.log file in the output folder and write any console output to it.
Write-Message will be the base method.
It will add a timestamp to the message and also accept a fore-color and back-color.
Write-Info will write default colors.
Write-Warning will write Yellow foreground and black background.
Write-Error will write Red foreground and black background.
Colors to be stored in global variables, so they can be modified if needed, or loaded from the INI file.

Some registry commands list an error

Specifically:

        reg delete HKLM\SYSTEM\CurrentControlSet\Control\LSA\NegoExtender\Parameters /v InfoLevel /f  2>&1 
        reg delete HKLM\SYSTEM\CurrentControlSet\Control\LSA\Pku2u\Parameters /v InfoLevel /f  2>&1
        reg delete HKLM\SYSTEM\CurrentControlSet\Control\LSA /v LspDbgInfoLevel /f  2>&1
        reg delete HKLM\SYSTEM\CurrentControlSet\Control\LSA /v LspDbgTraceOptions /f  2>&1

Keys are not found. Do we create them?
Need to investigate or just eat the exceptions - or log them better - see previous issue.

Get rid of guid file for BID Tracing

Auth traces use a loop to set providers for LOGMAN. Can this technique be adopted for BID traces?

        logman start "Kerberos" -o .\Auth\Kerberos.etl -ets

        ForEach($KerberosProvider in $Kerberos)
        {
            # Update Logman Kerberos
            $KerberosParams = $KerberosProvider.Split('!')
            $KerberosSingleTraceGUID = $KerberosParams[0]
            $KerberosSingleTraceFlags = $KerberosParams[1]    
            logman update trace "Kerberos" -p `"$KerberosSingleTraceGUID`" $KerberosSingleTraceFlags 0xff -ets | Out-Null
        }

SQLCheck Feature Request

Can we add a column to the Cipher Suite section, probably for both Registry list and Policy list, that indicates which SSL/TLS versions a detected Cipher Suite can be used with?

SQLBench Suggestion

First, thank you for providing this tool.

I made a small modification to the tool and on our systems it shows better results. In WriteBlobTest I changed the size to 100K from 16K which I think is more representative of a Large Binary Object and I also randomize the bytes. If you create a byte array, the array will contain all 0 which compresses very well and may hide performance issues especially if compression is turned on in the database.

    public void  WriteBlobTest(out double myBlobWrite)
    {
        const int size = 100 * 1024; // 100K was 16K
        byte[] numArray1 = new byte[size]; //crate byte array
        var random = new Random();
        random.NextBytes(numArray1); // randomize the array so compression doesn't come into play

All tools

Can we start zipping tools without saving folder information in the zip file? Customers and, worse, Engineers do not understand that unzipping to something like this:

C:\SQLTrace

Means they need to be in this instead:

C:\SQLTrace\SQLTrace

SQLCheck request regarding Certificates

If possible, can we pull certificate chain information, if we determine a "real" certificate is being used?

I see three options:

  1. Self-generated certificate, which requires no further check
  2. Self-signed certificate, perhaps we can check if this exists in both personal and trusted root
  3. A "real" cert issued by some certificate authority, in which case we can possibly check and list the certificate chain or an error indicating there is no valid chain, as many errors indicate.

This is something I would be willing to investigate in the new year, assuming other duties don't keep me from helping here.

SQLCheck TLS 1.3 update

Can we update SQLCheck to see if TLS 1.3 Registry keys exist and call out a warning if the operating system doesn't support TLS 1.3?

SQLCheck not showing listener for a contained AG

Tested on SQL 2022 Developer CU 3

--from the log
Always-On Servers: WIN22SQL22N2, WIN22SQL22N1
Always-On Listeners: AGDB2022
Availability Groups: AGDB2022, ContainedAG

--from the DMVs
ag_name ag_listeiner_dns_name agl_port agl_config_string
AGDB2022 AGDB2022 1433 ('IP Address: 15.0.0.113')
ContainedAG ContainedAG 1434 ('IP Address: 15.0.0.114')

AGDB2022 is a regular AG
ContainedAG as the name suggests is a contained AG

Possible cause is that the port for the listener is 1434. (?)

Capture and log command output

Logging is enabled for status messages.
However, commands issue messages to the console that are (a) not timestamped, (b) no distinguishing between normal and error text, and (c) not logged to the trace log file.

Feature Request

Please pull the Event Log collection out of the Auth trace section and capture them all the time.

SQLCHECK Write output to log file

Currently output is displayed to the screen and requires redirection to get it to file.
Customers are not always familiar with redirection and automatically creating the log file will save time.

Implement StopAfter functionality

StopAfter takes an integer parameter.

In start trace, after all the commands are finished, instead of terminating, go into a loop and sleep for 10 seconds and then check the timer. Once the timer expires, call the stop trace routine.

Add DNS trace provider to the BID Trace

The SQL drivers do not log DNS calls. Logging the DNS event provider 1c95126e-7eea-49a9-a3fe-a378b03ddb4d can fill in the gap. It can be filtered by process and thread ID. Changes to the SQLBIDAnalyzer may have to be made to interleave this in the BID reports.

Event log improvements

  1. Export to .txt and .evtx, so we can read events even if we do not have the facility installed.
  2. Truncate the event logs to the last 24 hours ... or just to the duration of the trace (can log start DateTime in Environment variable).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.