sqlserver的日常检查脚本归结
2012-02-15 12:23:49 来源:WEB开发网print ' '
print ' '
print '-------------------------------------------------------'
print '24. 所有数据库高开销的缺失索引'
print '-------------------------------------------------------'
SELECT TOP 100
[Total Cost] = ROUND(avg_total_user_cost * avg_user_impact * (user_seeks + user_scans),0)
, avg_user_impact
, TableName = statement
, [EqualityUsage] = equality_columns
, [InequalityUsage] = inequality_columns
, [Include Cloumns] = included_columns
FROM sys.dm_db_missing_index_groups g
INNER JOIN sys.dm_db_missing_index_group_stats s
ON s.group_handle = g.index_group_handle
INNER JOIN sys.dm_db_missing_index_details d
ON d.index_handle = g.index_handle
ORDER BY [Total Cost] DESC;
print ' '
print ' '
print '-------------------------------------------------------'
print '25. 查看buffer cache命中率'
print '-------------------------------------------------------'
SELECT
(CAST(SUM(CASE LTRIM(RTRIM(counter_name))
WHEN 'Buffer cache hit ratio'
THEN CAST(cntr_value AS INTEGER) ELSE NULL END) AS FLOAT) /
CAST(SUM(CASE LTRIM(RTRIM(counter_name))
WHEN 'Buffer cache hit ratio base' THEN CAST(cntr_value AS INTEGER)ELSE NULL END) AS FLOAT)) * 100
AS BufferCacheHitRatio
FROM sys.dm_os_performance_counters
WHERE LTRIM(RTRIM([object_name])) LIKE '%:Buffer Manager' AND
[counter_name] LIKE 'Buffer Cache Hit Ratio%'
go
print ' '
print ' '
print '-------------------------------------------------------'
print '26. 查看job执行情况'
print '-------------------------------------------------------'
- ››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表' (数...
更多精彩
赞助商链接