SQL Server Profiler is a SQL Server Enterprise Edition with a very powerful statement tracking and analysis tool. Using it skillfully is useful for us to analyze database performance issues, such as when data Access uses an ORM framework such as EF, we often need to look at the SQL statements that it generates to us, and then analyze performance issues, and I intend to summarize them in the following ways.
- Environment configuration
- How to track SQL statements
- Using templates
Environment configuration
To use SQL Server Profiler, the first of all is to configure the environment, how to configure it? Can be divided into the following steps.
1. Start SQL Server Profiler, select the menu "Tools > SQL Server Profiler" to start the SQL Server Profiler, as in.
2, go to the Login window, select the link database, enter the user name and password, click the ' Connect ' button to open the Tracking Settings window, such as.
3, select the standard template and then go to the ' Events Selection ' event Selection window, such as.
4, tick the ' Show all Columns ' option, click on the column Filters ... Enter the column Filter window, such as.
Note that here with hostname only for Windows authentication method login, if the shared sa account can not be filtered, how to solve the problem, still need to check the information.
5, click the OK button, and then go to the window to start monitoring, such as.
So the environment is configured so that you can start tracking and monitoring.
How to track SQL statements
We initiate a query request locally, and then we can see the SQL statements executed, such as.
Next, you can copy the SQL you traced to the SQL Server to execute and view the execution plan.
Using templates
In order to save frequently run configurations, avoid duplication of settings and improve efficiency, we save these settings and build a template, and the next time you run it, you can quickly start tracking by selecting the appropriate template directly. So how do you create a new template in SQL Server Profiler? This can be done in the following steps.
1. Select the menu ' file/templates/new template ... ' To open the New Trace Template window, such as.
2, enter the template name, and select based on the existing standard template, the Event Selection window setting is the same as when the environment is configured, display all columns and use the filter to display the information we need to display, such as.
Click Save, a new template is built, the next time you start the template can be directly selected to start tracking, is not very convenient?
Resources:
1, the Cloud drizzling SQL Server Profiler using the tutorial, easy to understand is the kingly
SQL Server Profiler Tutorial