Skip to content

Latest commit

 

History

History
157 lines (109 loc) · 9.5 KB

File metadata and controls

157 lines (109 loc) · 9.5 KB
title Monitor Azure SQL Database
description Start here to learn how to monitor Azure SQL Database.
author WilliamDAssafMSFT
ms.author wiassaf
ms.reviewer mathoma, dfurman
ms.date 08/07/2025
ms.service azure-sql-database
ms.subservice monitoring
ms.topic concept-article
ms.custom
horz-monitor

Monitor Azure SQL Database

[!INCLUDE appliesto-sqldb]

[!INCLUDE horz-monitor-intro]

The SQL Server database engine has its own monitoring and diagnostic capabilities that Azure SQL Database uses, such as Query Store and dynamic management views (DMVs). For more information, see Monitor performance by using the Query Store and Monitor performance using dynamic management views.

For a detailed discussion of all monitoring and performance aspects of Azure SQL Database and Azure SQL Managed Instance, see Monitor and performance tuning in Azure SQL Database and Azure SQL Managed Instance.

Important

For a set of recommended alert rules, see Monitor Azure SQL Database with metrics and alerts.

Database watcher (preview)

Database watcher collects in-depth workload monitoring data to give you a detailed view of database performance, configuration, and health. Dashboards in the Azure portal provide a single-pane-of-glass view of your Azure SQL estate and a detailed view of each monitored resource. Data is collected into a central data store in your Azure subscription. You can query, analyze, export, visualize collected data and integrate it with downstream systems.

For more information about database watcher, see the following articles:

Query performance insight

Query performance insight uses the SQL Server Query Store to provide intelligent query analysis and insight on query plan choice and performance for single and pooled databases. For more information, see Query Performance Insight for Azure SQL Database.

[!INCLUDE horz-monitor-resource-types]

For more information about the resource types for SQL Database, see Azure SQL Database monitoring data reference.

[!INCLUDE horz-monitor-data-storage]

[!INCLUDE horz-monitor-platform-metrics]

Azure SQL Database metrics

You can use metrics to monitor database and elastic pool resource consumption and health. For example, you can:

  • Right-size the database or elastic pool to your application workload
  • Detect a gradual increase in resource consumption, and proactively scale up the database or elastic pool
  • Detect and troubleshoot a performance problem

For a list and descriptions of commonly used metrics in Azure SQL Database, see Azure SQL Database metrics.

For tables of all available metrics for SQL Database, see SQL Database monitoring data reference.

[!INCLUDE horz-monitor-resource-logs]

Azure SQL Database logs

Auditing for Azure SQL Database tracks database events and writes them to an audit log in your Azure storage account, Log Analytics workspace, or Event Hubs. For more information, see Auditing for Azure SQL Database.

For more information on the resource logs and diagnostics available for Azure SQL Database, see Configure streaming export of diagnostic telemetry.

For the available resource log categories, their associated Log Analytics tables, and the log schemas for SQL Database, see SQL Database monitoring data reference.

[!INCLUDE horz-monitor-activity-log]

[!INCLUDE horz-monitor-analyze-data]

[!INCLUDE horz-monitor-external-tools]

[!INCLUDE horz-monitor-kusto-queries]

Note

Occasionally, it might take up to 15 minutes between when an event is emitted and when it appears in a Log Analytics workspace.

Use the following queries to monitor your database. You might see different options available depending on your purchasing model.

Example A: Log_write_percent from the past hour

AzureMetrics
| where ResourceProvider == "MICROSOFT.SQL"
| where TimeGenerated >= ago(60min)
| where MetricName in ('log_write_percent')
| parse _ResourceId with * "/microsoft.sql/servers/" Resource
| summarize Log_Maximum_last60mins = max(Maximum), Log_Minimum_last60mins = min(Minimum), Log_Average_last60mins = avg(Average) by Resource, MetricName

Example B: SQL Server wait types from the past 15 minutes

AzureDiagnostics
| where ResourceProvider == "MICROSOFT.SQL"
| where TimeGenerated >= ago(15min)
| parse _ResourceId with * "/microsoft.sql/servers/" LogicalServerName "/databases/" DatabaseName
| summarize Total_count_15mins = sum(delta_waiting_tasks_count_d) by LogicalServerName, DatabaseName, wait_type_s

Example C: SQL Server deadlocks from the past 60 minutes

AzureMetrics
| where ResourceProvider == "MICROSOFT.SQL"
| where TimeGenerated >= ago(60min)
| where MetricName in ('deadlock')
| parse _ResourceId with * "/microsoft.sql/servers/" Resource
| summarize Deadlock_max_60Mins = max(Maximum) by Resource, MetricName

Example D: Avg CPU usage from the past hour

AzureMetrics
| where ResourceProvider == "MICROSOFT.SQL"
| where TimeGenerated >= ago(60min)
| where MetricName in ('cpu_percent')
| parse _ResourceId with * "/microsoft.sql/servers/" Resource
| summarize CPU_Maximum_last60mins = max(Maximum), CPU_Minimum_last60mins = min(Minimum), CPU_Average_last60mins = avg(Average) by Resource, MetricName

[!INCLUDE horz-monitor-alerts]

SQL Database alert rules

The following table lists common and recommended alert rules for SQL Database. You might see different options available depending on your purchasing model.

Signal name Operator Aggregation type Threshold value Description
DTU Percentage Greater than Average 80 Whenever the average DTU percentage is greater than 80%
Log I/O percentage Greater than Average 80 Whenever the average log io percentage is greater than 80%
Deadlocks* Greater than Count 1 Whenever the count of deadlocks is greater than 1.
CPU percentage Greater than Average 80 Whenever the average cpu percentage is greater than 80%

* Alerting on deadlocks might be unnecessary and noisy in some applications where deadlocks are expected and properly handled.

Tip

For recommended alert rules and typical alert rule configurations for SQL Database, see Monitor Azure SQL Database with Azure Monitor metrics and alerts.

[!INCLUDE horz-monitor-advisor-recommendations]

Related content