sqlserver的日常检查脚本归结
2012-02-15 12:23:49 来源:WEB开发网from sys.dm_exec_query_stats
cross apply sys.dm_exec_query_plan(plan_handle) p
cross apply sys.dm_exec_sql_text(plan_handle) as q
order by (total_logical_reads + total_logical_writes)/execution_count Desc
go
print ' '
print ' '
print '-------------------------------------------------------'
print '17.7查找哪些批处理/请求生成的 I/O 最多'
print '-------------------------------------------------------'
select top 5
ltrim(total_logical_reads/execution_count) as avg_logical_reads,
ltrim(total_logical_writes/execution_count) as avg_logical_writes,
ltrim(total_physical_reads/execution_count) as avg_phys_reads,
ltrim(Execution_count) as Execution_count,
ltrim(statement_start_offset) as stmt_start_offset,
sql_handle,
plan_handle
from sys.dm_exec_query_stats
order by (total_logical_reads + total_logical_writes) Desc
go
print ' '
print ' '
print '-------------------------------------------------------'
print '18.阻塞'
print '-------------------------------------------------------'
print ' '
print ' '
print '-------------------------------------------------------'
print '18.1 确定阻塞的会话'
print '-------------------------------------------------------'
use master
go
select blocking_session_id, wait_duration_ms, session_id from
sys.dm_os_waiting_tasks
where blocking_session_id is not null
go
print ' '
print ' '
print '-------------------------------------------------------'
print '18.2 SQL 等待分析和前 10 个等待的资源'
print '-------------------------------------------------------'
select top 10 ltrim(wait_type) as wait_type, ltrim(waiting_tasks_count) as waiting_tasks_count,
- ››sql server自动生成批量执行SQL脚本的批处理
- ››sql server 2008亿万数据性能优化
- ››SQL Server 2008清空数据库日志方法
- ››sqlserver安装和简单的使用
- ››SQL Sever 2008 R2 数据库管理
- ››SQL SERVER无法安装成功,sqlstp.log文件提示[未发...
- ››Sql Server中通过父记录查找出所有关联的子记录
- ››SqlServer触发器、存储过程和函数
- ››SQL Server 中的事务(含义,属性,管理)
- ››Sqlite数据库插入和读取图片数据
- ››Sql server 2005拒绝了对对象 'xx表' (数...
- ››Sql server 2005拒绝了对对象 'xx表' (数...
更多精彩
赞助商链接