SQL Client Profiler?

霸气de小男生 提交于 2019-12-25 03:08:09

问题


I am aware of "SQL Server Profiler", But is there any tools or methods available to monitor the issued sql queries from the client machine?

Some of the things currently in my mind are:

1) The SysInternals ProcMon can log and tell when the executable process on client machine connects to sql server. Any similar but more advanced tools available to tell more data?

2) Any debug version or instrumented version of client libraries and APIs available for client machine to allow such operation?


回答1:


You can enable ODBC Tracing from the ODBC Data Source Administrator (odbcad32.exe). The log file it generates is rather cryptic but it will provide you with the SQL statements run by the logged in user on that machine. There is also a checkbox labeled "Machine-Wide tracing for all user identities" for logging all SQL statements run by any user - including services - on that machine.

Logging may not start until you disconnect and reconnect to the SQL server. So, it is a good idea to restart whatever programs/services connect to your SQL Server. This is especially important if you have connection pooling enabled, which will keep connections open even if the program, in question, has disconnected.

Also, there are two versions of the ODBC Data Source Administrator on Windows 64bit, one for 32bit and the other for 64bit. So, you will need to enable logging for the appropriate bitness of the program you are tracing.

  • How To Generate an ODBC Trace with ODBC Data Source Administrator
  • Setting Tracing Options
  • Why my 32 bit applications cannot see the ODBC DSNs that I created on my 64 bit machine ?
  • ODBC Administrator tool displays both the 32-bit and the 64-bit user DSNs in a 64-bit version of Windows

Update: Another option for you would be to use a tool like Wireshark. Since it has the ability to sit at the network driver level, it can intercept all your network traffic - including but not limited to SQL. These are known as TDS packets - a standard that is used by Sybase SQL Server (ASE), Microsoft SQL Server and FreeTDS ( w/ UnixODBC).

  • RPR NA03: Analysing SQL Server performance using Wireshark and Excel
  • How do I filter SQL Server traffic between app and DB servers using Wireshark?
  • How can I decode SQL Server traffic with wireshark?
  • What does my SQL Server data look like over the wire?
  • Google Search for "Wireshark+SQL"


来源:https://stackoverflow.com/questions/12256806/sql-client-profiler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!