设为首页 加入收藏

TOP

SQL Server性能基线和监控简析(一)
2014-11-24 08:26:01 来源: 作者: 【 】 浏览:2
Tags:SQL Server 性能 监控 简析
SQL Server性能基线和监控简析
就讲讲监控那些值,基线抓的是那些值。如何做告警
环境: windows 2008r2,sql server 2008r2 sp1
性能基线: www.2cto.com
  cpu:
    \Processor(_Total)\% Processor Time
    \Processor(_Total)\% Privileged Time
    \SQLServer:SQL Statistics\Batch Requests/sec
    \SQLServer:SQL Statistics\SQL Compilations/sec
    \SQLServer:SQL Statistics\SQL Re-Compilations/sec
    \System\Processor Queue Length
    \System\Context Switches/sec
  Memory:
    \Memory\Available Bytes
    \Memory\Pages/sec
    \Memory\Page Faults/sec
    \Memory\Pages Input/sec
    \Memory\Pages Output/sec
    \Process(sqlservr)\Private Bytes
    \SQLServer:Buffer Manager\Buffer cache hit ratio
    \SQLServer:Buffer Manager\Page life expectancy
    \SQLServer:Buffer Manager\Lazy writes/sec
    \SQLServer:Memory Manager\Memory Grants Pending
    \SQLServer:Memory Manager\Target Server Memory (KB)
    \SQLServer:Memory Manager\Total Server Memory (KB)
  Disk:
    \PhysicalDisk(_Total)\% Disk Time
    \PhysicalDisk(_Total)\Current Disk Queue Length
    \PhysicalDisk(_Total)\Avg. Disk Queue Length
    \PhysicalDisk(_Total)\Disk Transfers/sec
    \PhysicalDisk(_Total)\Disk Bytes/sec
    \PhysicalDisk(_Total)\Avg. Disk sec/Read
    \PhysicalDisk(_Total)\Avg. Disk sec/Write
  SQL Server: www.2cto.com
    \SQLServer:Access Methods\FreeSpace Scans/sec
    \SQLServer:Access Methods\Full Scans/sec
    \SQLServer:Access Methods\Table Lock Escalations/sec
    \SQLServer:Access Methods\Worktables Created/sec
    \SQLServer:General Statistics\Processes blocked
    \SQLServer:General Statistics\User Connections
    \SQLServer:Latches\Total Latch Wait Time (ms)
    \SQLServer:Locks(_Total)\Lock Timeouts (timeout > 0)/sec
    \SQLServer:Locks(_Total)\Lock Wait Time (ms)
    \SQLServer:Locks(_Total)\Number of Deadlocks/sec
    \SQLServer:SQL Statistics\Batch Requests/sec
    \SQLServer:SQL Statistics\SQL Re-Compilations/sec
以上是性能基线监控的信息,当然性能警告也是监控这些信息,其中的阀值是根据基线抓取后体现。
关于性能警告我是使用powershell 写了一个脚本,运行在SQL Agent 中。如果出现警告,就通过dbmail 发送邮件
关于powershell 脚本和一些配置信息看如下:
$server = "(local)"
$uid = "sa"
$db="master"
$pwd="pwd"
$mailprfname = "sina"
$recipients = "xxxxx@qq.com"
$subject = "Proformance Alter"
$computernamexml = "f:\computername.xml"
$alter_cpuxml = "f:\alter_cpu.xml"
function GetServerName($xmlpath)
{
$xml = [xml] (Get-Content $xmlpath)
$return = New-Object Collections.Generic.List[string]
for($i = 0;$i -lt $xml.computernames.ChildNodes.Count;$i++)
{
if ( $xml.computernames.ChildNodes.Count -eq 1)
{
$cp = [string]$xml.computernames.computername
}
else
{
$cp = [string]$xml.computernames.computername[$i]
}
$return.Add($cp.Trim())
} www.2cto.com
$return
}
function GetAlterCounter($xmlpath)
{
$xml = [xml] (Get-Content $xmlpath)
$return = New-Object Collections.Generic.List[string]
$list = $xml.counters.Counter
$list
}
function CreateAlter($message)
{
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$CnnString ="Server = $server; Database = $db;User Id = $uid; Password = $pwd"
$SqlConnection.ConnectionString = $CnnString
$CC = $SqlConnection.CreateComman
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇MSSQL的NULL函数简析 下一篇TFS:TF30042数据库已满处理方法

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis压力测试实战 - (2025-12-27 09:20:24)
·高并发一上来,微服 (2025-12-27 09:20:21)
·Redis 高可用架构深 (2025-12-27 09:20:18)
·Linux 系统监控 的完 (2025-12-27 08:52:29)
·一口气总结,25 个 L (2025-12-27 08:52:27)