SqlServer monitors the operation of the website on the database (Sqlserver Profiler)

Uses: Use sqlserver profiler to generate corresponding sql statements by operating the website interface, so that you can figure out the business logic of SQL statements generated when operating the website interface.

  1. Open Microsoft SQL Server Management Studio, there is a tool (Tool) in the menu bar, and there is an event tracking (SQL Server Profiler) in it.
    Open sql server profiler and connect to the database. Pop up Trace Properties, select Events Selection

  2. At this time, if the site is on the local machine, you can directly get the desired statement, because there is no need to exclude the sql statement generated by other people operating the website. But if you need to exclude sql statements generated by other people's operations, there are two filters that can be used: hostname (client computer name), clientprocessid (application process ID, each client has a ClientProcessID) and the steps are listed below. The first is the usage of clientprocessid filtering rules

  3. Click the event selection
    insert image description here
    to select and display all the columns, then run it first, operate the website interface after running, and operate a function at will, then you
    insert image description here
    can get the process ID (ClientProcessID) you want. At this time, go back to the event selection place and click the column Filter
    insert image description here
    Find ClientProcessID in the column filter, then add the process ID you just got, click OK
    insert image description here
    and then click Run, then operate the website at this time, and then look at the monitored statement, it is the statement you want.
    insert image description here
    Note that this process ID is different every time. When you close the website and reopen it, you need to obtain the process ID again, and then bind the newly obtained process ID to the specified place of the column filter.

ClientProcessID filtering is suitable for opening the website page on the local computer, and then opening the sqlserver listening statement on the local computer. Let's talk about the usage of hostname, which is somewhat different from ClientProcessID (this depends on which one you choose to use in your personal situation)


insert image description hereThe usage of hostname is suitable for obtaining the name of the client computer from the sql statement generated by the client operating the website after opening the database on the server to monitor the release . Or find the computer name in Computer-System.
Then find the hostname in the column filter
insert image description hereand enter the computer name, click OK, click Run, and you can monitor the sql statement generated by the specified client operating the website.
Here we mainly share the usage of two filtering rules, record them for later viewing

Guess you like

Origin blog.csdn.net/qq_37213281/article/details/109488086