Microsoft SQL Server Articles

Links, articles, scripts, tips, and other technical sources for managing SQL Server. DBALinks is dedicated to SQL Server and database administration.

ABOUT SQL SERVER

 

 

Articles | Categories | Search | Syndication

Analyze Performance Code

Analyze Performance Code
155 Views :: 0 Reviews :: :: Housekeeping Scripts
 

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'Memory--Available MBytes' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 1
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'Memory--Cache Faults/sec' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 2
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'Memory--Page Faults/sec' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 3
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'Memory--Pages/sec' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 4
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'MSSQL$LIVE:Access Methods--Full Scans/sec' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 5
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'MSSQL$LIVE:Buffer Manager--Buffer cache hit ratio' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 6
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'MSSQL$LIVE:Databases--Transactions/sec' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 7
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'MSSQL$LIVE:General Statistics--User Connections' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 8
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'MSSQL$LIVE:Locks--Number of Deadlocks/sec' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 9
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'MSSQL$LIVE:Memory Manager--Total Server Memory (KB)' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 10
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'MSSQL$LIVE:SQL Statistics--SQL Re-Compilations/sec' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 11
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--% Disk Time' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 12
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--% Idle Time' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 13
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--Avg. Disk Queue Length' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 14
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--Current Disk Queue Length' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 15
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--% Disk Time' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 16
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--% Idle Time' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 17
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--Avg. Disk Queue Length' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 18
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--Current Disk Queue Length' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 19
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--% Disk Time' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 20
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--% Idle Time' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 21
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--Avg. Disk Queue Length' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 22
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'PhysicalDisk--Current Disk Queue Length' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 23
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'Processor--% Privileged Time' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 24
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'Processor--% Processor Time' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 25
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'Processor--% User Time' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 26
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

select 'System--Processor Queue Length' as CounterName,
 b.CounterValue,
 b.CounterDateTime
from CounterDetails a inner join CounterData b
 on a.counterID = b.counterID
where a.counterID = 27
 and CounterDateTime between '2009-01-07 08:30:03.824' and '2009-01-07 08:50:03.824'
GO

 

Rating
Reviews
Currently, there are no reviews. Be the first to post one!
Click here to post a review