Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Professional Azure SQL Database Administration

You're reading from   Professional Azure SQL Database Administration Equip yourself with the skills to manage and maintain data in the cloud

Arrow left icon
Product type Paperback
Published in Jul 2019
Publisher Packt
ISBN-13 9781789802542
Length 562 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ahmad Osama Ahmad Osama
Author Profile Icon Ahmad Osama
Ahmad Osama
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

About the Book 1. Microsoft Azure SQL Database Primer FREE CHAPTER 2. Migrating a SQL Server Database to an Azure SQL Database 3. Backing Up an Azure SQL Database 4. Restoring an Azure SQL Database 5. Securing an Azure SQL Database 6. Scaling out an Azure SQL Database 7. Azure SQL Database Elastic Pools 8. High Availability and Disaster Recovery 9. Monitoring and Tuning Azure SQL Database 10. Database Features

Monitoring an Azure SQL Database Using DMVs

DMVs return diagnostic data that can be used to monitor a database's health and performance.

Monitoring Database Metrics

The metrics available on the Azure portal can also be monitored using the sys.resource_stats DMV. This DMV returns the historical analysis for all the databases in an Azure SQL server. The data is collected and aggregated every 5 minutes and is retained for 14 days.

The following query returns the resource utilization from the last six hours:

Note

You can also copy the queries from the C:\Code\Lesson09\MonitoringDMVs.sql file.

The file location may change depending on where you have unzipped the code files.

-- Execute in master database

-- Get utilization in last 6 hours for the toystore database Declare

@StartTime DATETIME = DATEADD(HH,-3,GetUTCDate()),

@EndTime DATETIME = GetUTCDate() SELECT

database_name, start_time, end_time, avg_cpu_percent, avg_data_io_percent,

avg_log_write_percent, (

SELECT Max(v)

FROM (VALUES (avg_cpu_percent...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image