Friday, February 17, 2012

Database Lock

This week one of our databases had a lock and our DBA's claim they don't know why. Are there any logging techniques that can show us sql statistics or problem sql statements?
Thanks,
-WillWell the best way is to use the age old method of Sql Profiler. You can capture all sorts of things (RPCs, Queries etc.)to a table, and then sort it based on reads, writes, most frequently called, cpu utilization, whatever. BOL has great documentation on how to use profiler. Other ways to find out what is happening on your server is to run any of the following statements

select * from master..sysprocesses
sp_who2 active
sp_who2
dbcc inputbuffer (spid)

Hope this helps|||Pigeon,

What is the difference between sp_who and sp_who2? I see the proc in my master database, but a search of Books Online comes up empty and likewise Microsoft's knowledge base.

blindman|||sp_who2 gives more performance related data (cpu, and read columns). It also is nicer for us folks who cling to the Results in Text option, rather than the grid. I don't think sp_who2 is "supported" anymore, as MS wants folks to use Enterprise Manager to do everything.|||Ha ha... you know, I didnt know there was an sp_who. I have only used sp_who2. It looks as though Mcrowley is right, there is a little bit of different info in there. As far as it not being supported... well I have it now, and it seems to work well, so enjoy it while it lasts? :)

No comments:

Post a Comment