{"id":547,"date":"2010-12-17T18:15:00","date_gmt":"2010-12-17T18:15:00","guid":{"rendered":"\/blogs\/jonathan\/post\/An-XEvent-a-Day-(17-of-31)-A-Look-at-Backup-Internals-and-How-to-Track-Backup-and-Restore-Throughput-(Part-1).aspx"},"modified":"2017-04-13T14:41:05","modified_gmt":"2017-04-13T18:41:05","slug":"an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/","title":{"rendered":"An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1)"},"content":{"rendered":"<p>\nToday&rsquo;s post is a continuation of yesterday&rsquo;s post <a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-16-of-31-how-many-checkpoints-are-issued-during-a-full-backup\/\" target=\"_blank\">How Many Checkpoints are Issued During a Full Backup?<\/a> and the investigation of Database Engine Internals with Extended Events.&nbsp; In today&rsquo;s post we&rsquo;ll look at how Backup&rsquo;s work inside of SQL Server and how to track the throughput of Backup and Restore operations.&nbsp; This post is not going to cover Backups in SQL Server as a topic; if that is what you are looking for see Paul Randal&rsquo;s TechNet Article <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/2009.07.sqlbackup.aspx\" target=\"_blank\" title=\"http:\/\/technet.microsoft.com\/en-us\/magazine\/2009.07.sqlbackup.aspx\">Understanding SQL Server Backups<\/a>.\n<\/p>\n<p>\nYesterday I mentioned that there is only one Event in Extended Events that has the word backup in it&#39;s name, and that Event is the sqlserver.backup_and_restore_throughput Event.&nbsp; At first glance this Event looks pretty dull.&nbsp; It only returns three columns, database_id, count, and increment, and doesn&rsquo;t really tell us what count and increment mean in the metadata.\n<\/p>\n<blockquote><p>\n\t<code><span style=\"color: green\">-- Get the Event columns<br \/>\n\t<\/span><span style=\"color: blue\">SELECT <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: magenta\">OBJECT_NAME<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">name<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">type_name<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">description<br \/>\n\t<\/span><span style=\"color: blue\">FROM <\/span><span style=\"color: black\">sys.dm_xe_object_columns<br \/>\n\t<\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: magenta\">OBJECT_NAME <\/span><span style=\"color: gray\">LIKE <\/span><span style=\"color: red\">&#39;%backup%&#39;<br \/>\n\t&nbsp;&nbsp;<\/span><span style=\"color: gray\">AND <\/span><span style=\"color: black\">column_type <\/span><span style=\"color: blue\">= <\/span><span style=\"color: red\">&#39;data&#39;<\/span><\/code> <\/p>\n<p>\n\t<a href=\"http:\/\/www.11011.net\/software\/vspaste\"><\/a><a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/4aed1912\/image.png\" target=\"_blank\"><img fetchpriority=\"high\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/3ebb791e\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"456\" height=\"112\" \/><\/a>\n\t<\/p>\n<\/blockquote>\n<p>\nI could step you through what I did to look at this Event and figure out the meaning of things, but that would make an already long post longer.&nbsp; Essentially I created an Event Session with just this Event and used the sqlserver.session_id Predicate to only capture it for a specific session_id that I was going to run a FULL backup from.&nbsp; The count column is the total number of bytes that have been written to backups and the increment column is the current number of bytes that were written when the Event fired (we&rsquo;ll see this more in a minute).&nbsp; This was interesting to see so I started thinking about what kind of information I would want to know about Backups that related to the throughput and two items came to mind almost immediately; read operations from the database, and wait statistics related to the Backup occurring, both of which are available through Extended Events.&nbsp; I also recalled that there were a few documented Trace Flags associated with Backup and Restore operations that output more verbose information through Trace Prints.&nbsp; Trace Flag 3004, outputs what operations Backup and Restore are performing (<a href=\"https:\/\/blogs.msdn.microsoft.com\/b\/psssql\/archive\/2008\/01\/23\/how-it-works-what-is-restore-backup-doing.aspx\" target=\"_blank\">How It Works: What is Restore\/Backup Doing<\/a>?).&nbsp; Trace Flag 3213, outputs the Backup Buffer configuration information as discussed on the SQLCAT team blog series <a href=\"https:\/\/blogs.msdn.microsoft.com\/sqlcat\/\" target=\"_blank\">Tuning the Performance of Backup Compression in SQL Server 2008<\/a> and <a href=\"https:\/\/blogs.msdn.microsoft.com\/sqlcat\/\" target=\"_blank\">Tuning Backup Compression Part 2<\/a>.&nbsp; Trace Flag 3014, outputs additional information about Backup and File operations (<a href=\"https:\/\/blogs.msdn.microsoft.com\/b\/psssql\/archive\/2008\/02\/06\/how-it-works-how-does-sql-server-backup-and-restore-select-transfer-sizes.aspx\" target=\"_blank\">How It Works: How does SQL Server Backup and Restore select transfer sizes<\/a>).&nbsp; There happens to be a sqlserver.trace_print Event that can capture the trace output as a part of our Event Session.\n<\/p>\n<p>\nUsing yesterday&rsquo;s post as a foundation for the Event Session in today&rsquo;s post, and the same Sample_Reporting Database, lets look at the Event Session that we&rsquo;ll use to investigate Backups.\n<\/p>\n<blockquote><p>\n\t<code><span style=\"color: green\">-- Create the Event Session<br \/>\n\t<\/span><span style=\"color: blue\">CREATE <\/span><span style=\"color: black\">EVENT SESSION BackupMonitoring<br \/>\n\t<\/span><span style=\"color: blue\">ON <\/span><span style=\"color: black\">SERVER<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.sql_statement_starting<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: black\">ACTION <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.database_id<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">sqlserver.sql_text<\/span><span style=\"color: gray\">)<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.session_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">97<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.sql_statement_completed<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: black\">ACTION <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.database_id<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">sqlserver.sql_text<\/span><span style=\"color: gray\">)<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.session_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">97<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.databases_backup_restore_throughput<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.session_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">97<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlos.wait_info<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: black\">ACTION <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.database_id<\/span><span style=\"color: gray\">) <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.session_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">97&nbsp;&nbsp;<\/span><span style=\"color: gray\">AND <\/span><span style=\"color: black\">duration <\/span><span style=\"color: gray\">&gt; <\/span><span style=\"color: black\">0<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlos.wait_info_external<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: black\">ACTION <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.database_id<\/span><span style=\"color: gray\">) <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.session_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">97&nbsp;&nbsp;<\/span><span style=\"color: gray\">AND <\/span><span style=\"color: black\">duration <\/span><span style=\"color: gray\">&gt; <\/span><span style=\"color: black\">0<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.trace_print<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.session_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">97<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.file_read<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.session_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">97<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.file_read_completed<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.session_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">97<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.physical_page_read<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">sqlserver.session_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">97<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.databases_log_cache_read<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">database_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">41<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.databases_log_cache_hit<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">database_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">41<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.databases_log_flush<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">database_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">41<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.checkpoint_begin<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">database_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">41<\/span><span style=\"color: gray\">)),<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">EVENT sqlserver.checkpoint_end<br \/>\n\t<\/span><span style=\"color: gray\">(&nbsp;&nbsp; <\/span><span style=\"color: blue\">WHERE <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">database_id <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">41<\/span><span style=\"color: gray\">))<br \/>\n\t<\/span><span style=\"color: blue\">ADD <\/span><span style=\"color: black\">TARGET package0.asynchronous_file_target<\/span><span style=\"color: gray\">(<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: blue\">SET <\/span><span style=\"color: black\">filename<\/span><span style=\"color: blue\">=<\/span><span style=\"color: red\">&#39;C:\\SQLBlog\\BackupMonitoring1.xel&#39;<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"color: black\">metadatafile <\/span><span style=\"color: blue\">= <\/span><span style=\"color: red\">&#39;C:\\SQLBlog\\BackupMonitoring1.xem&#39;<\/span><span style=\"color: gray\">)<br \/>\n\t<\/span><span style=\"color: black\">GO<br \/>\n\t<\/span><span style=\"color: green\">-- Alter the Session to Start it<br \/>\n\t<\/span><span style=\"color: blue\">ALTER <\/span><span style=\"color: black\">EVENT SESSION BackupMonitoring<br \/>\n\t<\/span><span style=\"color: blue\">ON <\/span><span style=\"color: black\">SERVER<br \/>\n\tSTATE<\/span><span style=\"color: blue\">=<\/span><span style=\"color: black\">START<br \/>\n\tGO<\/span><\/code>\n<\/p><\/blockquote>\n<p>\nThere is a lot of information being collected in this Event Session.&nbsp; We are going to get the sql_statement_starting and completed Events, the backup_restore_throughput Event, wait_info Event for SQLOS waits inside of SQL Server and the wait_info_external Event for preemptive waits outside of SQL Server, the trace_print Event to capture our Trace Flag outputs, the file_read, file_read_completed, and physical_page_read Events to capture read operations from the session_id performing the Backup, the database_log_cache_read, database_log_cache_hit, and database_log_flush Events to track transaction log cache operations during the Backup, and the checkpoint_begin and checkpoint_end Events to track checkpoint occurrence during the backup and how they might impact throughput.&nbsp; If you notice, some of the Events are Predicated on the session_id, while others are predicated on the database_id, and this is very intentional in the definition of this Event Session.&nbsp; Some Events do not fire in the context of a specific database_id, and some Events do not fire in the context of a specific session_id, and some will fire for both.&nbsp; Where the database_id is a practical Predicate for the Event, and it is carried in the Events base payload, it is a natural item to use for a Predicate.&nbsp; Restricting Events to a specific database_id or session_id will prevent Event capture from other operations occurring on the SQL Server.\n<\/p>\n<p>\nWith our Event Session defined and started, we can now run a Backup of the database and see what we capture.&nbsp; I am going to show two different Backup configurations in this post, based on the information contained in the SQLCAT series on tuning Backup Performance in SQL Server 2008.&nbsp; The first one uses a default configuration for the BUFFERCOUNT and MAXTRANSFERSIZE Backup options, but also uses Database Compression since it is available to minimize he backup file size, and maximize the throughput of the backup operation.\n<\/p>\n<blockquote><p>\n\t<code><span style=\"color: blue\">BACKUP DATABASE <\/span><span style=\"color: black\">[Sample_Reporting] <br \/>\n\t<\/span><span style=\"color: blue\">TO&nbsp;&nbsp;DISK = <\/span><span style=\"color: red\">N&#39;B:\\SQLData\\MSSQL10.MSSQLSERVER\\MSSQL\\Backup\\Sample_Reporting1.bak&#39; <br \/>\n\t<\/span><span style=\"color: blue\">WITH <\/span><span style=\"color: black\">NOFORMAT<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">NOINIT<\/span><span style=\"color: gray\">,&nbsp;&nbsp;<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">NAME <\/span><span style=\"color: blue\">= <\/span><span style=\"color: red\">N&#39;Sample_Reporting-Full Database Backup Number 1&#39;<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">SKIP<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">NOREWIND<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">NOUNLOAD<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">COMPRESSION<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">STATS <\/span><span style=\"color: blue\">= <\/span><span style=\"color: black\">5<br \/>\n\tGO<\/span><\/code>\n<\/p><\/blockquote>\n<p>\nOn this server, the backups are writing to a dedicated RAID1 disk array using two 146GB 15K RPM SAS drives.&nbsp; When the backup completes we can begin our analysis of the Events captured by our Event Session.&nbsp; To make it possible to perform various types of analysis of the data contained inside of the asynchronous_file_target, I am going to read the Raw XML Event data into a temporary table, and then shred the XML into a second temporary table, making it possible to just query the shredded data.\n<\/p>\n<blockquote><p>\n\t<code><span style=\"color: blue\">DROP TABLE <\/span><span style=\"color: #434343\">#EventData<br \/>\n\t<\/span><span style=\"color: blue\">DROP TABLE <\/span><span style=\"color: #434343\">#TestResults<\/p>\n<p>\t<\/span><span style=\"color: green\">-- Create intermediate temp table for raw event data<br \/>\n\t<\/span><span style=\"color: blue\">CREATE TABLE <\/span><span style=\"color: #434343\">#EventData<br \/>\n\t<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">Rowid <\/span><span style=\"color: blue\">INT <\/span><span style=\"color: #434343\">IDENTITY <\/span><span style=\"color: blue\">PRIMARY KEY<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">event_data <\/span><span style=\"color: blue\">XML<\/span><span style=\"color: gray\">)<\/p>\n<p>\t<\/span><span style=\"color: green\">-- Create final results table for parsed event data<br \/>\n\t<\/span><span style=\"color: blue\">CREATE TABLE <\/span><span style=\"color: #434343\">#TestResults<br \/>\n\t<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">Rowid <\/span><span style=\"color: blue\">INT PRIMARY KEY<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">event_name <\/span><span style=\"color: blue\">VARCHAR<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">50<\/span><span style=\"color: gray\">), <\/span><span style=\"color: black\">package_name <\/span><span style=\"color: blue\">VARCHAR<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">50<\/span><span style=\"color: gray\">),<br \/>\n\t<\/span><span style=\"color: black\">[timestamp] datetime2<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">database_id <\/span><span style=\"color: blue\">INT<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">trace_print <\/span><span style=\"color: blue\">NVARCHAR<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">4000<\/span><span style=\"color: gray\">),<br \/>\n\t<\/span><span style=\"color: black\">[count] bigint<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">increment bigint<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">wait_type <\/span><span style=\"color: blue\">NVARCHAR<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">100<\/span><span style=\"color: gray\">), <\/span><span style=\"color: black\">opcode <\/span><span style=\"color: blue\">NVARCHAR<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">10<\/span><span style=\"color: gray\">),<br \/>\n\t<\/span><span style=\"color: black\">duration bigint<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">max_duration bigint<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">total_duration bigint<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">signal_duration bigint<\/span><span style=\"color: gray\">,<br \/>\n\t<\/span><span style=\"color: black\">completed_count bigint<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">source_database_id <\/span><span style=\"color: blue\">INT<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">[object_id] <\/span><span style=\"color: blue\">INT<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">object_type <\/span><span style=\"color: blue\">INT<\/span><span style=\"color: gray\">,<br \/>\n\t<\/span><span style=\"color: black\">[state] <\/span><span style=\"color: blue\">NVARCHAR<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">50<\/span><span style=\"color: gray\">), <\/span><span style=\"color: black\">offset bigint<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">offset_end <\/span><span style=\"color: blue\">INT<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">nest_level <\/span><span style=\"color: blue\">INT<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">cpu <\/span><span style=\"color: blue\">INT<\/span><span style=\"color: gray\">,<br \/>\n\t<\/span><span style=\"color: black\">reads bigint<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">writes bigint<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">mode <\/span><span style=\"color: blue\">NVARCHAR<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">50<\/span><span style=\"color: gray\">), <\/span><span style=\"color: magenta\">FILE_ID <\/span><span style=\"color: blue\">INT<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">page_id <\/span><span style=\"color: blue\">INT<\/span><span style=\"color: gray\">,<br \/>\n\t<\/span><span style=\"color: black\">file_group_id <\/span><span style=\"color: blue\">INT<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">sql_text <\/span><span style=\"color: blue\">NVARCHAR<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">4000<\/span><span style=\"color: gray\">))<\/p>\n<p>\t<\/span><span style=\"color: green\">-- Read the file data into intermediate temp table<br \/>\n\t<\/span><span style=\"color: blue\">INSERT INTO <\/span><span style=\"color: #434343\">#EventData <\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">event_data<\/span><span style=\"color: gray\">)<br \/>\n\t<\/span><span style=\"color: blue\">SELECT<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: magenta\">CAST<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">event_data <\/span><span style=\"color: blue\">AS XML<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">event_data<br \/>\n\t<\/span><span style=\"color: blue\">FROM <\/span><span style=\"color: black\">sys.<\/span><span style=\"color: darkred\">fn_xe_file_target_read_file<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;C:\\SQLBlog\\BackupMonitoring1*.xel&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;C:\\SQLBlog\\BackupMonitoring1*xem&#39;<\/span><span style=\"color: gray\">, NULL, NULL)<\/p>\n<p>\t<\/span><span style=\"color: green\">-- Query the Event data from the Target.<br \/>\n\t<\/span><span style=\"color: blue\">INSERT INTO <\/span><span style=\"color: #434343\">#TestResults<br \/>\n\t<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">Rowid<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">event_name<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">package_name<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">[timestamp]<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">database_id<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">trace_print<\/span><span style=\"color: gray\">,<br \/>\n\t<\/span><span style=\"color: black\">[count]<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">increment<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">wait_type<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">opcode<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">duration<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">max_duration<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">total_duration<\/span><span style=\"color: gray\">, <br \/>\n\t<\/span><span style=\"color: black\">signal_duration<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">completed_count<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">source_database_id<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">[object_id]<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">object_type<\/span><span style=\"color: gray\">,<br \/>\n\t<\/span><span style=\"color: black\">[state]<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">offset<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">offset_end<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">nest_level<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">cpu<\/span><span style=\"color: gray\">,&nbsp;&nbsp;<\/span><span style=\"color: black\">reads<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">writes<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">mode<\/span><span style=\"color: gray\">, <\/span><span style=\"color: magenta\">FILE_ID<\/span><span style=\"color: gray\">,<br \/>\n\t<\/span><span style=\"color: black\">page_id<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">file_group_id<\/span><span style=\"color: gray\">, <\/span><span style=\"color: black\">sql_text<\/span><span style=\"color: gray\">)<\/p>\n<p>\t<\/span><span style=\"color: blue\">SELECT <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">RowID<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/@name)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;varchar(50)&#39;<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">event_name<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/@package)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;varchar(50)&#39;<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">package_name<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: magenta\">DATEADD<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">hh<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: magenta\">DATEDIFF<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">hh<\/span><span style=\"color: gray\">, <\/span><span style=\"color: magenta\">GETUTCDATE<\/span><span style=\"color: gray\">(), <\/span><span style=\"color: magenta\">CURRENT_TIMESTAMP<\/span><span style=\"color: gray\">), <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/@timestamp)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;datetime2&#39;<\/span><span style=\"color: gray\">)) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">[timestamp]<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: magenta\">COALESCE<\/span><span style=\"color: gray\">(<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;database_id&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">),<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/action[@name=&quot;database_id&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">)) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">database_id<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;message&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;nvarchar(4000)&#39;<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">trace_print<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;count&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;bigint&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">[count]<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;increment&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;bigint&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">[increment]<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;wait_type&quot;]\/text)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;nvarchar(100)&#39;<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">wait_type<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;opcode&quot;]\/text)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;nvarchar(10)&#39;<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">opcode<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;duration&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;bigint&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">duration<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;max_duration&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;bigint&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">max_duration<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;total_duration&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;bigint&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">total_duration<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;signal_duration&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;bigint&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">signal_duration<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;completed_count&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;bigint&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">completed_count<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;source_database_id&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">source_database_id<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;object_id&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: magenta\">OBJECT_ID<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;object_type&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">object_type<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;state&quot;]\/text)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;nvarchar(50)&#39;<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">state<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;offset&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;bigint&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">offset<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;offset_end&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">offset_end<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;nest_level&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">nest_level<\/span><span style=\"color: gray\">,&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;cpu&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">cpu<\/span><span style=\"color: gray\">,&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;reads&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;bigint&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">reads<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;writes&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;bigint&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">writes<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;mode&quot;]\/text)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;nvarchar(50)&#39;<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">mmode<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;file_id&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: magenta\">FILE_ID<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;page_id&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">page_id<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/data[@name=&quot;file_group_id&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;int&#39;<\/span><span style=\"color: gray\">)&nbsp;&nbsp;<\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">file_group_id<\/span><span style=\"color: gray\">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_data.value<\/span><span style=\"color: gray\">(<\/span><span style=\"color: red\">&#39;(event\/action[@name=&quot;sql_text&quot;]\/value)[1]&#39;<\/span><span style=\"color: gray\">, <\/span><span style=\"color: red\">&#39;nvarchar(4000)&#39;<\/span><span style=\"color: gray\">) <\/span><span style=\"color: blue\">AS <\/span><span style=\"color: black\">sql_text<br \/>\n\t<\/span><span style=\"color: blue\">FROM <\/span><span style=\"color: #434343\">#EventData<br \/>\n\t<\/span><span style=\"color: blue\">ORDER BY <\/span><span style=\"color: black\">Rowid<\/p>\n<p>\t<\/span><span style=\"color: green\">-- Look at the Results.<br \/>\n\t<\/span><span style=\"color: blue\">SELECT <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">Rowid<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">event_name<\/span><span style=\"color: gray\">,<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">database_id<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">trace_print<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">[count]<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">increment<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">wait_type<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">duration<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">signal_duration<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">cpu<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">reads<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">writes<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">mode<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: magenta\">FILE_ID<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">page_id<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">file_group_id<\/span><span style=\"color: gray\">, <br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: black\">sql_text<br \/>\n\t<\/span><span style=\"color: blue\">FROM <\/span><span style=\"color: #434343\">#TestResults<br \/>\n\t<\/span><span style=\"color: blue\">ORDER BY <\/span><span style=\"color: black\">Rowid<\/span><\/code>\n<\/p><\/blockquote>\n<p>\nIn the above query, I am extracting all of the data elements from the Event data, even though in the final query I am not using all of the data.&nbsp; I did this to have a complete example of how to shred the XML, and because we are storing it in a temp table, we may find that we want to come back and look at specific data elements that were excluded in the initial look at the results.&nbsp; From our results we can begin to understand how Backup Operations work inside of SQL Server.\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/3d76e03f\/image.png\" target=\"_blank\"><img decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/2a55b393\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"174\" \/><\/a>\n<\/p>\n<p>\nHere we can see the statement starting to execute, and the first output from the trace_print Event showing that the backup of the database was starting, along with the external waits associated with performing file operations to create a Backup file for the database.\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/4b39006d\/image.png\" target=\"_blank\"><img decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/4b7583a2\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"190\" \/><\/a>\n<\/p>\n<p>\nHere the newly created Backup file is opened an 1K of write occur to the file before it becomes ready for the Backup.\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/29a9ab11\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/14d7b291\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"233\" \/><\/a>\n<\/p>\n<p>\nHere we can see two operations being performed.&nbsp; In the red outlined box, since we are doing a full Backup of the database, the differential bitmaps, pages that track which extents in a GAM interval have been modified since the last full or differential backup (<a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/inside-the-storage-engine-anatomy-of-an-extent\/\">Inside the Storage Engine: Anatomy of an extent<\/a>), are cleared.&nbsp; In the blue outlined box, we see the checkpoint triggered by the Backup operation begin, and in the four highlighted boxes in grey, we see two physical_page_reads occur for the database, one from the transaction log, and one from the primary data file.&nbsp; These are the pages that are written to when Checkpoint occurs in the database.&nbsp; The file_id 2 page_id 0 page is where the Log Sequence Number is written to the log file, and file_id 1 page_id 9 is the database boot page, where the LSN is also written to at checkpoint (<a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/logs\/database-checkpoints-sql-server\">Checkpoints and the Active Portion of the Log<\/a>).&nbsp; We also see the wait_info event for the PAGEIOLATCH_UP wait to update of this information.\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/0bf78478\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/6378a263\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"330\" \/><\/a>\n<\/p>\n<p>\nNext the allocation bitmaps for the database are scanned and an estimate of the work is performed (red box) before writing 5K of metadata into the backup file.&nbsp;\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/3f8fcb09\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/4fdb1cf5\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"213\" \/><\/a>\n<\/p>\n<p>\nAt this point the Backup process is ready to begin copying data to the Backup file.&nbsp; Since this particular database only has 1 data file, only one reader is assigned to the backup (<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/ms190954(SQL.90).aspx\">Optimising Backup &amp; Restore Performance in SQL Server<\/a>).&nbsp; When the Backup starts on the file, an additional 1024 bytes (1K of information is written to the Backup file and the file read operations against the database data file(s) commences.\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/649cefa8\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/433d4a0c\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"239\" \/><\/a>\n<\/p>\n<p>\nAs the backup of the data file data begins, we see a change in the size of the increment being written to the Backup file, and now we have 1MB segments of data being written to the file.\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/2958ee10\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/117206ea\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"201\" \/><\/a> <br \/>\nWe can also see that multiple 1MB segments are written within milliseconds of each other.&nbsp; Now I could spend a lot of time running through the entire set of Events showing the same thing, but with 187,698 Events for a 110 second Backup, that would take forever.&nbsp; Instead I am going to skip over all the interim file reads and Backup file writes and get to the end of the data file section.\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/3f4f33d5\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/41a8b5d3\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"300\" \/><\/a>\n<\/p>\n<p>\nHighlighted in black above, we see the completion of the first data file, followed by a trace_print event, in red, Padding MSDA with 196608 bytes (192K of space), and then the trace_print event, in blue, showing the completion of all Database files, which is also the beginning of the Transaction log portion of the backup.\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/6866a646\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/06d0e730\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"379\" \/><\/a>\n<\/p>\n<p>\nHere we can see that the size of the log information being backed up, highlighted in black, is significantly different from the data file information which is to be expected since log records are very different from data records in composition.&nbsp; When the log files done trace_print Event in red, and the trailing configuration writres in blue and the trace_print Event in orange marking the completion of the trailing configuration.\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/468aa7e8\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/0c2f3207\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"101\" \/><\/a>\n<\/p>\n<p>\nI don&rsquo;t know what MBC done means, and I couldn&rsquo;t find it online, but it completed here.&nbsp; I think it might stand for MaxBufferCount, and the above line shows that all of the buffers have been written out for the backup. (Don&rsquo;t quote me on that I am just taking a SWAG there!) <\/p>\n<p><a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/28104132\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/06b09b96\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"102\" \/><\/a>\n<\/p>\n<p>\nAfter the MBC is done, the backup history records are written into MSDB.\n<\/p>\n<p>\n<a href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/445d8352\/image.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px\" src=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/22fdddb6\/image_thumb.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"644\" height=\"101\" \/><\/a>&nbsp;\n<\/p>\n<p>\nAnd finally the backup completes.&nbsp; So far all that we&rsquo;ve done is look at all of the information that we can get, and there is a lot of it, but unless we can do something actionable with all this information, there is no real point in gathering it.&nbsp; I originally intended to only cover one post on this subject but its become quite large, so I am splitting it into two posts and in tomorrow&rsquo;s post we&rsquo;ll look at how we can use the information captured in today&rsquo;s post to validate whether or not changes to our backup process have a positive or negative impact on backup times and throughput.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today&rsquo;s post is a continuation of yesterday&rsquo;s post How Many Checkpoints are Issued During a Full Backup? and the investigation of Database Engine Internals with Extended Events.&nbsp; In today&rsquo;s post we&rsquo;ll look at how Backup&rsquo;s work inside of SQL Server and how to track the throughput of Backup and Restore operations.&nbsp; This post is not [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,38,45],"tags":[],"class_list":["post-547","post","type-post","status-publish","format-standard","hentry","category-extended-events","category-sql-server-2008","category-xevent-a-day-series"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1) - Jonathan Kehayias<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1) - Jonathan Kehayias\" \/>\n<meta property=\"og:description\" content=\"Today&rsquo;s post is a continuation of yesterday&rsquo;s post How Many Checkpoints are Issued During a Full Backup? and the investigation of Database Engine Internals with Extended Events.&nbsp; In today&rsquo;s post we&rsquo;ll look at how Backup&rsquo;s work inside of SQL Server and how to track the throughput of Backup and Restore operations.&nbsp; This post is not [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/\" \/>\n<meta property=\"og:site_name\" content=\"Jonathan Kehayias\" \/>\n<meta property=\"article:published_time\" content=\"2010-12-17T18:15:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T18:41:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/3ebb791e\/image_thumb.png\" \/>\n<meta name=\"author\" content=\"Jonathan Kehayias\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jonathan Kehayias\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/\"},\"author\":{\"name\":\"Jonathan Kehayias\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#\\\/schema\\\/person\\\/01c10d94f3648654ef706d5e6305f69c\"},\"headline\":\"An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1)\",\"datePublished\":\"2010-12-17T18:15:00+00:00\",\"dateModified\":\"2017-04-13T18:41:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/\"},\"wordCount\":1819,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/windowslivewriter\\\/anxeventaday17of31alookathowbackupsworka\\\/3ebb791e\\\/image_thumb.png\",\"articleSection\":[\"Extended Events\",\"SQL Server 2008\",\"XEvent a Day Series\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/\",\"url\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/\",\"name\":\"An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1) - Jonathan Kehayias\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/windowslivewriter\\\/anxeventaday17of31alookathowbackupsworka\\\/3ebb791e\\\/image_thumb.png\",\"datePublished\":\"2010-12-17T18:15:00+00:00\",\"dateModified\":\"2017-04-13T18:41:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#\\\/schema\\\/person\\\/01c10d94f3648654ef706d5e6305f69c\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/windowslivewriter\\\/anxeventaday17of31alookathowbackupsworka\\\/3ebb791e\\\/image_thumb.png\",\"contentUrl\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/wp-content\\\/uploads\\\/windowslivewriter\\\/anxeventaday17of31alookathowbackupsworka\\\/3ebb791e\\\/image_thumb.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Extended Events\",\"item\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/category\\\/extended-events\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#website\",\"url\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/\",\"name\":\"Jonathan Kehayias - The Rambling DBA\",\"description\":\"The Rambling DBA\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.sqlskills.com\\\/blogs\\\/jonathan\\\/#\\\/schema\\\/person\\\/01c10d94f3648654ef706d5e6305f69c\",\"name\":\"Jonathan Kehayias\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g\",\"caption\":\"Jonathan Kehayias\"},\"sameAs\":[\"http:\\\/\\\/3.209.169.194\\\/blogs\\\/jonathan\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1) - Jonathan Kehayias","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/","og_locale":"en_US","og_type":"article","og_title":"An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1) - Jonathan Kehayias","og_description":"Today&rsquo;s post is a continuation of yesterday&rsquo;s post How Many Checkpoints are Issued During a Full Backup? and the investigation of Database Engine Internals with Extended Events.&nbsp; In today&rsquo;s post we&rsquo;ll look at how Backup&rsquo;s work inside of SQL Server and how to track the throughput of Backup and Restore operations.&nbsp; This post is not [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/","og_site_name":"Jonathan Kehayias","article_published_time":"2010-12-17T18:15:00+00:00","article_modified_time":"2017-04-13T18:41:05+00:00","og_image":[{"url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/3ebb791e\/image_thumb.png","type":"","width":"","height":""}],"author":"Jonathan Kehayias","twitter_misc":{"Written by":"Jonathan Kehayias","Est. reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/#article","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/"},"author":{"name":"Jonathan Kehayias","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#\/schema\/person\/01c10d94f3648654ef706d5e6305f69c"},"headline":"An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1)","datePublished":"2010-12-17T18:15:00+00:00","dateModified":"2017-04-13T18:41:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/"},"wordCount":1819,"commentCount":1,"image":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/3ebb791e\/image_thumb.png","articleSection":["Extended Events","SQL Server 2008","XEvent a Day Series"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/","url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/","name":"An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1) - Jonathan Kehayias","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/#primaryimage"},"image":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/#primaryimage"},"thumbnailUrl":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/3ebb791e\/image_thumb.png","datePublished":"2010-12-17T18:15:00+00:00","dateModified":"2017-04-13T18:41:05+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#\/schema\/person\/01c10d94f3648654ef706d5e6305f69c"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/#primaryimage","url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/3ebb791e\/image_thumb.png","contentUrl":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-content\/uploads\/windowslivewriter\/anxeventaday17of31alookathowbackupsworka\/3ebb791e\/image_thumb.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/an-xevent-a-day-17-of-31-a-look-at-backup-internals-and-how-to-track-backup-and-restore-throughput-part-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/"},{"@type":"ListItem","position":2,"name":"Extended Events","item":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/category\/extended-events\/"},{"@type":"ListItem","position":3,"name":"An XEvent a Day (17 of 31) \u2013 A Look at Backup Internals and How to Track Backup and Restore Throughput (Part 1)"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/","name":"Jonathan Kehayias - The Rambling DBA","description":"The Rambling DBA","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/#\/schema\/person\/01c10d94f3648654ef706d5e6305f69c","name":"Jonathan Kehayias","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/86630e27f5deecc5c393ea57fc7c3b6a068949f4fd6b5309f81de5a276f12855?s=96&d=mm&r=g","caption":"Jonathan Kehayias"},"sameAs":["http:\/\/3.209.169.194\/blogs\/jonathan"]}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/posts\/547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/comments?post=547"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/posts\/547\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/media?parent=547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/categories?post=547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/jonathan\/wp-json\/wp\/v2\/tags?post=547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}