SQL 性能察看脚本

--显示数据库的一些信息

E/? l3CNt0

sp_helpdb

9x1{$q,]/t,Q.M4R0

 

F uPc`4yOEQ5K0

--表的索引情况

g0fG"Z5a-C%E ]$I0

sp_helpindex51Testing软件测试网Of [2itfM

 51Testing软件测试网2? j#W#oc3\5i(j~0q

--连接名字、连接超时、查询超时51Testing软件测试网'^asX%jT

execute sp_helpserver

-NjXk,{#M$i s0

 51Testing软件测试网4P2e!h7g:i2Ns.NT\"k

--察看锁的使用情况,S共享锁、U更新锁、IS意向共享锁

;Rw ?g%M+Q:?c0

execute sp_lock

JD4h w,b#Z%h'c0

 

wk ij'],H*W0

--监控磁盘读写、连接用户数、包的发送接收、cpui/o

Fs Wu b!E1V uD0

execute sp_monitor51Testing软件测试网~,qj_1`d6z9o})I

 51Testing软件测试网3C#E`Thu

--当前sql server用户和进程

v%{;e%H8w$E1R\ k.`0

execute sp_who

V4mj2q6J4y*l?0

  

B%ldxDv{0

--连接sql server的次数51Testing软件测试网oV3{;x-Y,DWu'fq

select @@connections as 'Total Login Attempts'

&?6dH2](T0g0

S:m9XI,Z$@M0

--sql server CPU活动时间(毫秒)

w r|'X;x7G0

select @@cpu_busy as 'CPU Busy',getdate() as 'Since'

%N)Cgp8R5XYI0

E avJ Di#qE0

--sql server Idle进程处理时间(毫秒)

L!wZO0j'c1@?s0

select @@idle as 'Idle Time', getdate() as 'Since'51Testing软件测试网.@QWO*T;\5A^6} G

#m RSf\hn2@ lYB0

--sql serveri/o进程处理时间(毫秒)51Testing软件测试网:_oj \_%v

select @@io_busy as 'IO Time', getdate() as 'Since'

+o z7k1x|gY8A L)P0

h1u)~C,E(YyJ;E0

--sql server收到的包51Testing软件测试网'_7{^3Gt!p]:h

select @@pack_received51Testing软件测试网4u9D,vH5y&?m5D5p*T

2qMzXwWnm0

--sql server发送的包51Testing软件测试网 l.P5b vk,h

select @@pack_sent

)Z@'F5Z9]Dj/V*xm0

,w5f~(mn0

--sql server错误的包51Testing软件测试网O9I P6j3X

select @@packet_errors51Testing软件测试网 {RK(t*JZ$s

51Testing软件测试网U)Kt,rGDE;yv

--sql server读写磁盘错误的次数51Testing软件测试网.W y? @#v'z#N*O w&F

select @@total_errors as 'Total Errors', getdate() as 'Since'51Testing软件测试网)vwu5ce:t1Y+f!i^u

Q2Z} i(Pu7c_0

--sql server读磁盘的次数51Testing软件测试网zZ.Rw2c @A

select @@total_read as 'Reads', getdate() as 'Since'51Testing软件测试网{E+[6B4o1Mvg

51Testing软件测试网jr4_UUr!I

--sql server写磁盘的次数51Testing软件测试网&Qw[F i5~i:N~s

select @@total_write as 'Writes', getdate() as 'Since'

你可能感兴趣的:(SQL 性能察看脚本)