当前位置:网站首页>Database monitoring SQL execution

Database monitoring SQL execution

2022-07-06 14:25:00 Space flying rat

SQL Server Profiler You can detect statements executed on data , In particular, some items are not directly used sql sentence , Use it directly ORM The system of framework deals with the project of database , In the debug sql When the sentence is , It helped a lot .

I wrote about using SQL Server Profiler Articles that track deadlocks 《SQL Server Profiler Track database deadlocks 》, Simply write here SQL Server Profiler Functions commonly used in the process of use .

 

Use here SQL Server 2008 R2 edition

1. In the installation SQL Server Database time , Please ensure that SQL Server Profiler, By default, all installations will be automatically installed .

2. open SQL Server Management Studio, In the menu , find “ Tools ” menu , find SQL Server Profiler A menu item , As shown in the figure below .

 

3. choice “ Event selection ”, Check the commonly used items , As shown in the figure below .

 

4. choice “ Show all columns ”, Then in the list , Check “DatabaseName” term .

 

5. Set filter , The setting here is only to filter the database name , Because if there are multiple databases in a database instance , Then do not filter the database name , Then all execution statements on the database can be monitored .

You can also set Duration, Filter for different execution times sql sentence , For example, you can filter those that take a long time to execute sql sentence , Choice can optimize sql sentence .

If the same database , Multiple person access , What should I do if I just want to detect my own statements ? You can create a database account for your own login to the database ( This user can be deleted after detection ), after , stay LoginName In the filter , Filter the database account you log in .

 

Click... After setting 【 function 】 Start monitoring , The monitoring screen is as follows .

 

For the content of monitoring , It can be saved , On the monitoring interface 【 file 】 The menu , Choose Save as , Select the format you want to save , Next time, if you want to see the data , You can directly open the saved file .

原网站

版权声明
本文为[Space flying rat]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131359221482.html