SQL Server Profiler can detect statements executed on the data, especially if some projects do not directly use SQL statements, directly using the ORM framework of the system to process the database project, when debugging SQL statements, it is very helpful.
Previously wrote the article "SQL Server Profiler Tracking database deadlock" Using SQL Server Profiler to track deadlocks, and then simply write the features commonly used in the SQL Server Profiler usage process.
Use SQL Server version R2 here
1. When installing the SQL Server database, ensure that SQL Server Profiler is installed, and all installations will be installed automatically by default.
2. Open SQL Server Management Studio, in the menu, locate the "Tools" menu and locate the SQL Server Profiler menu item as shown in.
3. Select "Event Selection" and tick the frequently used items as shown in.
4. Select "Show all Columns", then in the list, tick the "DatabaseName" item.
5. Set the filter, where the settings just filter the database name, because if there is more than one database in a DB instance, then the database name is not filtered, then the execution statements on all the databases can be monitored.
You can also set duration to filter SQL statements for different execution times, such as SQL statements that can be filtered for longer execution times, and select to optimize SQL statements.
What if the same database, multi-person access, only want to detect the statement of their own actions? You can create a database account of your own login (you can delete this user after detection), and then, in the LoginName filter, filter your logged-in database account.
After setting, click "Run" to start monitoring, the monitoring screen is as follows.
For monitoring content, you can save, in the monitoring interface of the "File" menu, select Save As, select the format you want to save, the next time you want to see the data, you can open the saved file directly.
Simple use of SQL Server Profiler