IF object_id('tempdb..#temp') is not null
DECLARE @schemaname varchar(50)
DECLARE @tablename varchar(50)
set @count=(select count(*) from sysobjects where xtype='U')
select row_number() over(order by name) as rowNumber,name,
( SELECT a.name from sys.tables t inner join sys.schemas a
ON t.schema_id=a.schema_id
WHERE t.name=ob.name) as schemaname
into #temp from sysobjects ob where xtype='U'
set @schemaname=(SELECT schemaname from #temp where rowNumber=@index)
set @tablename=(SELECT name from #temp where rowNumber=@index)
exec('select * from '+ @schemaname+'.'+@tablename)
通常来说,需要看如下几个计数器(下面资料参考自http://www.sqlservercentral.com/articles/Miscellaneous/2634/):
Network Interface: Bytes Total/Sec
Physical Disk: % Disk time
Physical Disk: Avg. Disk Queue Length
Processor: % Processor Time
System: Processor Queue Length
SQL Server Buffer: Buffer Cache Hit Ratio
SQL Server General: User Connections
Memory: Pages/sec:最好不要大于5,否则有内存问题
Memory: Available Bytes :这个可以望文生义,不解释
Network Interface: Bytes Total/Sec :如果这个计数器下降的太快有可能是网络出现问题
Physical Disk: Avg Disk Queue Length:每个物理盘的等待队列,大于2有可能是IO瓶颈问题
Physical Disk: % Disk time: 读/写活动的百分比,不要大于90%,和上面的计数器一起可以显示IO瓶颈
Processor: % Processor Time :CPU瓶颈,不要大于90%,大多数情况下,内存和IO瓶颈要更多
System: Processor Queue Length :同样,和上面计数器一起找出IO瓶颈
SQL Server Buffer: Buffer Cache Hit Ratio :缓存命中率,不要低于85%,否则考虑加内存
SQL Server General:并发数,压测时快到某一瓶颈看看这个数字,可以作为基准(BaseLine)记下来
本文转自CareySon博客园博客,原文链接http://www.cnblogs.com/CareySon/archive/2012/05/25/2518012.html如需转载请自行联系原作者