0% found this document useful (0 votes)
8 views1 page

3 - OpenTransaction

Uploaded by

Ram Mohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

3 - OpenTransaction

Uploaded by

Ram Mohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

How to Monitor the SQL Server?

SQL Server monitoring is continuous collection and analysis of usage, performance,


and event metrics for Microsoft SQL Server.
It is the first step in optimizing performance for applications. It also helps for
Baselining of the server.

What you are learning here in this video?

1. Why is the application so slow?


2. Why is my query taking, like, forever to return the results?
3. How to check the blocking?
4. How to check, if Memory/CPU went to 100%?
5. SP/Query taking how much time being run?
6. Tuning of the SP/Query?
7. Want to see the Current executing queries?
8. Want to see the Current executing queries and their execution plans?
9. Open transactions
10. How much Percentage complete of the query execution?
11. What query is running under the SP?
12. I want see queries which are running only on Particular DB or Particular
login?
13. I want to kill all the sessions on one DB or one login related?
14. Physical Reads/Logical Reads
15. And Many more

Which one should I use Monitor?


Sp_who2?
Sp_whoiactive?
Any other query?

sp_who, sp_who2 and sp_whoisactive are stored procedures that allow you to view
current users, sessions, and processes within a SQL Server instance.
You’d want to see this for identifying things like blocking or checking general
activity.

DECLARE @Table TABLE(


SPID INT,
Status VARCHAR(MAX),
LOGIN VARCHAR(MAX),
HostName VARCHAR(MAX),
BlkBy VARCHAR(MAX),
DBName VARCHAR(MAX),
Command VARCHAR(MAX),
CPUTime INT,
DiskIO INT,
LastBatch VARCHAR(MAX),
ProramName VARCHAR(MAX),
SPID_1 INT,
REQUESTID INT
)

INSERT INTO @Table EXEC sp_who2

SELECT *
FROM @Table
WHERE blkby =' .'

You might also like