<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>SQL Server Support Blog articles</title>
    <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/bg-p/SQLServerSupport</link>
    <description>SQL Server Support Blog articles</description>
    <pubDate>Tue, 05 May 2026 02:57:28 GMT</pubDate>
    <dc:creator>SQLServerSupport</dc:creator>
    <dc:date>2026-05-05T02:57:28Z</dc:date>
    <item>
      <title>Caution When Using a Database in Single User Mode</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/caution-when-using-a-database-in-single-user-mode/ba-p/4504699</link>
      <description>&lt;P&gt;By setting a database to single-user mode in SQL Server, you can make it accessible to only one user.If there is a session using a database set to single-user mode, any other session attempting to access the database will be put in a state of waiting to acquire an exclusive lock.&lt;BR /&gt;&lt;BR /&gt;Given this behavior, caution is needed when performing operations that acquire locks on the database from the session that set it to single-user mode.&lt;BR /&gt;After setting single-user mode, the session holds a shared lock on the database. If, within that session, you attempt to acquire an exclusive lock on the database while another session is already waiting to acquire an exclusive lock, a deadlock may occur, causing one of the operations to fail.&lt;BR /&gt;&lt;BR /&gt;For example, when using the log shipping feature with the secondary in standby mode, this behavior can affect the restore job.&lt;BR /&gt;Here is a specific sequence of events:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&amp;nbsp;The log shipping restore job sets the database to single-user mode before performing the restore. At this time, it acquires an exclusive lock on the database.&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;The restore job transitions the exclusive lock on the database to a shared lock.&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;Another session attempts to access the database and waits to acquire an exclusive lock.&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;The restore job tries to acquire an exclusive lock to perform the restore, but is blocked by the session waiting for the exclusive lock, resulting in a deadlock.&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt;&amp;nbsp;If the restore job becomes the deadlock victim, it will fail with an error.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Normally, the time between steps 2 and 4 is very short, but in environments where there is frequent access to the database, this issue is more likely to occur. Even if the restore job fails with an error, the next time the job runs, it will also restore the transaction log backups that failed previously. Therefore, it is recommended to check for any impact according to the service level of your system.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(The following content is in Japanese)&lt;/P&gt;
&lt;P&gt;SQL Server ではデータベースをシングルユーザーモードに設定することで、そのデータベースを 1 ユーザーでのみアクセス可能な状態にすることが出来ます。シングルユーザーモードに設定したデータベースを使用中のセッションがある場合、それ以外のセッションでそのデータベースにアクセスしようとすると、排他ロックの獲得待ちの状態になります。&lt;BR /&gt;この動作を前提として、シングルユーザーモードを設定したセッションでデータベースに対してロックを獲得する操作を行なう場合は注意が必要です。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;シングルユーザーモードに設定した後、そのセッションはデータベースに対して共有ロックを保持します。そのセッション内でデータベースへの排他ロックを獲得しようとする処理を実行する際に、既に他のセッションがアクセスしようとして排他ロックの獲得待ちとなっていた場合、デッドロックとなり、いずれかの処理は失敗する場合があります。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;例えば、ログ配布機能でセカンダリをスタンバイモードで使用していると、復元ジョブでこの動作の影響を受ける場合があります。&lt;/P&gt;
&lt;P&gt;以下に具体的な流れを紹介します。&lt;/P&gt;
&lt;P&gt;1) ログ配布の復元ジョブは復元を実行する前にデータベースをシングルユーザーモードに設定します。この時データベースに対して排他ロックを獲得します。&lt;/P&gt;
&lt;P&gt;2) 復元ジョブはデータベースに対する排他ロックを共有ロックに移行します。&lt;/P&gt;
&lt;P&gt;3) 他のセッションがデータベースにアクセスしようとして排他ロックの獲得待ち状態になります。&lt;/P&gt;
&lt;P&gt;4) 復元ジョブが復元を行うためにデータベースに排他ロックを獲得しようとしますが、排他ロック獲得待ちとなっているセッションにブロックされ、デッドロックが発生します。&lt;/P&gt;
&lt;P&gt;5) 復元ジョブがデッドロックの Victim となった場合、復元ジョブはエラーとなります。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;通常、2) と 4) の間は非常に短時間ですが、対象のデータベースに対して頻繁にアクセスが発生する環境ではこのような現象が発生する可能性が高まります。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;なお、復元ジョブがエラーとなった場合でも、次のジョブ実行タイミングで前回失敗した分のトランザクションログバックアップも合わせて復元されます。&lt;/P&gt;
&lt;P&gt;そのため、利用システムのサービスレベルに応じて影響の有無を確認することをお勧めします。&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2026 01:33:54 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/caution-when-using-a-database-in-single-user-mode/ba-p/4504699</guid>
      <dc:creator>Yohei_Kawajiri</dc:creator>
      <dc:date>2026-03-24T01:33:54Z</dc:date>
    </item>
    <item>
      <title>Troubleshooting SQL Server Backup Failures to Azure Blob Storage</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/troubleshooting-sql-server-backup-failures-to-azure-blob-storage/ba-p/4485325</link>
      <description>&lt;P&gt;This document helps to Troubleshoot SQL Server Backup Failures to Azure Blob Storage.&lt;/P&gt;
&lt;P&gt;Backing up SQL Server databases directly to Azure Blob Storage using BACKUP TO URL is a common and recommended practice on Azure SQL Virtual Machines. However, we often encounter&amp;nbsp;&lt;STRONG&gt;backup failures&lt;/STRONG&gt; that are not caused by performance issues but by &lt;STRONG&gt;hard Azure Blob size limits&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;This article explains &lt;STRONG&gt;why SQL Server backups fail due to Page Blob or Block Blob limits&lt;/STRONG&gt;, how to recognize the symptoms, and the &lt;STRONG&gt;correct configuration patterns&lt;/STRONG&gt; to prevent these failures.&lt;/P&gt;
&lt;P&gt;This blog walks through the most frequent causes of backup failures and explains how to identify and resolve them.&lt;/P&gt;
&lt;H5&gt;&lt;U&gt;&lt;STRONG&gt;1. Backup Failures Due to Page Blob Size Limit (1 TB):-&lt;/STRONG&gt;&lt;/U&gt;&lt;/H5&gt;
&lt;P&gt;One of the most common causes of backup failure occurs when SQL Server writes backups to &lt;STRONG&gt;Page Blob–based storage&lt;/STRONG&gt; and the database size exceed &lt;STRONG&gt;1 TB&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;When this limit is reached, backups may fail with errors such as:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Operating system error 50 (The request is not supported)&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Why This Happens&lt;/EM&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Page Blobs have a &lt;STRONG&gt;hard 1‑TB size limit per file&lt;/STRONG&gt;.&lt;/LI&gt;
&lt;LI&gt;Older or legacy storage accounts may still default to Page Blob usage.&lt;/LI&gt;
&lt;LI&gt;Single‑file backups for large databases can easily exceed this limit.&lt;/LI&gt;
&lt;/UL&gt;
&lt;H6&gt;&lt;U&gt;&lt;STRONG&gt;Recommended Resolution&lt;/STRONG&gt;&lt;/U&gt; :-&amp;nbsp;&lt;/H6&gt;
&lt;P&gt;The most effective solution is to use &lt;STRONG&gt;Block Blob storage with striped backups&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Use a &lt;STRONG&gt;General Purpose v2 (GPv2)&lt;/STRONG&gt; storage account.&lt;/LI&gt;
&lt;LI&gt;Split the backup into &lt;STRONG&gt;multiple files (striping)&lt;/STRONG&gt; so that the workload is distributed.&lt;/LI&gt;
&lt;LI&gt;Enable compression to reduce backup size.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;One of the most common causes of backup failure occurs when SQL Server writes backups to &lt;STRONG&gt;Page Blob–based storage&lt;/STRONG&gt; and the database size exceeds &lt;STRONG&gt;1 TB&lt;/STRONG&gt;.&lt;/P&gt;
&lt;H5&gt;&lt;U&gt;&lt;STRONG&gt;2. Block Blob Limit Reached During Backup :-&lt;/STRONG&gt;&lt;/U&gt;&lt;/H5&gt;
&lt;P&gt;Even when using Block Blobs, backups may still fail if a &lt;STRONG&gt;single backup file becomes too large&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Symptoms :-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Backup starts successfully but fails midway.&lt;/LI&gt;
&lt;LI&gt;Errors indicating that the blob size limit has been exceeded.&lt;/LI&gt;
&lt;LI&gt;Backup files growing rapidly but stopping before completion.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Root Cause :-&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Block Blobs have a practical size limitation per file.&lt;/LI&gt;
&lt;LI&gt;Using a &lt;STRONG&gt;single backup file&lt;/STRONG&gt; for very large databases.&lt;/LI&gt;
&lt;LI&gt;Insufficient number of stripes for the database size.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Also tune performance parameters such as:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;MAXTRANSFERSIZE&lt;/LI&gt;
&lt;LI&gt;BUFFERCOUNT&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This reduces throttling and improves reliability during large backups.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Rule of Thumb for Backup Striping&lt;/STRONG&gt;&lt;/U&gt;:-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1 backup stripe ≈ 150–200 GB&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Database SizeRecommended Strategy&amp;lt; 200 GBSingle backup file200 GB – 1 TB2–4 striped backup files&amp;gt; 1 TB8–64 striped backup files&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;EM&gt;Example&lt;/EM&gt;&lt;/U&gt; :-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a&amp;nbsp;&lt;STRONG&gt;2 TB database&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;2 TB ÷ 200 GB ≈ 10 stripes&lt;/P&gt;
&lt;P&gt;Recommended: &lt;STRONG&gt;12 or 16 backup files&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;3.SAS Token and Stored Access Policy Issues:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Authentication problems are another frequent cause of failures when backing up to Azure Blob Storage.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Common issues&lt;/STRONG&gt;&lt;/U&gt; :&lt;/P&gt;
&lt;UL data-line="104"&gt;
&lt;LI data-line="104"&gt;SAS token begins with?&lt;/LI&gt;
&lt;LI data-line="105"&gt;SAS token is expired&lt;/LI&gt;
&lt;LI data-line="106"&gt;Required permissions are missing&lt;/LI&gt;
&lt;LI data-line="107"&gt;SAS is scoped to the wrong container or account&lt;/LI&gt;
&lt;LI data-line="108"&gt;Stored access policy was changed or deleted&lt;/LI&gt;
&lt;/UL&gt;
&lt;H6 data-line="110"&gt;&lt;U&gt;&lt;STRONG&gt;Required SAS Permissions :&lt;/STRONG&gt;&lt;/U&gt;&lt;/H6&gt;
&lt;UL data-line="112"&gt;
&lt;LI data-line="112"&gt;Read (r), Write (w), Create (c), List (l) — recommended&lt;/LI&gt;
&lt;/UL&gt;
&lt;UL data-line="116"&gt;
&lt;LI&gt;&lt;U&gt;&lt;STRONG&gt;Resolution :-&lt;/STRONG&gt;&lt;/U&gt;&lt;/LI&gt;
&lt;LI data-line="116"&gt;Regenerate the SAS token with correct permissions and scope&lt;/LI&gt;
&lt;LI data-line="117"&gt;Remove the leading? if present&lt;/LI&gt;
&lt;LI data-line="118"&gt;Recreate the SQL Server credential&lt;/LI&gt;
&lt;LI data-line="119"&gt;Test the SAS token using Azure Storage Explorer or CLI before retrying the backup&lt;/LI&gt;
&lt;/UL&gt;
&lt;H6&gt;&lt;U&gt;&lt;STRONG&gt;4. Operating System Error 50 – “The Request is Not Supported”:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/H6&gt;
&lt;P&gt;This error is often misleading but commonly appears during backup failures to Azure Blob Storage.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;What Triggers OS Error 50&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Page Blob exceeding the 1‑TB size limit.&lt;/LI&gt;
&lt;LI&gt;TLS 1.2 not enabled on older operating systems.&lt;/LI&gt;
&lt;LI&gt;Storage account firewall blocking access from the VM.&lt;/LI&gt;
&lt;LI&gt;Legacy SQL Server or OS versions lacking modern protocol support.&lt;/LI&gt;
&lt;LI&gt;&lt;U style="color: rgb(30, 30, 30);"&gt;&lt;STRONG&gt;Key Checks&lt;/STRONG&gt;&lt;/U&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;Confirm SQL Server version (SQL Server 2016 or later recommended).&lt;/LI&gt;
&lt;LI&gt;Ensure &lt;STRONG&gt;TLS 1.2&lt;/STRONG&gt; is enabled.&lt;/LI&gt;
&lt;LI&gt;Verify outbound access to Azure Blob Storage on port 443.&lt;/LI&gt;
&lt;LI&gt;Confirm the storage firewall allows the VM network or enables “Trusted Microsoft services”.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;In many cases, switching to &lt;STRONG&gt;Block Blob + striped backups&lt;/STRONG&gt; immediately resolves this error&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;SQL Server Backup Failure Troubleshooting Flowchart &lt;/STRONG&gt;&lt;/U&gt;:&lt;/P&gt;
&lt;P&gt;This flowchart outlines the step‑by‑step diagnostic path for identifying and resolving SQL Server backup failures.&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Other errors and resolutions&lt;/STRONG&gt;&lt;/U&gt;:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below flowchart represents troubleshooting process for various types of errors while performing backup.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Authors&lt;/STRONG&gt;&lt;/U&gt;:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sara Tabassum ( &lt;EM&gt;v-sanone@microsoft.com&lt;/EM&gt;)&lt;/P&gt;
&lt;P&gt;Vinay Prasanna Sarangam ( v&lt;EM&gt;inay.sarangam@microsoft.com&lt;/EM&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2026 14:47:42 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/troubleshooting-sql-server-backup-failures-to-azure-blob-storage/ba-p/4485325</guid>
      <dc:creator>v-sanone</dc:creator>
      <dc:date>2026-03-18T14:47:42Z</dc:date>
    </item>
    <item>
      <title>Troubleshooting Replication Performance Issues</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/troubleshooting-replication-performance-issues/ba-p/4472766</link>
      <description>&lt;P&gt;This Document helps to troubleshoot or Resolve Replication performance related issues.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Get information about “Topology Big Picture”:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Before you dive into solving any issue, you need to fully understand the type of environment you have as there might have been changes you are unaware of. An easy way to do that is to run &lt;A href="https://github.com/ReplTalk/ReplScripts/blob/master/Replication%20Topology%20Script.sql" target="_blank" rel="noopener"&gt;ReplScripts/Replication Topology Script.sql at master · ReplTalk/ReplScripts&lt;/A&gt;&amp;nbsp;which gives output like below.&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;Review the output for details about publishers, publications, and subscriptions.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;1. Check for replication issues using tracer tokens:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Purpose of tracer tokens:-&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Latency measurement:-&lt;/STRONG&gt; Measure the time it takes for data to travel from the publisher → distributor → subscriber.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Connection validation:-&lt;/STRONG&gt; Validate whether replication connections between components are functioning correctly.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Troubleshooting:&lt;/STRONG&gt; Identify bottlenecks or delays in the replication process.&lt;/P&gt;
&lt;P&gt;Using &lt;A href="https://learn.microsoft.com/en-us/sql/relational-databases/replication/monitor/measure-latency-and-validate-connections-for-transactional-replication?view=sql-server-ver15#to-insert-a-tracer-token-and-view-information-on-the-token" target="_blank" rel="noopener"&gt;Measure latency &amp;amp; validate connections (Transactional) - SQL Server | Microsoft Learn&lt;/A&gt;, We can identify whether the issue is from Publisher to Distributor or Distributor to Subscriber.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below image says how data flows from Publisher to Subscriber through Distributor After applying initial Snapshot.&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;As mentioned in the below image&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;If the latency is in between publisher -&amp;gt; Distributor then the issue might be in either&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; - LogReader-Reader Thread&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; - LogReader-Writer Thread&lt;/P&gt;
&lt;OL start="2"&gt;
&lt;LI&gt;If the latency is in between Distributor -&amp;gt; Subscriber then the issue might be in either&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; - Distribution-Reader Thread&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; - Distribution-Writer Thread&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;2. Performance Statistics Tools:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Performance statistics were added to the mslogreader_history table and the msdistribution_history table on the distribution database in Microsoft SQL Server. You can use these statistics to see the recent performance history of the Replication Log Reader and Replication Distribution agents.&lt;/P&gt;
&lt;P&gt;Every five minutes, the performance statistics for the Log Reader and Distribution agents are recorded in the history tables. By default, only the data for the last 48 hours is retained. A cleanup process removes the data that is older than 48 hours. The default value can be changed by executing the sp_changedistributiondb stored procedure and specifying a new value for the history_retention parameter.&lt;/P&gt;
&lt;P&gt;The following is a sample performance output from the history table for the Log Reader Agent:&lt;/P&gt;
&lt;P&gt;- &amp;nbsp; &amp;nbsp; &amp;lt;stats state="1" work="9" idle="295"&amp;gt; &amp;lt;reader fetch="8" wait="0"/&amp;gt; &amp;lt;writer write="9" wait="0"/&amp;gt; &amp;lt;sincelaststats elapsedtime="304" work="9" cmds="52596" cmdspersec="5753.000000"&amp;gt; &amp;lt;reader fetch="8" wait="0"/&amp;gt; &amp;lt;writer write="9" wait="0"/&amp;gt; &amp;lt;/sincelaststats&amp;gt; &amp;lt;/stats&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are three state events that can be recorded:&lt;/P&gt;
&lt;P&gt;Here’s the Markdown representation of your table:&lt;/P&gt;
&lt;DIV class="styles_lia-table-wrapper__h6Xo9 styles_table-responsive__MW0lN"&gt;&lt;table border="1" style="width: 100.032%; border-width: 1px;"&gt;&lt;colgroup&gt;&lt;col style="width: 15.1428%" /&gt;&lt;col style="width: 84.842%" /&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="lia-align-center"&gt;State&lt;/td&gt;&lt;td class="lia-align-center"&gt;Description&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="lia-align-center"&gt;1&lt;/td&gt;&lt;td&gt;Normal events that describe both the reader and writer thread performance&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="lia-align-center"&gt;2&lt;/td&gt;&lt;td&gt;Raised events that occur when an agent's reader thread waits longer than the agent's `-messageinterval` time. (By default, the time is 60 seconds.) If you notice State 2 events that are recorded for an agent, this indicates that the agent is taking a long time to write changes to the destination&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="lia-align-center"&gt;3&lt;/td&gt;&lt;td&gt;Raised events that are generated only by the Log Reader Agent when the writer thread waits longer than the `-messageinterval` time. If you notice State 3 events that are recorded for the Log Reader Agent, this indicates that the agent is taking a long time to scan the replicated changes from the transaction log&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.1. Log Reader Agent Reader Thread :-&lt;/STRONG&gt;&amp;nbsp;The following performance statistics demonstrate a situation in which there is latency in the replication topology and in which the bottleneck is the Log Reader Agent reader thread. The Log Reader Agent reader thread scans the published database transaction log for commands to deliver to the distribution database(&amp;lt;Distribution server&amp;gt;..MSlogreader_history.Comments)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;stats state="1" work="301" idle="0" &amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;reader fetch="278" wait="0"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;writer write="12" wait="288"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;sincelaststats elapsedtime="301" work="301" cmds="104500" cmdspersec="347.000000"&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;reader fetch="278" wait="0"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;writer write="12" wait="288"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/sincelaststats&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/stats&amp;gt;&lt;/P&gt;
&lt;P&gt;The sincelaststats writer wait statistic of 288 seconds appears high. This is the time that the writer thread waits for the reader thread to supply buffers to apply. The Log Reader Agent reader thread executes the sp_replcmds stored procedure. If you notice high writer wait threads in the Log Reader Agent performance statistics, you should investigate the performance of the Log Reader Agent execution against the publication server(Which means Logreader Agent Reader Thread) and database and then investigate the execution time of the sp_replcmds stored procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.2. Distribution Agent Reader Thread:-&lt;/STRONG&gt;The following performance statistics demonstrate a situation in which there is latency in the replication topology and in which the bottleneck is the Distribution Agent reader thread. This thread queries the distribution database (&amp;lt; Distribution server &amp;gt;..MSdistribution_history.Comments table) for commands to apply at the subscriber&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;stats state="1" work="14798" idle="2035"&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;reader fetch="14798" wait="193"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;writer write="12373" wait="9888"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;sincelaststats elapsedtime="424" work="415" cmds="296900" cmdspersec="713.000000"&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;reader fetch="415" wait="7"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;writer write="377" wait="212"/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/sincelaststats&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/stats&amp;gt;&lt;/P&gt;
&lt;P&gt;The sincelaststats writer wait time (212 seconds) appears high. This is the time that the writer thread waits for the reader thread to supply buffers that the writer thread can apply at the subscriber database. The Distribution Agent reader thread executes the sp_MSget_repl_commands stored procedure.&lt;/P&gt;
&lt;P&gt;If you notice high writer wait times in the Distribution Agent performance statistics, you should investigate the performance of the Distribution Agent execution against the distribution server and database. In particular, you should investigate the execution time of the sp_MSget_repl_commands stored procedure.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.3. Distribution Agent Writer Thread:-&lt;/STRONG&gt; The following performance statistics demonstrate a situation in which there is latency in the replication topology and in which the bottleneck is the Distribution Agent reader thread. This thread queries the distribution database (&amp;lt;&amp;nbsp;&lt;STRONG&gt;Distribution server&lt;/STRONG&gt; &amp;gt;..MSdistribution_history.Comments table) for commands to apply at the subscriber.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Notes:-&lt;/STRONG&gt;&lt;/U&gt; The state is 2, and the output is somewhat different from State 1 statistics. State 2 state data indicates that the reader thread had to wait longer than the Distribution Agent's configured&amp;nbsp;-messageinterval&amp;nbsp;value. By default, the&amp;nbsp;-messageinterval&amp;nbsp;value is&amp;nbsp;&lt;STRONG&gt;60&lt;/STRONG&gt; seconds.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;stats state="2" fetch="48" wait="384" cmds="1028" callstogetreplcmds="321"&amp;gt;&lt;BR /&gt;&amp;lt;sincelaststats elapsedtime="312" fetch="47" wait="284" cmds="1028" cmdspersec="3.000000"/&amp;gt;&lt;BR /&gt;&amp;lt;/stats&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the -messageinterval value is increased, you may again receive State 1 statistics that resemble the following:&lt;/P&gt;
&lt;P&gt;&amp;lt;stats state="1" work="1941" idle="0"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;reader fetch="717" wait="1225"/&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;writer write="1941" wait="134"/&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;sincelaststats elapsedtime="764" work="764" cmds="1170730" cmdspersec="1530.000000"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;reader fetch="258" wait="505"/&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;writer write="764" wait="50"/&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/sincelaststats&amp;gt;&lt;BR /&gt;&amp;lt;/stats&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Note:-&lt;/STRONG&gt;&lt;/U&gt; The sincelaststats fetch wait time of 505 seconds is very high.&lt;/P&gt;
&lt;P&gt;If you notice high reader wait times in the Distribution Agent performance statistics, you should investigate the performance of the Distribution Agent execution against the subscriber server and database. Use the profiler trace tool to investigate the performance of the execution of the replication stored procedures. Usually the stored procedures are named as follows:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;sp_MSupd_&amp;lt;&lt;STRONG&gt;ownertablename&lt;/STRONG&gt;&amp;gt;&lt;/LI&gt;
&lt;LI&gt;sp_MSins_&amp;lt;&lt;STRONG&gt;ownertablename&lt;/STRONG&gt;&amp;gt;&lt;/LI&gt;
&lt;LI&gt;sp_MSdel_&amp;lt;&lt;STRONG&gt;ownertablename&lt;/STRONG&gt;&amp;gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Additionally, to determine whether the bottleneck is hardware-based or system-based, use the performance monitor to monitor system performance. For example, use the performance monitor to monitor the Physical Disk counters.&lt;/P&gt;
&lt;P&gt;Kindly refer below link to know more about Replication Performance Tools: &lt;A href="https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/replication/performance-statistics-log-reader-distribution-agents" target="_blank" rel="noopener"&gt;Statistics for Log Reader and Distribution agents - SQL Server | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In some scenarios, we will not be able to get the required information from above mentioned history tables. In such scenarios we need to generate Replication &lt;U&gt;&lt;STRONG&gt;Verbose Logs&lt;/STRONG&gt;&lt;/U&gt; as mentioned in the link: https://learn.microsoft.com/en-us/sql/relational-databases/replication/troubleshoot-tran-repl-errors?view=sql-server-ver17#enable-verbose-logging-on-any-agent&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;3. Other Issues and Resolutions:-&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Issue1:-&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;In the environment where we have many publications some are moving forward and some are not moving forward, some are moving slowly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Observations1:-&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;From the distributor verbose log, we observe the following error message: “2025-03-05 12:54:20.538 The concurrent snapshot for publication '&amp;lt;PublicationName&amp;gt;' is not available because it has not been fully generated or the Log Reader Agent is not running to activate it. If generation of the concurrent snapshot was interrupted”&lt;/LI&gt;
&lt;LI&gt;This is coming from the procedure “sys.sp_MSsubscription_status”. This happens because the status of the subscription 3 ("initiated") and the sync_type is automatic. The log reader must read when the snapshot agent started and ended from the log, after this, it will then update the MSsubscription table.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Resolution1:-&lt;/EM&gt;&lt;/STRONG&gt;The problem was there is a large volume of data for the log reader to process. It must be allowed to move forward and read through the log to completion after waiting some time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Issue 2:-&lt;/EM&gt;&lt;/STRONG&gt; In transactional replication to replicate data to a client's Azure SQL VM in their Tenant/Subscription. The data is slow to complete it's push during peak times.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Observations 2:-&lt;/STRONG&gt; &lt;/EM&gt;We cannot find an issue with our Distributor VM (This VM) and their VM doesn't have an apparant issue.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Resolution 2:-&lt;/STRONG&gt; &lt;/EM&gt;Root Cause here is you have two publications that are pushing large amounts of data during the late night. &amp;nbsp;One of these tables, on the Subscriber side, is very large. &amp;nbsp;Most of the space is taken up by indexes. &amp;nbsp;(More than 50%). It has roughly 13+ billion rows. When we push data to this table and other large tables it is causing excessive reads, causing multi-threading and is resulting in the latency which won't allow the Distributor to apply the transactions in a timely fashion.&amp;nbsp;&lt;BR /&gt;-- Removing Duplicate or unused Indexes&lt;/P&gt;
&lt;P&gt;-- Archiving Data&lt;/P&gt;
&lt;P&gt;-- Index Rebuild&lt;/P&gt;
&lt;P&gt;-- Creating Missing Indexes&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-- Updating Statistics&lt;/P&gt;
&lt;P&gt;-- Table Partition&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Issue 3:-&lt;/STRONG&gt; Lag from the Pub/Dist to the Subscribers.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Observations 3:-&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;--&amp;gt; In SQL Server error log, there is a SQL service reboot. Distribution database taking long time to do recovery, after that seems the jobs start to have query timeout&lt;/P&gt;
&lt;P&gt;--&amp;gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt;During the troubleshooting, we noticed blocking issues. And we confirmed the block header was the Log Reader agent session. The log reader agent session was not stuck or hung. It’s just because it’s handling a huge transaction and it was taking that long time. And caused the blocking.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Resolutions 3:- &lt;/STRONG&gt;Below mentioned agent profile properties are modified and executed update statistics, which helped improve the Log Reader agent performance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- MaxCmdsInTran 10000 ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- ReadBatchSize 5000 ,&lt;/P&gt;
&lt;P&gt;-LogScanTreshhold = 750000&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Issue 4:&lt;/EM&gt;&lt;EM&gt;-&lt;/EM&gt;&lt;/STRONG&gt; Merge job is continuously running, and we see blow message in replication monitor "Waiting 60 Second(s) Before Polling For Further Changes."&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Resolutions 4:-&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp; We &lt;SPAN style="color: rgb(30, 30, 30);"&gt;reproduced the same issue in the internal lab and confirmed that using the parameter – Continuous display this message. ( if this parameter is added agent never stops and continuously checks for changes)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;EM&gt;-Continuous:-&lt;/EM&gt;&lt;/U&gt;Specifies whether the agent attempts to poll replicated transactions continually. If specified, the agent polls replicated transactions from the source at polling intervals, even if there are no transactions pending.&lt;/P&gt;
&lt;P&gt;Reference : &lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Freplication%2Fagents%2Freplication-merge-agent%3Fview%3Dsql-server-ver16%23arguments&amp;amp;data=05%7C02%7Csupportmail2%40microsoft.com%7Cd51a5e212ef34aa6251a08dd62349d8b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638774700376333384%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&amp;amp;sdata=uHw7iUBBM8P5qV%2Fk8hf4Z6DXjvnEz7OmbjRUT%2B%2FvfH4%3D&amp;amp;reserved=0" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/sql/relational-databases/replication/agents/replication-merge-agent?view=sql-server-ver16#arguments&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;--&amp;gt; After removing this parameter, we did not receive the message&lt;/P&gt;
&lt;P&gt;--&amp;gt; Additionally, we need to use&lt;SPAN style="color: rgb(30, 30, 30);"&gt; – QueryTimeout parameter , so that we can keep a tab on the long running queries.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;-&lt;STRONG&gt;QueryTimeOut&lt;/STRONG&gt;&amp;nbsp;query_time_out_seconds&lt;/P&gt;
&lt;P&gt;Is the number of seconds before the query times out. The default is 300 seconds. The Merge Agent also uses the value of &lt;STRONG&gt;QueryTimeout&lt;/STRONG&gt; to determine how long to wait for generation of a partitioned snapshot when this value is greater than 1800.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Issue 5:-&lt;/EM&gt;&lt;/STRONG&gt; Data Replication is taking huge time&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Observations&lt;/EM&gt; 5:-&lt;/STRONG&gt; We observed below observations that&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;VM has been constantly at 100% of its overall disk bandwidth during the last 24 hours prior to data collection&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;Data Limit: This VM has a data limit of 256 MBps. The server has multiple P30s capable of reaching 200 MB of throughput. Regardless of whether stripes are used, the disks are limited to the VM's maximum capacity.&lt;/LI&gt;
&lt;LI&gt;Lazy Writes Per Second: Ideally, the value for Lazy Writes Per Second should be close to zero.&lt;/LI&gt;
&lt;LI&gt;Page Life Expectancy (PLE): A higher PLE indicates better performance, as it means pages stay longer in the buffer pool (memory cache). This reduces the need to read data from the hard drive. Currently, the PLE value is very low.&lt;/LI&gt;
&lt;LI&gt;Head Blockers: There are a significant number of blockings, mostly involving the cleanup job. The log reader agent was the head blocker in two instances, with an average duration of under 20 seconds.&lt;/LI&gt;
&lt;LI&gt;Log Reader Agent: The log reader agent appears to be blocking some index operation jobs. It has an inactive status with open transactions due to continuous mode.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Large Batches of Transactions: When the Log Reader Agent processes a large number of commands or transactions, it can lead to delays in the replication process, potentially causing blocking as other processes wait for the agent to complete its work. The Log Reader Agent can cause blocking issues in SQL Server transactional replication primarily due to large batches of replicated transactions or a high percentage of non-replicated transactions within the transaction log, leading to increased latency and resource contention.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;High Percentage of Non-Replicated Transactions: If a significant portion of the transaction log contains transactions that are not marked for replication, the Log Reader Agent needs to scan over these transactions, resulting in increased latency and potentially causing blocking.&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Resource Constraints: If the server has insufficient resources (CPU, memory, disk I/O), the Log Reader Agent might be delayed, leading to blocking issues.&lt;/P&gt;
&lt;P&gt;as previously discussed, the last two options above are the likelihood for the blocking.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Resolution 5:-&lt;/EM&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;ETL Operation/to or from non-replicated:-&lt;/STRONG&gt; As previously discussed, my top recommendation is to reach out to the Dev team to see if they can move their ETL operation to another database without replication. If a significant portion of the transaction log contains transactions that are not marked for replication, the Log Reader Agent needs to scan over these transactions, resulting in increased latency and potentially causing blocking.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Adjust ReadBatchSize:-&lt;/STRONG&gt; Another option to reduce blocking might be to adjust the ReadBatchSize parameter. Although we have done this in the past, it is worth experimenting with different values until we find the optimal setting. Please note that a higher value might not always improve performance, especially for workloads with large transactions.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Upgrade VM SKU:-&lt;/STRONG&gt; This server is constantly reaching its capacity. I recommend upgrading the VM SKU to better meet your workload capacity.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Blocking Concerns:-&lt;/STRONG&gt; If blocking is the main concern, another option is to create a separate job that checks for blocking. If the log reader agent is identified as the head blocker, the job can restart the log reader agent as shown below.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Issue 6:-&lt;/STRONG&gt;&lt;/EM&gt; Replication Performance Issues&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Resolution 6:-&lt;/STRONG&gt;&lt;/EM&gt; We found that the SQL Server and disk configuration is not configured as per best practices. After following best practices from Disk and SQL Configuration perspective. Issue got resolved. Kindly refer the below link for your reference: &lt;A href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/performance-guidelines-best-practices-checklist?view=azuresql" target="_blank" rel="noopener"&gt;Checklist: Best practices &amp;amp; guidelines - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Issue 7:-&lt;/STRONG&gt;&lt;/EM&gt; Log reader agent delay&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Observations 7:-&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;After restarting log reader agent, it starts working again.&lt;/LI&gt;
&lt;LI&gt;We switched the -ReadBatchSize between 500 and 5000 and compare the performance, now keep using 500 for log processing.&lt;/LI&gt;
&lt;LI&gt;From log reader agent history, the transaction log is processing but there is much pending log. The processing seems to be slow. From the log reader agent history, get below statistics information.&lt;BR /&gt;Basically, In the publisher server, the logread process has a reader thread connecting to the publisher database to run SP_REPLCMDS. In the distributor server, the logread process has a writer thread connecting to the distribution database to write commands into distribution distribution.dbo.sp_MSadd_replcmds. The data reading from the publisher database should write to distribution. From below, we can see the ‘reader fetch’ is 2940s with 1s wait, which means the reader thread fetched data for 2940s and wait 1s in last calculating period. And the writer thread writing 99s with 2439s waiting. &lt;BR /&gt;&lt;BR /&gt;&amp;lt;stats state="1" work="2539" idle="0" &amp;gt;&amp;lt;reader fetch="2940" wait="1"/&amp;gt;&amp;lt;writer write="99" wait="2439"/&amp;gt;&amp;lt;sincelaststats elapsedtime="526" work="526" cmds="407220" cmdspersec="772.000000"&amp;gt;&amp;lt;reader fetch="526" wait="0"/&amp;gt;&amp;lt;writer write="13" wait="513"/&amp;gt;&amp;lt;/sincelaststats&amp;gt;&amp;lt;message&amp;gt;Normal events that describe both the reader and writer thread performance.&amp;lt;/message&amp;gt;&amp;lt;/stats&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Here the writer thread long wait is actually waiting for data buffer reading in, so the slowness is in reading data stage.&lt;/LI&gt;
&lt;LI&gt;Based on VM disk performance checking, LUN's which belongs to log file do not have latency&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;In log reader agent history, we noticed many messages like ‘Approximately xxx log records have been scanned in pass xx, 0 of which were marked for replication.’ These messages mean the log records scanned are not for replication so they are skipped. If there are too many unrelated log records , log reader agent will cost much time on scanning unrelated logs which will slow down the replication transaction sync.&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;There was authentication issue on log reader agent yesterday which blocks the log syncing for long time, so today after resuming it accumulates large number of transactions. The large pending set also need time to consume.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Resolution 7:- &lt;/STRONG&gt;&lt;/EM&gt;There is no disk latency on log drive, the log reader agent slowness is mainly due to too many non-replication transactions and large number of accumulating batches. Best practices to follow in this scenario is&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Shrink log file before configuring replication&lt;/LI&gt;
&lt;LI&gt;Configure Replication in off-peak hours&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;4. Enhance Transaction Replication performance:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;1. Design Level:-&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;STRONG&gt;a. Database Design:-&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Minimize transaction size in your application design.&lt;/LI&gt;
&lt;LI&gt;By default, transactional replication propagates changes according to transaction boundaries. If transactions are smaller, the Distribution agent is less likely to resend a transaction due to network issues. If the agent is required to resend a transaction, the amount of data sent is smaller.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &lt;STRONG&gt;b. Distributor Configuration:-&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Configure the Distributor on a dedicated server.&lt;/LI&gt;
&lt;LI&gt;You can reduce processing overhead on the Publisher by configuring a remote Distributor. For more information, see&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/sql/relational-databases/replication/configure-distribution?view=sql-server-ver15" target="_blank" rel="noopener" data-linktype="relative-path"&gt;Configure Distribution&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Size the distribution database appropriately.&lt;/LI&gt;
&lt;LI&gt;Test replication with a typical load for your system to determine how much space is required to store commands. Ensure the database is large enough to store commands without having to auto-grow frequently. For more information about changing the size of a database, see&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql?view=sql-server-ver15" target="_blank" rel="noopener" data-linktype="relative-path"&gt;ALTER DATABASE (Transact-SQL)&lt;/A&gt;.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &lt;STRONG&gt;c. Publication Design:-&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Replicate stored procedure execution when making batch updates to published tables.&lt;/LI&gt;
&lt;LI&gt;If you have batch updates that occasionally affect a large number of rows at the Subscriber, you should consider updating the published table using a stored procedure and publish the execution of the stored procedure. Instead of sending an update or delete for every row affected, the Distribution Agent executes the same procedure at the Subscriber with the same parameter values. For more information, see&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/sql/relational-databases/replication/transactional/publishing-stored-procedure-execution-in-transactional-replication?view=sql-server-ver15" target="_blank" rel="noopener" data-linktype="relative-path"&gt;Publishing Stored Procedure Execution in Transactional Replication&lt;/A&gt;.&lt;/LI&gt;
&lt;LI&gt;Spread articles across multiple publications.&lt;/LI&gt;
&lt;LI&gt;If you cannot use the&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/sql/relational-databases/replication/administration/enhance-transactional-replication-performance?view=sql-server-ver15#subscriptionstreams" target="_blank" rel="noopener" data-linktype="self-bookmark"&gt;&lt;STRONG&gt;-SubscriptionStreams&lt;/STRONG&gt;&amp;nbsp;parameter&lt;/A&gt;, consider creating multiple publications. Spreading articles across these publications allows replication to apply changes in parallel to Subscribers.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &lt;STRONG&gt;d. Subscription Considerations:-&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Use independent agents rather than shared agents if you have multiple publications on the same Publisher (this is the default for the New Publication Wizard).&lt;/LI&gt;
&lt;LI&gt;Run agents continuously instead of on frequent schedules.
&lt;UL&gt;
&lt;LI&gt;SQL Server Management Studio:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/sql/relational-databases/replication/specify-synchronization-schedules?view=sql-server-ver15" target="_blank" rel="noopener" data-linktype="relative-path"&gt;Specify Synchronization Schedules&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;Setting the agents to run continuously rather than creating frequent schedules (such as every minute) improves replication performance, because the agent does not have to start and stop. When you set the Distribution Agent to run continuously, changes are propagated with low latency to the other servers that are connected in the topology. For more information, see:&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;2. Agent Properties Level&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &lt;STRONG&gt;a. Log Reader Agent:-&lt;/STRONG&gt; &amp;nbsp; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;U&gt;&lt;STRONG&gt;ReadBatchSize:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Increase the value of the&amp;nbsp;&lt;STRONG&gt;-ReadBatchSize&lt;/STRONG&gt; parameter for the Log Reader Agent.&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Description:-&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;The Log Reader Agent and Distribution Agent support batch sizes for transaction read and commit operations. Batch sizes default to 500 transactions. The Log Reader Agent reads the specific number of transactions from the log, whether or not they are marked for replication. When a large number of transactions are written to a publication database, but only a small subset of those are marked for replication, you should use the&amp;nbsp;&lt;STRONG style="color: rgb(30, 30, 30);"&gt;-ReadBatchSize&lt;/STRONG&gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt;&amp;nbsp;parameter to increase the read batch size of the Log Reader Agent. This parameter does not apply to Oracle Publishers.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;Workloads of smaller transactions (fewer than 500 commands) see an increase in how many commands are processed per second when&amp;nbsp;&lt;STRONG&gt;ReadBatchSize&lt;/STRONG&gt;&amp;nbsp;is increased up to 5000.&lt;/LI&gt;
&lt;LI&gt;For larger workloads (transactions with 500 to 1000 commands), increasing&amp;nbsp;&lt;STRONG&gt;ReadBatchSize&lt;/STRONG&gt;&amp;nbsp;has little performance improvement. Increasing&amp;nbsp;&lt;STRONG&gt;ReadBatchSize&lt;/STRONG&gt; results in a greater number of transactions written to the distribution database in one roundtrip. This increases the time transactions and commands are visible to the Distribution Agent and introduces latency to the replication process.&amp;nbsp; &amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &lt;/STRONG&gt;&lt;U&gt;&lt;STRONG&gt;PollingInterval:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Decrease the value of the&amp;nbsp;&lt;STRONG&gt;-PollingInterval&lt;/STRONG&gt; parameter for the Log Reader Agent.&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Description:-&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;The&amp;nbsp;&lt;STRONG style="color: rgb(30, 30, 30);"&gt;-PollingInterval&lt;/STRONG&gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt;&amp;nbsp;parameter specifies how often the transaction log of a published database is queried for transactions to replicate. The default is 5 seconds. If you decrease this value, the log is polled more frequently, which can result in lower latency for the delivery of transactions from the publication database to the distribution database. However, you should balance the need for lower latency against the increased load on the server from polling more frequently.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &lt;/STRONG&gt;&lt;U&gt;&lt;STRONG&gt;MaxCmdsInTran:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;To resolve accidental, one-time bottlenecks use the&amp;nbsp;&lt;STRONG&gt;–MaxCmdsInTran&lt;/STRONG&gt; parameter for the Log Reader Agent.&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Description:-&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;The&amp;nbsp;&lt;STRONG style="color: rgb(30, 30, 30);"&gt;–MaxCmdsInTran&lt;/STRONG&gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt;&amp;nbsp;parameter specifies the maximum number of statements grouped into a transaction as the Log Reader writes commands to the distribution database. Using this parameter allows the Log Reader Agent and Distribution Agent to divide large transactions (consisting of many commands) at the Publisher into several smaller transactions when applying commands at the Subscriber. Specifying this parameter can reduce contention at the Distributor and reduce latency between the Publisher and Subscriber. Because the original transaction is applied in smaller units, the Subscriber can access rows of a large logical Publisher transaction prior to the end of the original transaction, breaking strict transactional atomicity. The default is&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="color: rgb(30, 30, 30);"&gt;0&lt;/STRONG&gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt;, which preserves the transaction boundaries of the Publisher. This parameter does not apply to Oracle Publishers.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;U&gt;Note:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt;&lt;STRONG&gt;MaxCmdsInTran&lt;/STRONG&gt; was not designed to be always turned on. It exists to work around cases where someone accidentally performed a large number of DML operations in a single transaction (causing a delay in the distribution of commands until the entire transaction is in the distribution database, locks being held, etc.). If you routinely fall into this situation,review your applications and find ways to reduce the transaction size.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt;&lt;STRONG&gt;MaxCmdsInTran&lt;/STRONG&gt;&amp;nbsp;is not supported if the given publication database is enabled for both Change Data Capture and replication. Using&amp;nbsp;&lt;STRONG&gt;MaxCmdsInTran&lt;/STRONG&gt;&amp;nbsp;in this configuration may lead to data loss in CDC change tables. It may also cause PK errors if the&amp;nbsp;&lt;STRONG&gt;MaxCmdsInTran&lt;/STRONG&gt; parameter is added and removed while replicating a large Transaction.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &lt;STRONG&gt;b. Distributor Agent:-&lt;/STRONG&gt; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &lt;/STRONG&gt;&lt;U&gt;&lt;STRONG&gt;SubscriptionStreams:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Increase the&amp;nbsp;&lt;STRONG&gt;–SubscriptionStreams&lt;/STRONG&gt;&amp;nbsp;parameter for the Distribution Agent.&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Description:-&lt;/STRONG&gt;&lt;/EM&gt;The&amp;nbsp;&lt;STRONG style="color: rgb(30, 30, 30);"&gt;–SubscriptionStreams&lt;/STRONG&gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt; parameter can greatly improve aggregate replication throughput. It allows multiple connections to a Subscriber to apply batches of changes in parallel, while maintaining many of the transactional characteristics present when using a single thread. If one of the connections fails to execute or commit, all connections will abort the current batch, and the agent will use a single stream to retry the failed batches. Before this retry phase completes, there can be temporary transactional inconsistencies at the Subscriber. After the failed batches are successfully committed, the Subscriber is brought back to a state of transactional consistency.&lt;BR /&gt;&lt;/SPAN&gt;A value for this agent parameter can be specified using the&amp;nbsp;@subscriptionstreams&amp;nbsp;of&amp;nbsp;&lt;A style="font-style: normal; font-weight: 400; background-color: rgb(255, 255, 255);" href="https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-addsubscription-transact-sql?view=sql-server-ver15" data-linktype="relative-path" target="_blank"&gt;sp_addsubscription (Transact-SQL)&lt;/A&gt;&lt;SPAN style="color: rgb(30, 30, 30);"&gt;.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &lt;/STRONG&gt;&lt;U&gt;&lt;STRONG&gt;Blocking Monitor Thread:-&lt;BR /&gt;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Distribution Agent maintains a blocking monitor thread that detects blocking between sessions. If the blocking monitor thread detects blocking between the sessions, Distribution Agent switches to use one session to reapply the current batch of commands that could not be applied previously.&lt;/LI&gt;
&lt;LI&gt;The blocking monitor thread can detect blocking between Distribution Agent sessions. However, the blocking monitor thread cannot detect blocking in the following situations:&lt;/LI&gt;
&lt;/UL&gt;
&lt;OL&gt;
&lt;LI&gt;One of the sessions where blocking occurs is not a Distribution Agent session.&lt;/LI&gt;
&lt;LI&gt;A session deadlock freezes the activities of Distribution Agent.&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;In this situation, Distribution Agent coordinates all the sessions to commit together as soon as their commands are executed. A deadlock among the sessions occurs if the following conditions are true:&lt;/LI&gt;
&lt;/UL&gt;
&lt;OL&gt;
&lt;LI&gt;Blocking occurs between the Distribution Agent sessions and a session that is not a Distribution Agent session.&lt;/LI&gt;
&lt;LI&gt;Distribution Agent is waiting for all the sessions to complete executing their commands before Distribution Agent coordinates all the sessions to commit together.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &lt;/STRONG&gt;&lt;U&gt;&lt;STRONG&gt;CommitBatchSize:-&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Increase the value of the&amp;nbsp;&lt;STRONG&gt;-CommitBatchSize&lt;/STRONG&gt;&amp;nbsp;parameter for the Distribution Agent.&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Description:-&lt;BR /&gt;&lt;/STRONG&gt;&lt;/EM&gt;Committing a set of transactions has a fixed overhead; by committing a larger number of transactions less frequently, the overhead is spread across a larger volume of data. Increasing CommitBatchSize (up to 200) can improve performance as more transactions are committed to the subscriber. However, the benefit of increasing this parameter drops off as the cost of applying changes is gated by other factors, such as the maximum I/O of the disk that contains the log. Additionally, there is a trade-off to be considered: any failure that causes the Distribution Agent to start over must roll back and reapply a larger number of transactions. For unreliable networks, a lower value can result in fewer failures and a smaller number of transactions to roll back and reapply if a failure occurs.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Refer the below link for details:&amp;nbsp;&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/relational-databases/replication/administration/enhance-transactional-replication-performance?view=sql-server-ver15" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/sql/relational-databases/replication/administration/enhance-transactional-replication-performance?view=sql-server-ver15&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2025 23:10:34 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/troubleshooting-replication-performance-issues/ba-p/4472766</guid>
      <dc:creator>VinaySarangam</dc:creator>
      <dc:date>2025-12-12T23:10:34Z</dc:date>
    </item>
    <item>
      <title>SQL Server Database Corruption: Causes, Detection, and some details behind DBCC CHECKDB</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/sql-server-database-corruption-causes-detection-and-some-details/ba-p/4460631</link>
      <description>&lt;H2&gt;&lt;STRONG&gt;SQL Server Database Corruption: Causes, Detection, and some details behind DBCC CHECKDB&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;Database corruption in SQL Server is rare but usually &lt;STRONG&gt;high-impact&lt;/STRONG&gt;. When it occurs, it threatens &lt;STRONG&gt;ACID compliance - &lt;/STRONG&gt;the foundation of transactional integrity - and can lead to downtime, data loss, and operational risk. This article explores:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Common causes of corruption&lt;/LI&gt;
&lt;LI&gt;How DBCC CHECKDB works under the hood&lt;/LI&gt;
&lt;LI&gt;Performance tuning tips for running CHECKDB&lt;/LI&gt;
&lt;LI&gt;Sample error messages and what they mean&lt;/LI&gt;
&lt;LI&gt;Best practices for prevention and recovery&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Why ACID Matters in Corruption Scenarios&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Before diving into causes and detection, remember that SQL Server guarantees &lt;STRONG&gt;Atomicity, Consistency, Isolation, and Durability&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Atomicity&lt;/STRONG&gt;: Transactions are all-or-nothing. If any part fails, the whole transaction has to fail. Corruption can break this, leaving partial writes.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Consistency&lt;/STRONG&gt;: Every transaction moves the database from one valid state to another. Corruption violates this by possibly introducing invalid states.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Isolation&lt;/STRONG&gt;: Concurrent transactions shouldn’t interfere with each other. Corruption in shared pages can cause phantom reads or deadlocks.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Durability&lt;/STRONG&gt;: Once committed, data must persist, even in the event of system failure or crash. Disk-level corruption undermines durability guarantees.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;DBCC CHECKDB exists primarily to &lt;STRONG&gt;validate consistency and durability&lt;/STRONG&gt;, ensuring that the logical and physical structures adhere to ACID principles.&lt;/P&gt;
&lt;P&gt;In any internal decision-making that a database engine needs to do – ACID will be the main motivating factor, overriding concerns about performance, high availability or any other considerations. This is by design – ACID is the single most important principle that the engine cares about.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Common Causes of SQL Server Database Corruption&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Corruption usually originates &lt;STRONG&gt;outside of SQL Server&lt;/STRONG&gt;, often in the I/O path. Below I list the main causes, ordered in terms of probability - the higher on the list, the more probable it is:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Hardware Failures&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Disk errors, RAID controller cache issues, or faulty RAM can corrupt pages during writes.&lt;/LI&gt;
&lt;LI&gt;Even with write-ahead logging, if the physical medium fails, durability is compromised.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;I/O Subsystem Issues&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;SAN/NAS instability, outdated drivers, or virtualization misconfigurations can cause torn writes.&lt;/LI&gt;
&lt;LI&gt;SQL Server relies on the OS and storage stack for atomic page writes; instability breaks this assumption.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Improper Shutdowns&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Power loss during write operations can leave pages partially written, violating atomicity.&lt;/LI&gt;
&lt;LI&gt;Torn-page detection mitigates this, but only if checksums are enabled.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;OS or SQL Server Bugs&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Rare, but missing cumulative updates can expose edge cases in buffer pool or checkpoint logic.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;File System Misconfiguration&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Compressed/encrypted volumes or sector size mismatches can corrupt allocation maps in edge cases.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Human Error&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Manual deletion of MDF/LDF files or incorrect restore sequences can orphan pages in some unsupported scenarios.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Malware&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Ransomware or malicious scripts altering system tables can break referential integrity.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/UL&gt;
&lt;H4&gt;&lt;STRONG&gt;How DBCC CHECKDB Works Under the Hood&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;DBCC CHECKDB is SQL Server’s &lt;STRONG&gt;integrity verification tool&lt;/STRONG&gt;, validating both &lt;STRONG&gt;physical and logical consistency&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1. Snapshot Creation&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Creates a &lt;STRONG&gt;transactionally consistent snapshot&lt;/STRONG&gt; using sparse files (page changes that happen at runtime are tracked in the files to ensure consistency).&lt;/LI&gt;
&lt;LI&gt;Ensures checks run without blocking user activity, preserving isolation, unless WITH TABLOCK option is used to run on live database taking locks during execution.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;2. Phases of Execution&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; Allocation Checks&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Validates GAM, SGAM, and IAM pages for correct page allocation.&lt;/LI&gt;
&lt;LI&gt;Detects orphaned extents or double allocations.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;System Table Checks&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Verifies metadata in system catalogs like sysobjects and sysindexes.&lt;/LI&gt;
&lt;LI&gt;Ensures schema-level consistency.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Table and Index Structure Checks&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Traverses B-trees, validating key order and linkage.&lt;/LI&gt;
&lt;LI&gt;Detects broken pointers or incorrect page splits.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Page-Level Validation&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Reads every page, checks checksums or torn-page bits.&lt;/LI&gt;
&lt;LI&gt;Critical for durability verification.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LOB Checks&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Ensures integrity of large object chains in IAM and target pages (text, image, XML).&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Cross-Object Consistency&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Confirms referential integrity across tables and indexes.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;3. Error Reporting&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Errors include severity and repair recommendation:&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;REPAIR_REBUILD&lt;/STRONG&gt;: Non-destructive, fixes structural issues.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;REPAIR_ALLOW_DATA_LOSS&lt;/STRONG&gt;: Last resort, may delete corrupt pages – the integrity of the “repaired” database is not guaranteed when used.&lt;/LI&gt;
&lt;/UL&gt;
&lt;H4&gt;&lt;STRONG&gt;Performance Tuning Tips for DBCC CHECKDB&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;CHECKDB is &lt;STRONG&gt;I/O and CPU intensive&lt;/STRONG&gt;. Here are some options you can use to optimize its performance while running:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Use PHYSICAL_ONLY for Faster Checks&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;DBCC CHECKDB ('YourDatabase') WITH PHYSICAL_ONLY;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;UL&gt;
&lt;LI&gt;Skips logical checks, reducing load. This could be used for daily scans, assuming a full scan still happens, just more rarely.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Run on a Restored Copy&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Offload workload to a non-production server using recent backups.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Leverage Availability Groups&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Execute on a readable secondary replica to protect the primary node.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Control Parallelism&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;DBCC CHECKDB ('YourDatabase') WITH MAXDOP = 4;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;UL&gt;
&lt;LI&gt;Explicit MAXDOP ensures predictable performance. You can adjust the parallelism in accordance with available CPUs.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Schedule During Low Activity&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Avoid peak hours; combine with Resource Governor for throttling.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Break Down Large Databases&lt;/STRONG&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Use DBCC CHECKTABLE for individual large tables if full CHECKDB is too costly.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Sample Error Messages and Interpretation&lt;/STRONG&gt;&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Msg 824&lt;/STRONG&gt;&lt;BR /&gt;&lt;EM&gt;“SQL Server detected a logical consistency-based I/O error: incorrect checksum.”&lt;/EM&gt;&lt;BR /&gt;→ Page-level corruption, often disk-related.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Msg 8905&lt;/STRONG&gt;&lt;BR /&gt;&lt;EM&gt;“Extent (1:12345) in database ID 5 is marked allocated in GAM, but not in SGAM.”&lt;/EM&gt;&lt;BR /&gt;→ Allocation map inconsistency.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Msg 2533&lt;/STRONG&gt;&lt;BR /&gt;&lt;EM&gt;“Table error: Object ID 123456789, index ID 1. Page (1:98765) failed checksum.”&lt;/EM&gt;&lt;BR /&gt;→ Corruption in index or data page.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Msg 8928&lt;/STRONG&gt;&lt;BR /&gt;&lt;EM&gt;“Object ID 123456789, index ID 2: Page (1:54321) could not be processed.”&lt;/EM&gt;&lt;BR /&gt;→ Structural issues in index B-tree.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Apart from the errors above, we also sometimes see issues directly related to our use of sparse files when creating the snapshot:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The operating system returned error 665(The requested operation could not be completed due to a file system limitation) to SQL Server during a write at offset 0x00002a3ef96000 in file 'DBFile.mdf:MSSQL_DBCC18'&lt;/LI&gt;
&lt;LI&gt;The operating system returned error 1450 (Insufficient system resources exist to complete the requested service.) to SQL Server during a write at offset 0x00002a3ef96000 in file with handle 0x0000000000000D5C. This is usually a temporary condition and the SQL Server will keep retrying the operation. If the condition persists, then immediate action must be taken to correct it.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Those are directly caused by NTFS File Record Segment objects running out of space due to ATTRIBUTE_LIST_ENTRY list growing out of bounds, and not by CHECKDB command itself - for more details check the article &lt;A href="https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/database-file-operations/1450-and-665-errors-running-dbcc-checkdb" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/database-file-operations/1450-and-665-errors-running-dbcc-checkdb&lt;/A&gt;.&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Prevention and Recovery Best Practices&lt;/STRONG&gt;&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;Run &lt;STRONG&gt;DBCC CHECKDB weekly&lt;/STRONG&gt; either directly on the database or on restored backups. This makes sure that if corruption happens you have a recent last known good backup to restore from.&lt;/LI&gt;
&lt;LI&gt;Maintain verified backups with WITH CHECKSUM and regular restore tests. It’s very important to make sure a created backup can be fully restored to make sure there’s no unpleasant surprises if an issue happens.&lt;/LI&gt;
&lt;LI&gt;Use enterprise-grade hardware (RAID 10, ECC memory, UPS).&lt;/LI&gt;
&lt;LI&gt;Apply cumulative updates for SQL Server and Windows.&lt;/LI&gt;
&lt;LI&gt;Avoid unsupported storage configurations (compressed/deduplicated volumes).&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Key Takeaways&lt;/STRONG&gt;&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;Corruption is usually hardware or I/O related, not SQL Server bugs.&lt;/LI&gt;
&lt;LI&gt;DBCC CHECKDB is your first line of defence - schedule it regularly.&lt;/LI&gt;
&lt;LI&gt;Always restore from a clean backup if in any way possible; use repair options only as a last resort.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Critical Note on Repair Options&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;What triggered this blog was a number of issues we saw where the plan in case a database goes suspect was essentially to:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Switch database to emergency mode&lt;/LI&gt;
&lt;LI&gt;Switch to single user mode&lt;/LI&gt;
&lt;LI&gt;Run DBCC CHECKDB with REPAIR_ALLOW_DATA_LOSS options without any previous tests to check if a corruption is present&lt;/LI&gt;
&lt;LI&gt;Switching the database back to multi user and using it normally&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Note that a database can go suspect for multiple reasons, not all related to corruption – basically if we hit something that stops the recovery process and doesn’t allow us to finish. For example – a deadlock with the recovery thread causes the thread to be killed? Database goes to suspect mode. This plan is not the recommended approach - neither in corruption cases nor other reasons for suspect database.&lt;/P&gt;
&lt;P&gt;Using &lt;STRONG&gt;REPAIR_ALLOW_DATA_LOSS&lt;/STRONG&gt; can leave the database logically inconsistent. You always need to validate data post-repair and address root causes (hardware, OS issues) before attempting recovery. For detailed guidance, see &lt;A href="https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/database-file-operations/troubleshoot-dbcc-checkdb-errors" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/database-file-operations/troubleshoot-dbcc-checkdb-errors&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Note that the repair recommendation provided after running is the lowest level of repair that can address all errors reported by CHECKDB. However, “minimum” doesn’t mean it will fix everything it finds - some errors simply can’t be repaired. You might also need to run the repair process more than once, since removing some data might expose additional non-linked pages that themselves needs to be dropped as part of repair. Keep in mind that not every error requires this level of repair and using REPAIR_ALLOW_DATA_LOSS doesn’t always lead to data loss. The only way to know if fixing an error will cause data loss is to actually run the repair and &lt;STRONG&gt;verify the data afterwards&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;A helpful tip: You can use DBCC CHECKTABLE on any table that shows errors. This will tell you the minimum repair level needed for that specific table.&lt;/P&gt;
&lt;P&gt;It’s extremely important to remember that after running CHECKDB repair with data loss, &lt;STRONG&gt;you must manually validate your data&lt;/STRONG&gt;. The repair process doesn’t guarantee logical consistency. For example, REPAIR_ALLOW_DATA_LOSS might remove entire data pages with inconsistent data. If that happens, tables with foreign key relationships could end up with rows that no longer have matching parent keys.&lt;/P&gt;
&lt;P&gt;I hope this post was able to bring a bit of clarity to the complicated topic of corruption causes and recovery. It’s important to remember that once corruption happens your options are limited – you have to be prepared before the issue occurs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Further Reading&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-checkdb-transact-sql" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-checkdb-transact-sql&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/database-file-operations/troubleshoot-dbcc-checkdb-errors" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/database-file-operations/troubleshoot-dbcc-checkdb-errors&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/sql-server/failover-clusters/automatic-page-repair-availability-groups-database-mirroring?view=sql-server-ver17" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/sql/sql-server/failover-clusters/automatic-page-repair-availability-groups-database-mirroring?view=sql-server-ver17&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Oct 2025 10:55:57 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/sql-server-database-corruption-causes-detection-and-some-details/ba-p/4460631</guid>
      <dc:creator>MSFTPawelM</dc:creator>
      <dc:date>2025-10-10T10:55:57Z</dc:date>
    </item>
    <item>
      <title>How to Capture Running Queries in SQL Server</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/how-to-capture-running-queries-in-sql-server/ba-p/4454947</link>
      <description>&lt;P&gt;&lt;A class="lia-internal-link lia-internal-url lia-internal-url-content-type-blog" href="#community--1-community-4454947-toc-hId-910346146" target="_self" data-lia-auto-title="(本記事の最後に日本語でもご案内しております)" data-lia-auto-title-active="0"&gt;(本記事の最後に日本語でもご案内しております)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Sometimes, you need to check which queries are running in your SQL Server. If you want to understand what’s happening inside your SQL Server—such as diagnosing errors or slow performance—xEvents can be very helpful.&lt;/P&gt;
&lt;H4&gt;🔍 What is Extended Events (xEvents)?&lt;/H4&gt;
&lt;P&gt;Extended Events is a lightweight performance monitoring system built into SQL Server.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It helps you:&lt;BR /&gt;✅ Capture detailed information about queries, errors, and performance.&lt;BR /&gt;✅ Diagnose issues like slow queries or unexpected errors.&lt;BR /&gt;✅ Monitor safely with minimal overhead, compared to older tools like Profiler.&lt;/P&gt;
&lt;P&gt;Think of xEvents as a flight recorder for SQL Server: you start it, reproduce the issue, stop it, and then review what happened.&lt;/P&gt;
&lt;P&gt;You can find a step-by-step guide in the reference below.&lt;/P&gt;
&lt;P&gt;📖 Quickstart: Extended Events - SQL Server | Microsoft Learn&lt;BR /&gt;&lt;A class="lia-external-url" href="https://learn.microsoft.com/en-us/sql/relational-databases/extended-events/quick-start-extended-events-in-sql-server?view=sql-server-ver17" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/sql/relational-databases/extended-events/quick-start-extended-events-in-sql-server?view=sql-server-ver17&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In this blog, I am sharing a T-SQL script that I usually provide to customers for troubleshooting support cases.&lt;/P&gt;
&lt;H4&gt;🛠 Step-by-Step Instructions&lt;/H4&gt;
&lt;P&gt;The captured data will be saved as .xel files in the default SQL Server log folder (you can change this path if needed).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Step 1: Create the xEvent Session&lt;/STRONG&gt;&lt;BR /&gt;Run the T-SQL script below on the target instance using an account with sysadmin rights or sufficient privileges to create an xEvent session.&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;CREATE EVENT SESSION [XEventTmpl] ON SERVER

ADD EVENT sqlserver.attention (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.error_reported (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.rpc_completed (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.rpc_starting (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sp_statement_completed (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sp_statement_starting (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sql_batch_completed (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sql_batch_starting (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sql_statement_completed (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sql_statement_starting (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
)

ADD TARGET package0.event_file (
    SET filename = N'xeventtmpl.xel'
)

WITH (STARTUP_STATE = OFF);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;✅ Step 2: Start Collecting Events&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Run this command to start the xEvent session so it begins capturing data:&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;ALTER EVENT SESSION [XEventTmpl] ON SERVER STATE = START&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;What this does:&lt;/STRONG&gt; Turns on the session you created earlier.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;💡Tip: &lt;/STRONG&gt;To confirm it’s running status in SQL Server Management Studio (SSMS):&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Go to Management → Extended Events → Sessions&lt;/LI&gt;
&lt;LI&gt;Look for XEventTmpl in the list&lt;/LI&gt;
&lt;LI&gt;If it’s running, the icon will show a green arrow. If it’s stopped, it will show a red square.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;🔍 View the Results&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;To check the data you have collected with Extended Events in SQL Server Management Studio (SSMS):&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Go to Management → Extended Events → Sessions.&lt;/LI&gt;
&lt;LI&gt;Find and right-click on XEventTmpl.&lt;/LI&gt;
&lt;LI&gt;You can choose Watch Live Data to See the events as they happen, while the session is running.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Alternatively, you can use the following query to read the .xel files directly:&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;SELECT * FROM sys.fn_xe_file_target_read_file('xeventtmpl*.xel', NULL, NULL, NULL)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;👁️&amp;nbsp; What This Captures&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The xEvents session will collect the following types of activity:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;sql_batch_starting / sql_batch_completed:&lt;/STRONG&gt;&lt;BR /&gt;Records when an ad-hoc T-SQL batch starts and ends.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;rpc_starting / rpc_completed:&lt;/STRONG&gt;&lt;BR /&gt;Records when a remote procedure call (RPC), such as one from an application using sp_executesql, begins and finishes.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;sp_statement_starting / sp_statement_completed:&lt;/STRONG&gt;&lt;BR /&gt;Records when each statement inside a stored procedure starts and completes.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;sql_statement_starting / sql_statement_completed:&lt;/STRONG&gt;&lt;BR /&gt;Records when a standalone T-SQL statement starts and finishes.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;error_reported:&lt;/STRONG&gt;&lt;BR /&gt;Captures whenever SQL Server reports an error, including the severity, error number, and message.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;attention:&lt;/STRONG&gt;&lt;BR /&gt;Indicates when a query is canceled or times out (for example, if a user presses cancel or there is a client timeout).&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;For each event, the session also collects helpful details, such as:&lt;/P&gt;
&lt;DIV class="styles_lia-table-wrapper__h6Xo9 styles_table-responsive__MW0lN"&gt;&lt;table border="1" style="border-width: 1px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;Action&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;Description&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;sql_text&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;The exact T-SQL command that was run.&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;client_app_name&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;The name of the application (like SSMS or a .NET app) that sent the request.&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;client_hostname&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;The computer name where the request came from.&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;client_pid&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;The process ID of the client application.&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;username&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;The SQL Server login or user who ran the query.&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;session_id&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;The session ID (SPID) on SQL Server.&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;✅ Step 3: Stop the Session&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When you’re done collecting data, stop the session:&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;ALTER EVENT SESSION [XEventTmpl] ON SERVER STATE = STOP&lt;/LI-CODE&gt;
&lt;P&gt;If you no longer need the session, remove it completely:&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;DROP EVENT SESSION [XEventTmpl] ON SERVER&lt;/LI-CODE&gt;
&lt;H4&gt;❓ FAQ&lt;/H4&gt;
&lt;P&gt;&lt;STRONG&gt;Q. Will this slow my server?&lt;/STRONG&gt;&lt;BR /&gt;A. No, Extended Events is lightweight and safe for short captures.&lt;BR /&gt;&lt;A class="lia-external-url" href="https://learn.microsoft.com/en-us/sql/relational-databases/extended-events/extended-events" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/sql/relational-databases/extended-events/extended-events&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q. What permission do i need to run this query?&lt;/STRONG&gt;&lt;BR /&gt;A. You need either the ALTER ANY EVENT SESSION permission or, typically, sysadmin rights.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q. How do I share with Support?&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;A. Please compress (zip) the .xel files from your target folder and attach them to your support case.&lt;/P&gt;
&lt;P&gt;Also, include the time when you reproduced the issue.&lt;BR /&gt;Make sure you have reproduced the issue after starting the session in step 2, not just after creating the xEvent in step 1.&lt;/P&gt;
&lt;P&gt;If you have not changed the default output location, you can use the "Basic Log" scenario with the SQL_LogScout tool. This tool will also collect other important logs that are helpful for troubleshooting.&lt;BR /&gt;For more details about SQL_LogScout, please visit:&lt;BR /&gt;&lt;A class="lia-external-url" href="https://github.com/microsoft/SQL_LogScout" target="_blank" rel="noopener"&gt;https://github.com/microsoft/SQL_LogScout&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q. Can I use the same query to collect xEvents logs on Azure SQL Managed Instance (SQL MI)?&lt;/STRONG&gt;&lt;BR /&gt;A. On Azure SQL Managed Instance, xEvents cannot save files to a local server folder. Instead, you need to save the event file to Azure Blob Storage. To do this, please create a credential that matches your storage container’s URL, as shown below:&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;CREATE CREDENTIAL [https://&amp;lt;storage-account&amp;gt;.blob.core.windows.net/&amp;lt;container-name&amp;gt;] -- change here
    WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
    SECRET = '&amp;lt;your-SAS-token&amp;gt;'; -- change here&lt;/LI-CODE&gt;
&lt;P&gt;Next, update the filename in your event session to use the blob storage path instead of a local file path. For example:&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;CREATE EVENT SESSION [XEventTmpl] ON SERVER 
…….. 
ADD TARGET package0.event_file(
    SET filename=N'https://&amp;lt;storage-account&amp;gt;.blob.core.windows.net/&amp;lt;container-name&amp;gt;/'xeventtmpl.xel' -- it should be blob url not local filepath
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;H4&gt;📘 SQL Server で実行中のクエリをキャプチャする方法&lt;/H4&gt;
&lt;P&gt;SQL Server の内部で「どんなクエリが流れているか」「どの操作でエラーが出ているか」を確認したいときは、拡張イベント（xEvents） が便利です。拡張イベントは SQL Server に標準搭載されている機能であり、パフォーマンスへの影響も軽微です。&lt;/P&gt;
&lt;P&gt;拡張イベントの設定手順及び詳細につきましては、下記の公開情報に掲載されています。&lt;/P&gt;
&lt;P&gt;📖 クイック スタートの拡張イベント - SQL Server | Microsoft Learn&lt;BR /&gt;&lt;A class="lia-external-url" href="https://learn.microsoft.com/ja-jp/sql/relational-databases/extended-events/quick-start-extended-events-in-sql-server?view=sql-server-ver17" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/ja-jp/sql/relational-databases/extended-events/quick-start-extended-events-in-sql-server?view=sql-server-ver17&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;本ブログでは、サポート対応時にお客様へご案内することが多い T-SQL スクリプトを使って、最小ステップでキャプチャを始める方法をご紹介します。&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;🛠 拡張イベント ログの収集方法&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;以下の手順では、SQL Server の既定ログ フォルダーにログを保存する設定となっておりますが、保存先は変更可能です。&lt;/P&gt;
&lt;H6&gt;&lt;STRONG&gt;✅ ステップ1：拡張イベント セッションを作成する&lt;/STRONG&gt;&lt;BR /&gt;対象のインスタンス上で、下記クエリを sysadmin のような拡張イベントセッションの作成に必要な権限を有するアカウントにて実行します。&lt;/H6&gt;
&lt;LI-CODE lang="sql"&gt;CREATE EVENT SESSION [XEventTmpl] ON SERVER

ADD EVENT sqlserver.attention (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.error_reported (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.rpc_completed (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.rpc_starting (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sp_statement_completed (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sp_statement_starting (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sql_batch_completed (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sql_batch_starting (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sql_statement_completed (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
),

ADD EVENT sqlserver.sql_statement_starting (
    ACTION(package0.event_sequence,sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.client_pid, sqlserver.database_id, sqlserver.database_name, sqlserver.query_hash, sqlserver.session_id, sqlserver.sql_text, sqlserver.transaction_id, sqlserver.transaction_sequence, sqlserver.username)
)

ADD TARGET package0.event_file (
    SET filename = N'xeventtmpl.xel'
)

WITH (STARTUP_STATE = OFF);&lt;/LI-CODE&gt;
&lt;H6&gt;&lt;STRONG&gt;✅ ステップ2：拡張イベントの開始&lt;/STRONG&gt;&lt;BR /&gt;以下のクエリを実行することで、拡張イベントの収集を開始できます。&lt;/H6&gt;
&lt;LI-CODE lang="sql"&gt;ALTER EVENT SESSION [XEventTmpl] ON SERVER STATE = START&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;💡Tip: &amp;nbsp;&lt;/STRONG&gt;SQL Server Management Studio（SSMS）上で拡張イベントが有効になっているかをご確認いただく方法：&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;➤ SQL Server Management Studio（SSMS）を開き、[管理] → [拡張イベント] → [セッション] &amp;nbsp;の順に展開します。&lt;BR /&gt;➤ 一覧の中から 「XEventTmpl」 を見つけます。&lt;BR /&gt;➤ セッションが実行中の場合は、アイコンに 緑色の矢印 が表示されます。停止中の場合は、赤色の四角形 が表示されます。&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;H6&gt;&lt;STRONG&gt;🔍 結果（収集データ）の確認方法&lt;/STRONG&gt;&lt;/H6&gt;
&lt;P&gt;SQL Server Management Studio（SSMS）で拡張イベントの収集データを確認するには、以下の手順を実施してください。&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;SQL Server Management Studio（SSMS）を開き、[管理] → [拡張イベント] → [セッション]&amp;nbsp; の順に展開します。&lt;/LI&gt;
&lt;LI&gt;一覧の中から「XEventTmpl」を探して右クリックします。セッションが実行中の場合は「Watch Live Data」を選択し、リアルタイムでイベントを確認できます。&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;また、以下のクエリでも確認可能です。&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;SELECT * FROM sys.fn_xe_file_target_read_file('xeventtmpl*.xel', NULL, NULL, NULL)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;👁️&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;取得できる情報&lt;/STRONG&gt;&lt;BR /&gt;このセッションでは、以下の種類のイベントを収集します。&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;sql_batch_starting / sql_batch_completed:&lt;/STRONG&gt;&lt;BR /&gt;アドホックな T-SQL バッチの開始と終了&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;rpc_starting / rpc_completed:&lt;/STRONG&gt;&lt;BR /&gt;sp_executesql などの RPC の開始と終了&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;sp_statement_starting / sp_statement_completed:&lt;/STRONG&gt;&lt;BR /&gt;ストアドプロシージャ内の各ステートメントの開始と完了&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;sql_statement_starting / sql_statement_completed:&lt;/STRONG&gt;&lt;BR /&gt;単独の T-SQL ステートメントの開始と終了&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;error_reported:&lt;/STRONG&gt;&lt;BR /&gt;SQL Server が報告したエラー情報（重大度、エラー番号、メッセージなど）&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;attention:&lt;/STRONG&gt;&lt;BR /&gt;クエリのキャンセルやタイムアウト時の記録&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;また、各イベントごとに以下のような詳細情報も収集されます。&lt;/P&gt;
&lt;DIV class="styles_lia-table-wrapper__h6Xo9 styles_table-responsive__MW0lN"&gt;&lt;table border="1" style="border-width: 1px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;アクション&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;説明&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;sql_text&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;実行された T-SQL コマンドの内容&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;client_app_name&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;リクエスト元のアプリケーション名&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;client_hostname&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;リクエスト元のコンピューター名&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;client_pid&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;クライアント アプリケーションのプロセス ID&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;username&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;実行ユーザーの SQL Server ログイン名&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;session_id&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;SQL Server 上のセッション ID（SPID）&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;H6&gt;&lt;STRONG&gt;✅ ステップ3：拡張イベントの停止&lt;/STRONG&gt;&lt;BR /&gt;以下のクエリを実行することで、拡張イベントの収集を停止できます。&lt;/H6&gt;
&lt;LI-CODE lang="sql"&gt;ALTER EVENT SESSION [XEventTmpl] ON SERVER STATE = STOP&lt;/LI-CODE&gt;
&lt;P&gt;拡張イベントが不要な場合は、下記クエリを実行して削除します。&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;DROP EVENT SESSION [XEventTmpl] ON SERVER&lt;/LI-CODE&gt;
&lt;H6&gt;&lt;STRONG&gt;🗂 保存先について：&lt;/STRONG&gt;&lt;/H6&gt;
&lt;P&gt;収集されたログは、xeventtmpl_*.xel という名前で、SQL Server の既定ログフォルダーに保存されます。お問い合わせの際には、該当フォルダー全体を ZIP ファイルにまとめてご提供いただけますと、よりスムーズに調査を進めることができます。&lt;/P&gt;</description>
      <pubDate>Wed, 15 Oct 2025 04:39:15 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/how-to-capture-running-queries-in-sql-server/ba-p/4454947</guid>
      <dc:creator>prakashkc</dc:creator>
      <dc:date>2025-10-15T04:39:15Z</dc:date>
    </item>
    <item>
      <title>SQL Server IaaS Agent 拡張機能の概要 (What is the Windows SQL Server IaaS Agent extension?)</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/sql-server-iaas-agent-%E6%8B%A1%E5%BC%B5%E6%A9%9F%E8%83%BD%E3%81%AE%E6%A6%82%E8%A6%81-what-is-the-windows-sql-server/ba-p/4449978</link>
      <description>&lt;P&gt;English follows Japanese.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;こんにちは、 SQL Server サポート チームです。&lt;/P&gt;
&lt;P&gt;今回は、SQL IaaS Agent 拡張機能と Azure 上の SQL 仮想マシン リソースについて解説します。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;U&gt;&lt;STRONG&gt;SQL Server IaaS Agent 拡張機能とは&lt;/STRONG&gt;&lt;/U&gt;&lt;/H4&gt;
&lt;P&gt;SQL Server IaaS Agent 拡張機能は、Azure Portal 上から Azure VM 上の SQL Server を管理・運用できるようにする拡張機能です。&lt;BR /&gt;SQL Server がインストール済みの Azure VM が Azure 上の 「SQL Server IaaS Agent 拡張機能」 に登録されると、その Azure VMに紐づいた 「SQL 仮想マシン」リソース が Azure Portal 上に作成され、SQL Server のライセンス等を管理するための画面をご利用いただけるようになります。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//SQL Server IaaS Agent 拡張機能とは&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/sql-server-iaas-agent-extension-automate-management?view=azuresql&amp;amp;tabs=azure-portal" target="_blank" rel="noopener"&gt;SQL Server IaaS Agent 拡張機能とは (Windows) - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;U&gt;&lt;STRONG&gt;拡張機能に登録する利点&lt;/STRONG&gt;&lt;/U&gt;&lt;/H4&gt;
&lt;P&gt;SQL Server IaaS Agent 拡張機能を使用することで、様々な管理機能を有効化することが可能です。代表的な機能を後述いたします。&lt;/P&gt;
&lt;P&gt;前提として、 SQL Server IaaS Agent 拡張機能に登録すると、既定では基本的な機能（SQL 仮想マシン管理画面の [ライセンスの種類] ）のみが有効化された状態となります。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;下記の弊社公開情報に「SQL IaaS Agent 拡張機能が必要です。」と記載されたいずれかの機能を有効化すると、SQL IaaS Agent 拡張機能用のサービスが Azure VM 上にインストールされます。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// Windows SQL Server IaaS Agent 拡張機能を使用して管理を自動化する - 機能面の利点&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/sql-server-iaas-agent-extension-automate-management?view=azuresql&amp;amp;tabs=azure-portal#feature-benefits" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/sql-server-iaas-agent-extension-automate-management?view=azuresql&amp;amp;tabs=azure-portal#feature-benefits&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H5&gt;&lt;STRONG&gt;代表的な機能&lt;/STRONG&gt;&lt;/H5&gt;
&lt;P&gt;SQL IaaS Agent 拡張機能が持つ機能は、前述の弊社公開情報にまとめられております。&lt;/P&gt;
&lt;P&gt;そのうち、代表的な機能をご紹介します。詳細は、前述の公開情報や、それぞれの説明に添えた公開情報を必要に応じてご参照ください。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI style="font-weight: bold;"&gt;&lt;STRONG&gt;自動バックアップ&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;Azure VM での SQL Server 上のすべての既存および新規データベースのための Microsoft Azure へのマネージド バックアップが自動的に構成されます。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// Azure 仮想マシンでの SQL Server 2014 の自動バックアップ - SQL Server on Azure VMs | Microsoft Learn&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/automated-backup-sql-2014?view=azuresql" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/automated-backup-sql-2014?view=azuresql&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Azure VM 上の SQL Server の自動バックアップ&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/automated-backup?view=azuresql" target="_blank" rel="noopener"&gt;SQL Server 2016 以降の自動バックアップ - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="2"&gt;
&lt;LI style="font-weight: bold;"&gt;&lt;STRONG&gt;tempdb の構成&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Azure Portal 上から tempdb の ストレージ構成を行うことが可能になります。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Azure portal を使用して SQL Server VM を管理する - ストレージ&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/manage-sql-vm-portal?view=azuresql#storage" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/manage-sql-vm-portal?view=azuresql#storage&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="3"&gt;
&lt;LI style="font-weight: bold;"&gt;&lt;STRONG&gt;Microsoft Entra 認証&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;SQL Server への認証に Microsoft Entra ID を使用することが可能になります。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Azure VM 上の SQL Server に対する Microsoft Entra 認証を有効にする&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/configure-azure-ad-authentication-for-sql-vm?view=azuresql&amp;amp;tabs=azure-portal" target="_blank" rel="noopener"&gt;Microsoft Entra 認証を有効にする - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;U&gt;&lt;STRONG&gt;FAQ&lt;/STRONG&gt;&lt;/U&gt;&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;SQL Server IaaS Agent 拡張機能 は有料ですか？&lt;/STRONG&gt;&lt;BR /&gt;SQL Server IaaS Agent 拡張機能を使用する際、追加の費用等は発生いたしません。&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;SQL Server IaaS Agent 拡張機能 に登録する方法を教えてください。&lt;/STRONG&gt;&lt;BR /&gt;Azure PowerShell や Azure CLI での手動登録、 Azure Portal でサブスクリプション単位でのIaaS Agent 拡張機能の自動登録機能を有効化する方法がございます。また、弊社の定期メンテナンスにより登録が行われる場合もあります。&lt;BR /&gt;&lt;BR /&gt;//SQL IaaS Agent 拡張機能への自動登録&lt;BR /&gt;&lt;A style="font-style: normal; font-weight: 400; background-color: rgb(255, 255, 255);" href="https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/sql-agent-extension-automatic-registration-all-vms?view=azuresql&amp;amp;source=recommendations&amp;amp;tabs=azure-cli" target="_blank" rel="noopener"&gt;SQL IaaS Agent 拡張機能への自動登録 - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;//Windows SQL Server VM を SQL IaaS Agent 拡張機能に登録する（手動登録）&lt;BR /&gt;&lt;A style="font-style: normal; font-weight: 400; background-color: rgb(255, 255, 255);" href="https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/sql-agent-extension-manually-register-single-vm?view=azuresql&amp;amp;tabs=azure-portal" target="_blank" rel="noopener"&gt;SQL IaaS Agent 拡張機能に登録する (Windows) - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;複数の SQL Server インスタンスがインストールされている環境で SQL Server IaaS Agent 拡張機能 をインストールすることは可能ですか？&lt;/STRONG&gt;&lt;BR /&gt;複数の SQL Server インスタンスがある場合は既定のインスタンス (MSSQLSERVER) のみが拡張機能にサポートされます。具体的にサポートされる環境は以下となります。
&lt;UL&gt;
&lt;LI&gt;1 つの既定のインスタンスのみがある環境。&lt;/LI&gt;
&lt;LI&gt;複数のインスタンスがある場合は、Azure portal の拡張機能によって既定のインスタンスのみがサポートおよび管理されます。 既定のインスタンスがなく名前付きインスタンスが複数ある環境はサポートされていません。&lt;/LI&gt;
&lt;LI&gt;インストールされているインスタンスが 1 つのみの場合は、1 つの名前付きインスタンスがサポートされます。&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;VM を削除すると SQL 仮想マシン リソースも削除されますか？&lt;/STRONG&gt;&lt;BR /&gt;対象の SQL Server がインストールされた VM が削除されると、SQL 仮想マシンリソースも削除されます。&lt;BR /&gt;&lt;BR /&gt;// ご参考) Azure VM 上の SQL Server についてよく寄せられる質問 (FAQ) - Azure SQL | Microsoft Learn&lt;BR /&gt;&lt;A style="font-style: normal; font-weight: 400; background-color: rgb(255, 255, 255);" href="https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/frequently-asked-questions-faq?view=azuresql" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/frequently-asked-questions-faq?view=azuresql&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;※本情報の内容（添付文書、リンク先などを含む）は、作成日時点でのものであり、予告なく変更される場合があります。&lt;/P&gt;
&lt;P&gt;------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello, this is the SQL Server Support Team.&lt;/P&gt;
&lt;P&gt;In this article, we will explain the SQL IaaS Agent Extension and the SQL Virtual Machines resource on Azure.&lt;/P&gt;
&lt;H4&gt;&lt;U&gt;&lt;STRONG&gt;What is the SQL Server IaaS Agent extension?&lt;/STRONG&gt;&lt;/U&gt;&lt;/H4&gt;
&lt;P&gt;The SQL Server IaaS Agent Extension is a feature that enables you to manage and operate SQL Server installed on Azure VMs directly from the Azure Portal.&lt;BR /&gt;When an Azure VM with SQL Server installed is registered with the "SQL Server IaaS Agent Extension" on Azure, a corresponding "SQL Virtual Machine" resource is created in the Azure Portal. This allows you to access a management interface for SQL Server licensing and other settings.&lt;/P&gt;
&lt;P&gt;//What is the SQL Server IaaS Agent extension?&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/sql-server-iaas-agent-extension-automate-management?view=azuresql&amp;amp;tabs=azure-portal" target="_blank" rel="noopener"&gt;What is the SQL Server IaaS Agent extension? (Windows) - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;img /&gt;
&lt;P class="lia-clear-both"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;U&gt;Benefits of Registering the extension&lt;/U&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;By using the SQL Server IaaS Agent Extension, you can enable various management features. Some of the key features are introduced below.&lt;BR /&gt;By default, when a VM is registered with the SQL Server IaaS Agent Extension, only the basic functionality (such as the "SQL Server License" setting in the SQL Virtual Machine management) is enabled.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;When you enable any of the features listed in the Microsoft documentation that states "Requires SQL IaaS Agent extension.", the extension service is installed on the Azure VM.&lt;/P&gt;
&lt;P&gt;//Automate management with the Windows SQL Server IaaS Agent extension - Feature benefits&lt;BR /&gt;&lt;A class="lia-external-url" href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/sql-server-iaas-agent-extension-automate-management?view=azuresql&amp;amp;tabs=azure-portal" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/sql-server-iaas-agent-extension-automate-management?view=azuresql&amp;amp;tabs=azure-portal#feature-benefits&lt;/A&gt;&lt;/P&gt;
&lt;img /&gt;
&lt;P class="lia-clear-both"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H5&gt;&lt;STRONG&gt;Key Features&lt;/STRONG&gt;&lt;/H5&gt;
&lt;P&gt;The features provided by the SQL IaaS Agent Extension are summarized in the documentation above. Here are some of the most notable ones.&amp;nbsp;&lt;BR /&gt;For more details, please refer to the linked documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1. Automated backup&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Automated Backup automatically configures Managed Backup to Microsoft Azure for all existing and new databases.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;//Automated Backup for SQL Server 2014 virtual machines (Resource Manager)&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/automated-backup-sql-2014?view=azuresql" target="_blank" rel="noopener"&gt;Automated Backup for SQL Server 2014 Azure virtual machines - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;//Automated Backup for SQL Server on Azure VMs&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/automated-backup?view=azuresql" target="_blank" rel="noopener"&gt;Automated Backup for SQL Server 2016 and later - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2. Configure tempdb&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You can configure tempdb storage directly from the Azure Portal.&lt;/P&gt;
&lt;P&gt;//Manage SQL Server VM using Azure Portal - Storage | Microsoft Learn&lt;BR /&gt;&lt;A class="lia-external-url" href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/manage-sql-vm-portal?view=azuresql#storage" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/manage-sql-vm-portal?view=azuresql#storage&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3. Microsoft Entra authentication&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You can use Microsoft Entra ID for authentication to SQL Server.&lt;/P&gt;
&lt;P&gt;//Enable Microsoft Entra authentication for SQL Server on Azure VMs&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/configure-azure-ad-authentication-for-sql-vm?view=azuresql&amp;amp;tabs=azure-portal" target="_blank" rel="noopener"&gt;Enable Microsoft Entra authentication - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;H4&gt;&lt;U&gt;&lt;STRONG&gt;FAQ&lt;/STRONG&gt;&lt;/U&gt;&lt;/H4&gt;
&lt;P&gt;&lt;STRONG&gt;Q: Is the SQL Server IaaS Agent Extension a paid feature?&lt;/STRONG&gt;&lt;BR /&gt;A: No, there are no additional costs for using the SQL Server IaaS Agent Extension.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: How can I register with the SQL Server IaaS Agent Extension?&lt;/STRONG&gt;&lt;BR /&gt;A: You can register manually using Azure PowerShell or Azure CLI or enable automatic registration at the subscription level via the Azure Portal. Registration may also occur during maintenance by Microsoft.&lt;/P&gt;
&lt;P&gt;//Automatic registration with SQL IaaS Agent extension&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/sql-agent-extension-automatic-registration-all-vms?view=azuresql&amp;amp;tabs=azure-cli" target="_blank" rel="noopener"&gt;Automatic registration with SQL IaaS Agent extension - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;//Register Windows SQL Server VM with SQL IaaS Agent extension&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/sql-agent-extension-manually-register-single-vm?view=azuresql&amp;amp;tabs=azure-powershell" target="_blank" rel="noopener"&gt;Register with SQL IaaS Agent Extension (Windows) - SQL Server on Azure VMs | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Q: Can I install the SQL Server IaaS Agent Extension in an environment with multiple SQL Server instances?&lt;/STRONG&gt;&lt;BR /&gt;A: The SQL IaaS Agent extension supports the following environments:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;One default instance.&lt;/LI&gt;
&lt;LI&gt;If there are multiple instances, only the default instance is supported and managed by the extension in the Azure portal. Environments with multiple named instances without a default instance aren't supported.&lt;/LI&gt;
&lt;LI&gt;One named instance, if it's the only installed instance.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Q: If I delete the VM, will the SQL Virtual Machine resource also be deleted?&lt;/STRONG&gt;&lt;BR /&gt;A: Yes, if the VM with SQL Server installed is deleted, the corresponding SQL Virtual Machine resource will also be removed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Frequently asked questions for SQL Server on Azure VMs&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/frequently-asked-questions-faq?view=azuresql" target="_blank" rel="noopener"&gt;Frequently asked questions (FAQ) for SQL Server on Azure VMs - Azure SQL | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; The content of this article (including attachments and linked pages) is current as of the time of writing and may be subject to change without notice.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 08:12:28 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/sql-server-iaas-agent-%E6%8B%A1%E5%BC%B5%E6%A9%9F%E8%83%BD%E3%81%AE%E6%A6%82%E8%A6%81-what-is-the-windows-sql-server/ba-p/4449978</guid>
      <dc:creator>Eijin_Ota</dc:creator>
      <dc:date>2025-09-17T08:12:28Z</dc:date>
    </item>
    <item>
      <title>更新プログラム適用後、bcp.exe の出力メッセージが英語になる</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/%E6%9B%B4%E6%96%B0%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0%E9%81%A9%E7%94%A8%E5%BE%8C-bcp-exe-%E3%81%AE%E5%87%BA%E5%8A%9B%E3%83%A1%E3%83%83%E3%82%BB%E3%83%BC%E3%82%B8%E3%81%8C%E8%8B%B1%E8%AA%9E%E3%81%AB%E3%81%AA%E3%82%8B/ba-p/4442792</link>
      <description>&lt;P&gt;English follows Japanese&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;こんにちは。SQL Server サポート チームです。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H5&gt;&lt;U&gt;&lt;SPAN class="lia-text-color-21"&gt;&lt;STRONG&gt;事象&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/U&gt;&lt;/H5&gt;
&lt;P&gt;日本語版の SQL Server をインストールし、利用している環境で、SQL Server へ更新プログラムを適用後、bcp.exe の出力メッセージが英語になる場合があります。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;接続先インスタンスを誤った場合の例:&lt;/P&gt;
&lt;img /&gt;
&lt;P class="lia-clear-both"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;本事象は、ODBCドライバーの修正が含まれた更新プログラムを適用する場合、更新プログラムに含まれるODBCドライバーのインストーラーは各言語版ではなく英語版での提供となり、更新プログラムを適用時にODBCドライバーの日本語リソースファイルが削除されるために発生します。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H5&gt;&lt;U&gt;&lt;STRONG&gt;対処策&lt;/STRONG&gt;&lt;/U&gt;&lt;/H5&gt;
&lt;P&gt;SQL Server&amp;nbsp;の更新プログラムを適用後、日本語リソースファイルを再配置します。再配置手順は以下の通りです。&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ODBC ドライバー（17.10.6.1）を例としてご説明します。&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;日本語リソースファイルを再配置方法：&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1) 以下のサイトにアクセスし、リリース番号 17.10.6.1 ODBC ドライバー(日本語) をダウンロードします。&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/ja-jp/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver16#version-17" target="_blank"&gt;ODBC Driver for SQL Server のダウンロード - ODBC Driver for SQL Server | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) ダウンロードしたファイル(msodbcsql.msi) を任意のフォルダーに配置します。&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; なお、後述の手順はC:\temp フォルダーにインストールしたインストーラーを配置した場合の例です。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) &amp;nbsp;管理者権限でコマンドプロンプトを起動し、下記のコマンドを実行し、ダウンロードしたインストーラーを展開します。&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;　　msiexec /a "C:\temp\msodbcsql.msi" /qb targetdir="C:\temp\msodbcsql_msi"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;4) 展開したフォルダーにある msodbcsqlr17.rll を次の配置先のフォルダーにコピーします。&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; ※ 配置先のフォルダー C:\Windows\System32\1041 が存在しない場合は、フォルダーを作成したうえで msodbcsqlr17.rll をコピーします。&lt;/P&gt;
&lt;P&gt;　　 コピー元: C:\temp\msodbcsql_msi\Windows\System32\1041&lt;/P&gt;
&lt;P&gt;　 　配置先: C:\Windows\System32\1041&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;5) bcp.exe の出力メッセージが日本語となるか確認します。&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー&lt;/P&gt;
&lt;P&gt;Hello, this is the SQL Server Support Team.&lt;/P&gt;
&lt;H5&gt;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;Issue&lt;/STRONG&gt;&lt;/U&gt;&lt;/H5&gt;
&lt;P&gt;In environments where the Japanese version of SQL Server is installed and used, after applying an update to SQL Server, the output messages from bcp.exe may appear in English.&lt;BR /&gt;&lt;BR /&gt;Example when connecting to the wrong instance:&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This issue occurs when the update includes a fix for the ODBC driver. The installer for the ODBC driver included in the update is provided in English rather than in each localized language version. As a result, the Japanese resource file for the ODBC driver is deleted during the update process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H5&gt;&lt;U&gt;&lt;SPAN class="lia-text-color-21"&gt;&lt;STRONG&gt;Resolution&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/U&gt;&lt;/H5&gt;
&lt;P&gt;After applying the SQL Server update, relocate the Japanese resource file.&lt;/P&gt;
&lt;P&gt;The steps below explain how to do this using ODBC Driver version 17.10.6.1 as an example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Steps to relocate the Japanese resource file:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1) Access the following site and download the ODBC Driver version 17.10.6.1 (Japanese version):&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver17#version-17" target="_blank"&gt;&amp;nbsp; &amp;nbsp; Download ODBC Driver for SQL Server - ODBC Driver for SQL Server | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Place the downloaded file (msodbcsql.msi) in any folder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; The following steps assume the installer is placed in the C:\temp folder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3)&amp;nbsp; Open Command Prompt with administrator privileges and run the following command to extract the installer:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; msiexec /a "C:\temp\msodbcsql.msi" /qb targetdir="C:\temp\msodbcsql_msi"&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4) Copy the msodbcsqlr17.rll file from the extracted folder to the following destination folder:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; If the destination folder C:\Windows\System32\1041 does not exist, create it before copying the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Source : C:\temp\msodbcsql_msi\Windows\System32\1041&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Destination : C:\Windows\System32\1041&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5) Confirm that the output messages from bcp.exe are displayed in Japanese.&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Aug 2025 14:05:53 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/%E6%9B%B4%E6%96%B0%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0%E9%81%A9%E7%94%A8%E5%BE%8C-bcp-exe-%E3%81%AE%E5%87%BA%E5%8A%9B%E3%83%A1%E3%83%83%E3%82%BB%E3%83%BC%E3%82%B8%E3%81%8C%E8%8B%B1%E8%AA%9E%E3%81%AB%E3%81%AA%E3%82%8B/ba-p/4442792</guid>
      <dc:creator>KeiichiroTani</dc:creator>
      <dc:date>2025-08-18T14:05:53Z</dc:date>
    </item>
    <item>
      <title>How to artificially create a non-yielding scheduler scenario using WinDbg</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/how-to-artificially-create-a-non-yielding-scheduler-scenario/ba-p/4428965</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This article demonstrates how you can create a non-yielding scheduler scenario at will so you can examine the various diagnostic tools for non-yielding schedulers - error log, memory dump, nonyield_copiedstack_ring_buffer_recorded in system_health Xevents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER label="Warning"&gt;
&lt;P&gt;&lt;STRONG&gt;Do not &lt;/STRONG&gt;do this on a production server as you will freeze your production workload. This is designed for learning and better understanding of how SQL Server works and can be troubleshot.&lt;/P&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;If you already have WinDbg or WinDbgX installed and symbols configured, skip to step 6 [Attach WinDbg to a SQL Server process]&lt;/LI&gt;
&lt;LI&gt;Download and install WinDbg via&amp;nbsp;&lt;A href="https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/" target="_blank" rel="noopener" aria-label="Windows SDK - Windows app development | Microsoft Developer (Opens in new window or tab)"&gt;Windows SDK - Windows app development | Microsoft Developer&lt;/A&gt;&amp;nbsp;. Choose the&amp;nbsp;&lt;STRONG&gt;Download the Installer&lt;/STRONG&gt;&amp;nbsp;button.&lt;/LI&gt;
&lt;LI&gt;When you start the installation uncheck everything except&amp;nbsp;&lt;STRONG&gt;Debugging Tools for Windows&lt;/STRONG&gt;&amp;nbsp;and press&amp;nbsp;&lt;STRONG&gt;Install&lt;BR /&gt;&lt;/STRONG&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;Start &lt;STRONG&gt;Windbg&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Define a symbol path so you can debug with call stacks that are human-readable&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;File -&amp;gt; Symbol File Path&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Paste&amp;nbsp;&lt;STRONG&gt;srv*c:\PublicSymbols*&lt;A href="https://msdl.microsoft.com/download/symbols" target="_blank" rel="noopener" aria-label="https://msdl.microsoft.com/download/symbols (Opens in new window or tab)"&gt;https://msdl.microsoft.com/download/symbols&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Click&amp;nbsp;&lt;STRONG&gt;OK&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;File -&amp;gt; Save Workspace&lt;BR /&gt;&lt;/STRONG&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Attach WinDbg to a SQL Server process&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;File -&amp;gt; Attach to process&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Chose&amp;nbsp;&lt;STRONG&gt;Sort -&amp;gt; By executable&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Locate your SQLServr.exe by expanding the properties of each process to identify the one you want&lt;/LI&gt;
&lt;LI&gt;Select the process and click&amp;nbsp;&lt;STRONG&gt;OK&lt;BR /&gt;&lt;/STRONG&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;Run a debugger command that causes the public symbols for many of the loaded modules to be downloaded in your local symbols folder. For example, the &lt;STRONG&gt;kc&lt;/STRONG&gt; command will display the call stacks of all threads in SQL Server. It may take awhile to complete because Windbg is downloading symbol files locally in your defined symbol path. Wait for the debugger to return to the prompt&lt;BR /&gt;&lt;BR /&gt;&lt;LI-CODE lang="batch"&gt;~*kc100&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;Now let the SQL Server process continue running by pressing typing&amp;nbsp;&lt;STRONG&gt;g&lt;/STRONG&gt; followed by Enter&lt;/LI&gt;
&lt;LI&gt;Connect to SQL Server using SSMS or Sqlcmd and execute a very long-running query. Here is an example that works:&lt;BR /&gt;&lt;BR /&gt;&lt;LI-CODE lang="sql"&gt;SELECT COUNT_BIG (*) 
FROM sys.messages a, sys.messages b, sys.messages c&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;After the query has run for more than 2-3 seconds, go back the WinDbg and break into the debug session.&amp;nbsp;Press either&amp;nbsp;&lt;STRONG&gt;CTRL+Break&lt;/STRONG&gt;&amp;nbsp;or&amp;nbsp;&lt;STRONG&gt;Alt+Del&lt;/STRONG&gt;. This will place you back to a WinDbg prompt awaiting commands&lt;BR /&gt;&lt;img /&gt;&lt;/LI&gt;
&lt;LI&gt;Let's re-run the command to display the call stacks for all threads. This time the command should complete faster than it did earlier, because most symbol files should already be downloaded.&lt;BR /&gt;&lt;LI-CODE lang="batch"&gt;~*kc100&lt;/LI-CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Scroll to the top of the output and using CTRL+F, search for&amp;nbsp;&lt;STRONG&gt;CSQLSource::Execute&lt;/STRONG&gt;. You should find (at least) one thread that has this in the call stack.&lt;/LI&gt;
&lt;LI&gt;Once you locate that thread, look at its WinDbg thread ID. For example, it could be 93 or 112. Here is an example where it's 69:&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/LI&gt;
&lt;LI&gt;Now, let's freeze this thread on purpose inside WinDbg, in order to simulate a stalled, non-yielding scenario. This thread has actively executing code and thus likely using a SQL Scheduler. If the thread is frozen artificially, SQL Server Scheduler Monitor will consider it a non-yielding thread because it is not changing state and is not releasing control of the scheduler it was running on.&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;To freeze your thread, use the&amp;nbsp;&lt;STRONG&gt;~Tf&lt;/STRONG&gt; by where T is your identified thread id ("f" is for freeze)&lt;BR /&gt;&lt;BR /&gt;&lt;LI-CODE lang="batch"&gt;~Tf&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Then hit Enter&lt;/LI&gt;
&lt;LI&gt;Now press&amp;nbsp;&lt;STRONG&gt;g&lt;/STRONG&gt; and Enter&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;Wait for a minute or two (a quick coffee break)&lt;/LI&gt;
&lt;LI&gt;Now open the C:\Program Files\Microsoft SQL Server\MSSQLXXXXXX\MSSQL\Log\&lt;STRONG&gt;Errorlog&lt;/STRONG&gt; and look for an entry like this one:&lt;BR /&gt;&lt;BR /&gt;&lt;LI-CODE lang="bash"&gt;2025-06-06 15:03:55.77 Server      *
*******************************************************************************
2025-06-06 15:03:55.77 Server      *
2025-06-06 15:03:55.77 Server      * BEGIN STACK DUMP:
2025-06-06 15:03:55.77 Server      *   06/06/25 15:03:55 spid 5144
2025-06-06 15:03:55.77 Server      *
2025-06-06 15:03:55.77 Server      * Non-yielding Scheduler
2025-06-06 15:03:55.77 Server      *
2025-06-06 15:03:55.77 Server      *   
*******************************************************************************
2025-06-06 15:03:55.77 Server      CImageHelper::DoMiniDump entered. Dump attempts: 1. Exception record exists...   
2025-06-06 15:03:55.77 Server      Stack Signature for the dump is 0x00000000000003D6&lt;/LI-CODE&gt;&lt;LI-CODE lang="batch"&gt;qd&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;You have successfully simulated a Non-yielding scheduler&lt;/LI&gt;
&lt;LI&gt;To unfreeze your thread, use the&amp;nbsp;&lt;STRONG&gt;~Tu&lt;/STRONG&gt; by replacing T with your identified thread id ("u" is for unfreeze), then hit Enter. In this example:&lt;BR /&gt;&lt;BR /&gt;&lt;LI-CODE lang="batch"&gt;~69u&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;To detach Windbg from SQL Server type the quit+detach (qd) command. After that you can close Windbg&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;LI-CODE lang="batch"&gt;qd&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;If you examine the lastes &lt;STRONG&gt;system_health&lt;/STRONG&gt;&amp;nbsp;XEL in your&amp;nbsp;&lt;STRONG&gt;\Log&lt;/STRONG&gt; folder you can also find the &lt;EM&gt;nonyield_copiedstack_ring_buffer_recorded&lt;/EM&gt; matching the non-yielding scheduler event and also extract the call stack from there. You can use this call stack with &lt;A href="https://github.com/microsoft/SQLCallStackResolver/blob/main/README.md" target="_blank" rel="noopener"&gt;SQLCallStackResolver/README.md at main · microsoft/SQLCallStackResolver&lt;/A&gt; tool to identify the call stack. (this screenshot is from another debug session so ignore timestamps)&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;After SQL Server 2022 another diagnostic capability: RING_BUFFER_NONYIELD_COPIEDSTACK in the sys.dm_os_ring_buffers. When the non-yielding scheduler issue occurs, you can query using this query:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;SELECT * FROM sys.dm_os_ring_buffers
WHERE ring_buffer_type = 'RING_BUFFER_NONYIELD_COPIEDSTACK'&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;The output may look like this, particularly if you let the non-yielding issue persist over 5 minutes or so.&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Happy debugging!&lt;/P&gt;
&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jul 2025 19:17:35 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/how-to-artificially-create-a-non-yielding-scheduler-scenario/ba-p/4428965</guid>
      <dc:creator>Joseph_Pilov</dc:creator>
      <dc:date>2025-07-01T19:17:35Z</dc:date>
    </item>
    <item>
      <title>Windows Server 2025 にインストールしたSQL Server の更新プログラムを削除する方法</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/windows-server-2025-%E3%81%AB%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%97%E3%81%9Fsql-server-%E3%81%AE%E6%9B%B4%E6%96%B0%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0%E3%82%92%E5%89%8A%E9%99%A4%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/ba-p/4416379</link>
      <description>&lt;P&gt;こんにちは。SQL Server サポート チームです。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;事象&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Windows Server 2025 にインストールしたSQL Server に対して適用した更新プログラムが、Uninstall Updates(更新プログラムをアンインストール) 画面に表示されません。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// Microsoft SQL Browser とMicrosoft SQL Server VSS Writer は表示されますが、SQL Server は表示されない&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;対処策&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;SQL Server&amp;nbsp;の更新プログラムをアンインストールする必要がある場合は、以下の方法でアンインストールをお願いします。&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SQL Server 2022 CU19(KB5054531)&amp;nbsp;を例としてご説明します。&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-text-color-8"&gt;&lt;STRONG&gt;※注意事項※&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-text-color-8"&gt;&lt;STRONG&gt;レジストリ エディターまたは別の方法を使用してレジストリを誤って変更すると、深刻な問題が発生することがあります。&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-text-color-8"&gt;&lt;STRONG&gt;最悪の場合、オペレーティング システムの再インストールが必要になることがあります。&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-text-color-8"&gt;&lt;STRONG&gt;マイクロソフトは、レジストリの変更により発生した問題に関しては、一切責任を負わないものとします。&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-text-color-8"&gt;&lt;STRONG&gt;そのため、十分に注意のうえ、作業ください。&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SQL Server の更新プログラム(KB5054531) のアンインストール方法：&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1) スタートボタン -&amp;gt; ファイル名を指定して実行 から「regedit.exe」と入力し、「OK」をクリックします。&lt;/P&gt;
&lt;P&gt;2) レジストリエディターが起動したら、以下のレジストリ キーを開きます。&lt;/P&gt;
&lt;P&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KB5054531&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) UninstallString をダブルクリックして表示される画面から、[値のデータ] に記載の内容をコピーします。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4) コマンドプロンプトを管理者で起動し、手順3 でコピーしたコマンドを実行します。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5) 更新プログラムをアンインストールする画面が表示されるため、指示に従い更新プログラムのアンインストールを進めます。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;以下のように[状態] が全て[成功] となっていれば、SQL Server の更新プログラムをアンインストールすることができたと判断できます。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;6) コマンドプロンプトとレジストリエディターの画面を閉じます。&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2025 07:19:04 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/windows-server-2025-%E3%81%AB%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%97%E3%81%9Fsql-server-%E3%81%AE%E6%9B%B4%E6%96%B0%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0%E3%82%92%E5%89%8A%E9%99%A4%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/ba-p/4416379</guid>
      <dc:creator>Masafumi_Hori</dc:creator>
      <dc:date>2025-05-22T07:19:04Z</dc:date>
    </item>
    <item>
      <title>You may see high CPU usage after enabling the Log Shipping with Always ON on multiple databases.</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/you-may-see-high-cpu-usage-after-enabling-the-log-shipping-with/ba-p/4405038</link>
      <description>&lt;H5&gt;&lt;SPAN data-teams="true"&gt;Symptom&lt;/SPAN&gt;&lt;/H5&gt;
&lt;P&gt;It is possible to reproduce this scenario with 10 Availability Groups and 5 databases per AG.&lt;/P&gt;
&lt;DIV class="styles_lia-table-wrapper__h6Xo9 styles_table-responsive__MW0lN"&gt;&lt;table border="1" style="border-width: 1px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/td&gt;&lt;td&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For all 50 databases &lt;A href="https://learn.microsoft.com/en-us/sql/database-engine/log-shipping/configure-log-shipping-sql-server?view=sql-server-ver16" target="_blank" rel="noopener"&gt;SQL Server Log Shipping&lt;/A&gt; is configured. Idea is to have a separate copy of these databases which follow the production with a certain delay (this is an intended delay due to business needs)&lt;/P&gt;
&lt;P&gt;Observed behavior is whenever Log Shipping backup jobs are triggered, the CPU is peaking on Log Shipping Principal Server. (If you keep the default behavior and they all triggered at the same time)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;Perfmon showing the peak on % Processor Time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;Task Manager showing the high CPU usage of cluster.exe , sqlserver.exe&amp;nbsp; (other contributors are sqlagent.exe and logship.exe (multiple instances ) )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To understand this further &lt;A class="lia-external-url" href="https://learn.microsoft.com/en-us/windows-hardware/test/wpt/windows-performance-recorder" target="_blank" rel="noopener"&gt;WPR &lt;/A&gt;was&amp;nbsp;captured from this environment. Investigations showed this usage is mainly in Kernel Time and caused by a &lt;A class="lia-external-url" href="https://learn.microsoft.com/en-us/windows/win32/api/clusapi/nf-clusapi-clusterregopenkey" target="_blank" rel="noopener"&gt;Cluster API call&lt;/A&gt; made by SQL Server.&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;sqlmin.dll!HadrWsfcUtil::OpenClusterResourceKey
sqlmin.dll!HadrAvailabilityGroupStore::Retrieve
sqlmin.dll!HadrAvailabilityGroup::Refresh
sqlmin.dll!HadrAvailabilityGroup::HadrAvailabilityGroup
sqlmin.dll!HadrAvailabilityGroupObjectModel::GetAvailabilityGroupByResourceId
sqlmin.dll!HadrAvailabilityGroupObjectModel::GetAvailabilityGroupByName
sqlmin.dll!DmHadrInternalAgStatesTable::GetAgConfiguration
sqlmin.dll!DmHadrInternalAgStatesTable::InternalGetRow
sqlmin.dll!CQScanTVFStreamNew::GetRow
sqlmin.dll!CQScanLightProfileNew::GetRow
sqlmin.dll!CQScanFilterNew::GetRowHelper
sqlmin.dll!CQScanLightProfileNew::GetRow
sqlmin.dll!CQueryScan::GetRow
sqllang.dll!CXStmtQuery::ErsqExecuteQuery
sqllang.dll!CXStmtSelect::XretExecute
sqllang.dll!CMsqlExecContext::ExecuteStmts&amp;lt;1,1&amp;gt;
sqllang.dll!CMsqlExecContext::FExecute
sqllang.dll!CSQLSource::Execute
sqllang.dll!CSQLObject::ExecuteFunction
sqllang.dll!CUdfExecInfo::InvokeTSQLScalarUDF
sqllang.dll!UDFInvokeImpl
sqltses.dll!CEsExec::GeneralEval4
sqlmin.dll!CQScanProjectNew::EvalExprs
sqlmin.dll!CQScanProjectNew::GetRow
sqlmin.dll!CQScanLightProfileNew::GetRow
sqlmin.dll!CQueryScan::GetRow
sqllang.dll!CXStmtQuery::ErsqExecuteQuery
sqllang.dll!CXStmtSelect::XretExecute
sqllang.dll!CMsqlExecContext::ExecuteStmts&amp;lt;1,1&amp;gt;
sqllang.dll!CMsqlExecContext::FExecute
sqllang.dll!CSQLSource::Execute
sqllang.dll!ExecuteSql
sqllang.dll!CSpecProc::ExecuteSpecial
sqllang.dll!CSpecProc::Execute
sqllang.dll!process_request
sqllang.dll!process_commands_internal
sqllang.dll!process_messages
sqldk.dll!SOS_Task::Param::Execute
sqldk.dll!SOS_Scheduler::RunTask
sqldk.dll!SOS_Scheduler::ProcessTasks
sqldk.dll!SchedulerManager::WorkerEntryPoint
sqldk.dll!SystemThreadDispatcher::ProcessWorker
sqldk.dll!SchedulerManager::ThreadEntryPoint
kernel32.dll!BaseThreadInitThunk
ntdll.dll!RtlUserThreadStart
[Root]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is because log shipping is calling system function&amp;nbsp;&lt;STRONG&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/relational-databases/system-functions/sys-fn-hadr-backup-is-preferred-replica-transact-sql?view=sql-server-ver16" target="_blank" rel="noopener"&gt;sys.fn_hadr_backup_is_preferred_replica&lt;/A&gt;&lt;/STRONG&gt; for those backups so it can gather AG related backup preferences and act accordingly.&lt;/P&gt;
&lt;P&gt;This system function is using certain system views which are built on Cluster API calls in the background to fetch this data (AG role ownership) from Cluster database.&lt;/P&gt;
&lt;H5&gt;&lt;SPAN data-teams="true"&gt;Cause &lt;/SPAN&gt;&lt;/H5&gt;
&lt;P&gt;Concurrent and repetitive calls to this API can cause this high CPU usage.&lt;/P&gt;
&lt;H5&gt;&lt;SPAN data-teams="true"&gt;Resolution&lt;/SPAN&gt;&lt;/H5&gt;
&lt;P&gt;This is due to live nature of those parameters and mitigation is to be differentiating the backup times to minimize that concurrency or distribute AG Primaries to multiple replicas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 May 2025 10:54:36 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/you-may-see-high-cpu-usage-after-enabling-the-log-shipping-with/ba-p/4405038</guid>
      <dc:creator>haci</dc:creator>
      <dc:date>2025-05-13T10:54:36Z</dc:date>
    </item>
    <item>
      <title>SQL Server の更新プログラム GDR, CU, Service Pack の違いと適用可否</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/sql-server-%E3%81%AE%E6%9B%B4%E6%96%B0%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0-gdr-cu-service-pack-%E3%81%AE%E9%81%95%E3%81%84%E3%81%A8%E9%81%A9%E7%94%A8%E5%8F%AF%E5%90%A6/ba-p/4405534</link>
      <description>&lt;P&gt;こんにちは、 SQL Server サポートです。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;今回は、SQL Server の GDR, CU, Service Pack の違いと適用可否について紹介します。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;H4&gt;&lt;STRONG&gt;GDR、CU、Service Pack の違い&lt;/STRONG&gt;&lt;/H4&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;SQL Server の更新プログラムには主に GDR, CU, Service Pack の3種類があります。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;H5&gt;&lt;STRONG&gt;GDR (General Distribution Release)&lt;/STRONG&gt;&lt;/H5&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;主にセキュリティ関連の修正を提供します。&lt;/P&gt;
&lt;P&gt;そのバージョンのSQL Server の以前のGDR のすべての修正を含みます。&lt;/P&gt;
&lt;P&gt;例えば、CU も GDR も適用していない SQL Server 2019 で、SQL Server 2019 向けの GDR5 を適用すると、GDR1～GDR4の修正も適用されます。&lt;/P&gt;
&lt;P&gt;そのため、GDR1 → GDR2 → GDR3 →・・・のように段階的に適用する必要はありません。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="2"&gt;
&lt;LI&gt;
&lt;H5&gt;&lt;STRONG&gt;CU (Cumulative Update)&lt;/STRONG&gt;&lt;/H5&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;機能改善やバグ修正を含む更新を提供します。&lt;/P&gt;
&lt;P&gt;そのバージョンのSQL Server の以前のCU や以前のGDR のすべての修正を含みます。&lt;/P&gt;
&lt;P&gt;例えば、CU も GDR も適用していない SQL Server 2019 で、SQL Server 2019 向けの CU5 を適用すると、CU1～CU4の修正も適用されます。&lt;/P&gt;
&lt;P&gt;そのため、CU1 → CU2 → CU3 →・・・のように段階的に適用する必要はありません。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="3"&gt;
&lt;LI&gt;
&lt;H5&gt;&lt;STRONG&gt;Service Pack&lt;/STRONG&gt;&lt;/H5&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;大規模な更新を提供し、複数の修正や新機能をまとめて提供します。&lt;/P&gt;
&lt;P&gt;そのバージョンのSQL Server の以前のService Pack や以前のCU、以前のGDR のすべての修正を含みます。&lt;/P&gt;
&lt;P&gt;そのため、例えば どの Service Pack も適用していない SQL Server 2016 で、Service Pack 3 を適用したい場合、 Service Pack1 → Service Pack2 → Service Pack3 のように段階的に適用する必要はありません。&lt;/P&gt;
&lt;P&gt;ただし、どの Service Pack も適用していない SQL Server 2016 で Service Pack 3用の CU や GDR を適用したい場合は、Service Pack3 → 目的の CU や GDR のように適用する必要があります。&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;なお、Service Pack は SQL Server 2016 以前で提供されていました。&lt;/P&gt;
&lt;P&gt;シンプルで予測可能なメインストリームサービス ライフサイクルを採用したため、SQL Server 2017 以降ではService Pack は存在せず、CU と GDR のみとなります。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;H4&gt;&lt;STRONG&gt;GDR、 CU、 Service Pack の適用可否&lt;/STRONG&gt;&lt;/H4&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;・GDR を適用済みの SQL Server には、より新しい GDR か Service Pack か CU が適用できます。&lt;/P&gt;
&lt;P&gt;・CU を適用済みの SQL Server には、より新しい CU か Service Pack が適用できます。&lt;/P&gt;
&lt;P&gt;・Service Pack が適用済みのSQL Server で、かつ CU も GDR も適用していない場合は、その Service Pack 用の CU または その Service Pack 用の GDR を適用できます。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;各バージョンの SQL Server の最新の更新プログラムは下記から確認できます。&lt;/P&gt;
&lt;P&gt;// SQL Server の最新の更新プログラムとバージョン履歴 - SQL Server | Microsoft Learn&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/ja-jp/troubleshoot/sql/releases/download-and-install-latest-updates" target="_blank"&gt;https://learn.microsoft.com/ja-jp/troubleshoot/sql/releases/download-and-install-latest-updates&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;※参考情報&lt;/P&gt;
&lt;P&gt;// Announcing the Modern Servicing Model for SQL Server | Microsoft Community Hub&lt;/P&gt;
&lt;P&gt;&lt;A href="https://techcommunity.microsoft.com/blog/sqlserver/announcing-the-modern-servicing-model-for-sql-server/385594" target="_blank"&gt;https://techcommunity.microsoft.com/blog/sqlserver/announcing-the-modern-servicing-model-for-sql-server/385594&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// SQL Server 累積的更新プログラム (CU) のインストールに関する一般的な問題のトラブルシューティング - SQL Server | Microsoft Learn&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/ja-jp/troubleshoot/sql/database-engine/install/windows/sqlserver-patching-issues#cumulative-update-and-service-pack-installation-information" target="_blank"&gt;https://learn.microsoft.com/ja-jp/troubleshoot/sql/database-engine/install/windows/sqlserver-patching-issues#cumulative-update-and-service-pack-installation-information&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// SQL Server のサービス モデル - SQL Server | Microsoft Learn&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/ja-jp/troubleshoot/sql/releases/servicing-models-sql-server" target="_blank"&gt;https://learn.microsoft.com/ja-jp/troubleshoot/sql/releases/servicing-models-sql-server&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;※本情報の内容（添付文書、リンク先などを含む）は、作成日時点でのものであり、予告なく変更される場合があります。&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 23:54:25 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/sql-server-%E3%81%AE%E6%9B%B4%E6%96%B0%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0-gdr-cu-service-pack-%E3%81%AE%E9%81%95%E3%81%84%E3%81%A8%E9%81%A9%E7%94%A8%E5%8F%AF%E5%90%A6/ba-p/4405534</guid>
      <dc:creator>Mizuho_Kitao</dc:creator>
      <dc:date>2025-04-17T23:54:25Z</dc:date>
    </item>
    <item>
      <title>Kerberos Authentication flow</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/kerberos-authentication-flow/ba-p/4387781</link>
      <description>&lt;P&gt;&lt;SPAN class="lia-text-color-8"&gt;&lt;STRONG&gt;Video version&lt;/STRONG&gt;&lt;/SPAN&gt;: &lt;A class="lia-external-url" href="https://youtu.be/lEBHG5zcx2s" target="_blank" rel="noopener"&gt;Kerberos Authentication flow&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Whenever you login with Windows Authentication to the sever like SQL Server, in many cases, Kerberos is used as a main authentication type.&lt;/P&gt;
&lt;P&gt;In short, Kerberos is a secure method for verifying the identity of users and services in a network to authenticate users.&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;So, suppose, Kerberos authentication started to fail and your application cannot login? You started to panic and want to troubleshoot as soon as possible! But you do not know how to do that because you do not understand how this authentication works internally. In this case, if you know how Kerberos functions internally, it becomes much easier for you to troubleshoot this issue.&amp;nbsp;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;The below is the Kerberos authentication flow at high level:&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;1. Whenever client tries to login to the server, it should first do Name resolution. If there is no DNS cache, it will connect domain controller and bring IP address for the server DNS name.&lt;/P&gt;
&lt;P&gt;2. Afterwards, there will be three-way TCP handshake with the server.&lt;/P&gt;
&lt;P&gt;3. Following TCP handshake, servers negotiate on protocol types of authentications: NTLM or KERBEROS. Often Kerberos is chosen as this is new protocol with more performance efficiency.&lt;/P&gt;
&lt;P&gt;4. After Kerberos is chosen, Client will do TCP handshake on TCP port 88.&lt;/P&gt;
&lt;P&gt;5. Then, client will send AS-REQ packet to KDC center in domain controller. AS-REQ (Authentication Service Request) is the initial message sent by a client to the Key Distribution Center (KDC) in Domain controller to get TGT. This message includes the client's principal name (username) and may include pre-authentication data such as password. If the username is correct and password is valid, domain controller sends AS RESPONSE. This response includes TGT key and session key. Here is the important point: TGT key is encrypted with password of KRBTGT account and session key is encrypted with client's password. If you go to your domain controller, you will see this KRBGT account. TGT is encrypted with this account’s password.&lt;/P&gt;
&lt;P&gt;When the client receives the TGT, it decrypts the session key with password and this session key is placed in memory along with the TGT. Going forward the account’s password is no longer required.&amp;nbsp; When the client makes subsequent ticket requests it will present the TGT and creates a new authentication using the session key and the system timestamp.&lt;/P&gt;
&lt;P&gt;6. After getting TGT and session key, client makes TGS request presenting TGT and service principal name (SPNs) of the service the client wants to access.&lt;/P&gt;
&lt;P&gt;7. After getting TGS-REQ, domain controller decrypts TGT ticket, validates the user and SPNs. If the SPNs are correctly registered and user credentials, TGT ticket are valid, domain controller responds with TGS-REP which includes the service ticket and a session key. The service ticket is encrypted with the service's secret key, while the session key is encrypted with the client's session key. Here, important point is service ticket is encrypted with the password of service account attached to the server and session key is encrypted by the client’s session key. Therefore, client cannot decrypt service ticket.&lt;/P&gt;
&lt;P&gt;8. Finally, by using this service ticket, client makes AP request to the server.&amp;nbsp; And AP-REP is received. This AP-REP is often not mandatory and does not happen depending on the service type. With this, KERBEROS authentication finishes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Authentication flow in network traces&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;1. TCP-handshake&lt;/P&gt;
&lt;P&gt;2. First, as we learn AS REQUEST is sent. One important point here: first AS-REQ fails with PRE-AUTH REQUIRED error because client did not send pre-authorization, or did not send the appropriate type of pre-authorization, to receive a ticket. The client will retry with the appropriate kind of pre-authorization (the KDC returns the pre-authentication type in the error). Many Kerberos implementations will start off without preauthenticated data and only add it in a subsequent request when it sees this error. This is expected and you should ignore this.&lt;/P&gt;
&lt;P&gt;3. Afterwards, client again sends AS-REQUEST with appropriate pre-authorization.&lt;/P&gt;
&lt;P&gt;4. Domain controller is responding with AS-REP and providing encrypted TGT ticket and session key.&lt;/P&gt;
&lt;P&gt;5. B&lt;SPAN style="font-style: var(--lia-blog-font-style); font-weight: var(--lia-blog-font-weight); font-family: var(--lia-blog-font-family); background-color: var(--lia-rte-bg-color); color: var(--lia-bs-body-color); font-size: var(--lia-bs-font-size-base);"&gt;y using this session key and TGT, client is making TGS request. It also includes SPN names.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-style: var(--lia-blog-font-style); font-weight: var(--lia-blog-font-weight); font-family: var(--lia-blog-font-family); background-color: var(--lia-rte-bg-color); color: var(--lia-bs-body-color); font-size: var(--lia-bs-font-size-base);"&gt;6. Finally,&amp;nbsp;&lt;/SPAN&gt;domain controller responds TGS response and includes service key. By using this service key, client makes authentication request.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Mar 2025 04:31:35 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/kerberos-authentication-flow/ba-p/4387781</guid>
      <dc:creator>Arslanov</dc:creator>
      <dc:date>2025-03-09T04:31:35Z</dc:date>
    </item>
    <item>
      <title>About SQL Server Error 13542</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/about-sql-server-error-13542/ba-p/4378584</link>
      <description>&lt;P&gt;Recently we have received a problem report about the following error:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Msg 13542, Level 16, State 0, Line 42&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;ADD PERIOD FOR SYSTEM_TIME on table 'xxx' failed because there are open records with start of period set to a value in the future.&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I would like to share the cause of the problem and the solution here to help DBAs experiencing the same problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Background:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You can add versioning data to an existing non-temporal table with data populated to make it a temporal table. The document below contains a sample script in the "Add versioning to non-temporal tables" section for this purpose.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/relational-databases/tables/creating-a-system-versioned-temporal-table?view=sql-server-ver16#add-versioning-to-non-temporal-tables" target="_blank" rel="noopener"&gt;Create a system-versioned temporal table - SQL Server | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Note that in the sample script, the column for "ROW START" column the data type is set to DATETIME2 as follows.&lt;/P&gt;
&lt;DIV class="styles_lia-table-wrapper__h6Xo9 styles_table-responsive__MW0lN"&gt;
&lt;TABLE border="1" width="100%"&gt;&lt;COLGROUP&gt;&lt;COL width="99.8529%" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;ValidFrom &lt;STRONG&gt;DATETIME2&lt;/STRONG&gt; GENERATED ALWAYS AS ROW START HIDDEN CONSTRAINT DF_InsurancePolicy_ValidFrom &lt;STRONG&gt;DEFAULT SYSUTCDATETIME()&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;P&gt;If you change &lt;STRONG&gt;DATETIME2&lt;/STRONG&gt; to &lt;STRONG&gt;DATETIME2(x)&lt;/STRONG&gt;, by specifying a precision x (range is 0 - 7) for the floating-point part, the aforementioned error may occur when adding the value of the ValidFrom column for existing data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Cause:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When adding the value of &lt;STRONG&gt;SYSUTCDATETIME() &lt;/STRONG&gt;as the default ValidFrom value for existing data, because of the precision specified with the &lt;STRONG&gt;DATATIME2(x)&lt;/STRONG&gt;, SQL Server needs to round the time to the nearest value with that precision. This can be either "round up" or "round down", depending whether the last digit within the precision is larger than 4 or not. In the case of "round up", the result is a time value in the future.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Workaround:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Change &lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;DEFAULT SYSUTCDATETIME()&lt;/STRONG&gt; &lt;BR /&gt;to &lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; DEFAULT DATEADD(SECOND,-1, SYSUTCDATETIME())&lt;/STRONG&gt; &lt;BR /&gt;so that the time is not in the future even in the case of "round up".&lt;/P&gt;
&lt;DIV class="styles_lia-table-wrapper__h6Xo9 styles_table-responsive__MW0lN"&gt;
&lt;TABLE border="1" width="100%"&gt;&lt;COLGROUP&gt;&lt;COL width="99.8529%" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;ValidFrom &lt;STRONG&gt;DATETIME2(0)&lt;/STRONG&gt; GENERATED ALWAYS AS ROW START HIDDEN CONSTRAINT DF_InsurancePolicy_ValidFrom &lt;STRONG&gt;DEFAULT DATEADD(SECOND,-1, SYSUTCDATETIME())&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;Documentation for DATETIME2:&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/t-sql/data-types/datetime2-transact-sql?view=sql-server-ver16" target="_blank" rel="noopener"&gt;datetime2 (Transact-SQL) - SQL Server | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2025 04:32:16 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/about-sql-server-error-13542/ba-p/4378584</guid>
      <dc:creator>cleng-ms</dc:creator>
      <dc:date>2025-02-14T04:32:16Z</dc:date>
    </item>
    <item>
      <title>SQL Server がインストールされていないAzure VM において、「Failed to find SQL instance to target」を含むメッセージが記録される</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/sql-server-%E3%81%8C%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%81%AA%E3%81%84azure-vm-%E3%81%AB%E3%81%8A%E3%81%84%E3%81%A6-failed-to-find-sql/ba-p/4242995</link>
      <description>&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 11.0pt; color: #333333;"&gt;&lt;SPAN&gt;こんにちは。SQL Server サポート チームです。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 11.0pt; color: #333333;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 11.0pt; color: #333333;"&gt;&lt;STRONG&gt;事象&lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 11.0pt;"&gt;&lt;SPAN&gt;SQL Server &lt;/SPAN&gt;&lt;SPAN&gt;がインストールされていない&lt;/SPAN&gt;&lt;SPAN&gt;Azure VM &lt;/SPAN&gt;&lt;SPAN&gt;において、&lt;/SPAN&gt;&lt;SPAN&gt;Windows &lt;/SPAN&gt;&lt;SPAN&gt;イベントログのアプリケーションログに以下のメッセージが記録される場合があります。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 11.0pt;"&gt;&lt;SPAN&gt;　-- &lt;/SPAN&gt;&lt;SPAN&gt;ソース&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 11.0pt;"&gt;&lt;FONT color="#000000"&gt;　Microsoft SQL Server IaaS Agent Setup&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 11.0pt;"&gt;&lt;SPAN&gt;　-- &lt;/SPAN&gt;&lt;SPAN&gt;メッセージ&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 11.0pt;"&gt;&lt;FONT color="#000000"&gt;　Failed to find SQL instance to target. Skipping 'NT Service\\SQLIaaSExtensionQuery' removal from sql logins.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 11.0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;メッセージ&lt;/STRONG&gt;&lt;STRONG&gt;の原因&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;SQL IaaS Agent 拡張機能への自動登録機能を有効化しているサブスクリプションにおいては、Azure VM に対して&amp;nbsp; SQL Server がインストールされているかどうかを検出するジョブが毎月実行されます。&lt;/P&gt;
&lt;P&gt;また、自動登録機能が有効化されているかどうかに関わらず、弊社の計画メンテナンスによって、SQL Server がインストールされているかどうかを検出するジョブが実行されます。&lt;/P&gt;
&lt;P&gt;したがって、上述のジョブにより&lt;SPAN&gt;Azure &lt;/SPAN&gt;VMにSQL Serverがインストールされていないことを検出したことが発生原因となります。&lt;/P&gt;
&lt;P&gt;※計画メンテナンスのタイミングは不定期です。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SQL IaaS Agent&amp;nbsp;拡張機能への自動登録の有効化状況については、Azure Portal&amp;nbsp;から以下の手順で確認が可能です。&lt;/P&gt;
&lt;P&gt;　１．&lt;A href="https://portal.azure.com/" target="_blank" rel="noopener"&gt;Azure portal&lt;/A&gt;&amp;nbsp;にサインインします。&lt;/P&gt;
&lt;P&gt;　２．&lt;A href="https://portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/Microsoft.SqlVirtualMachine%2FSqlVirtualMachines" target="_blank" rel="noopener"&gt;[SQL 仮想マシン]&lt;/A&gt;&amp;nbsp;リソース ページに移動します。&lt;/P&gt;
&lt;P&gt;　３．[SQL Server VM の自動登録](Automatic SQL Server VM registration)&amp;nbsp;を選択して、 [SQL Server VM の自動登録](Automatic SQL Server VM registration)&amp;nbsp;ページを開きます。&lt;/P&gt;
&lt;P&gt;　　&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;　４．登録済みの場合は以下のように表示されます。&lt;/P&gt;
&lt;P&gt;　　&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SQL IaaS Agent&amp;nbsp;拡張機能への自動登録の詳細につきましては、下記の公開情報をご確認ください。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;　SQL IaaS Agent&amp;nbsp;拡張機能への自動登録&lt;/P&gt;
&lt;P&gt;　&lt;A href="https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/sql-agent-extension-automatic-registration-all-vms?view=azuresql&amp;amp;tabs=azure-cli" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/ja-jp/azure/azure-sql/virtual-machines/windows/sql-agent-extension-automatic-registration-all-vms?view=azuresql&amp;amp;tabs=azure-cli&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;影響&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;SQL Serverがインストールされていない&lt;SPAN&gt;Azure &lt;/SPAN&gt;VMにて記録されたものであれば、本メッセージによる影響はありません。&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;対処策&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;本メッセージはジョブの出力結果として記録されるため、出力を止めることはできません。&lt;/P&gt;
&lt;P&gt;監視ツールなどで監視されている場合は、必要に応じて監視対象から除外してください。&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 06:47:09 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/sql-server-%E3%81%8C%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%81%AA%E3%81%84azure-vm-%E3%81%AB%E3%81%8A%E3%81%84%E3%81%A6-failed-to-find-sql/ba-p/4242995</guid>
      <dc:creator>Masafumi_Hori</dc:creator>
      <dc:date>2024-09-16T06:47:09Z</dc:date>
    </item>
    <item>
      <title>101 of Troubleshooting SQL Server on Linux</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/101-of-troubleshooting-sql-server-on-linux/ba-p/4195732</link>
      <description>&lt;DIV&gt;
&lt;P&gt;Based on our extensive experience with customers using SQL on Linux, we have compiled a guide outlining fundamental troubleshooting steps and available tools to assist in resolving SQL on Linux issues. This guide aims to make it easier for SQL DBAs who have primarily worked on Windows operating systems over the years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this article, we will normalize three checks in Linux that we typically perform in Windows to start troubleshooting issues with SQL Server:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI class="x_elementToProof"&gt;System logs&lt;/LI&gt;
&lt;LI class="x_elementToProof"&gt;SQL Server logs&lt;/LI&gt;
&lt;LI class="x_elementToProof"&gt;Task Manager&lt;/LI&gt;
&lt;/UL&gt;
&lt;P class="x_elementToProof"&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;: The screenshots in the below examples are taken from RHEL and Ubuntu machines, and while the Linux flavors are different, the &lt;STRONG&gt;commands&amp;nbsp;&lt;/STRONG&gt;are similar in both environments.&amp;nbsp;&lt;/P&gt;
&lt;DIV class="x_elementToProof"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="x_elementToProof"&gt;&lt;STRONG style="color: inherit; font-family: inherit; font-size: 18px;"&gt;System logs:&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV class="x_elementToProof"&gt;
&lt;P&gt;It contains the log messages that the system processes and applications, and these messages are written as plain text log files.&lt;/P&gt;
&lt;P&gt;The rsyslog service keeps various log files in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;CODE&gt;/var/log&lt;/CODE&gt;&lt;/SPAN&gt;&amp;nbsp;directory. You can open these files using native commands such as&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;CODE&gt;tail&lt;/CODE&gt;,&lt;CODE&gt;head&lt;/CODE&gt;,&lt;CODE&gt;more&lt;/CODE&gt;,&lt;CODE&gt;less&lt;/CODE&gt;,&lt;CODE&gt;cat&lt;/CODE&gt;&lt;/SPAN&gt;,&amp;nbsp;and so forth, depending on what you are looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In RHEL and SLES, they are called messages, while in Ubuntu, you would find them as syslog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RHEL and SLES: The primary system log file is located at&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;CODE&gt;/var/log/messages&lt;/CODE&gt;&lt;/SPAN&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ubuntu: The main system log file is&lt;SPAN&gt;&amp;nbsp;&lt;CODE&gt;/var/log/syslog&lt;/CODE&gt;&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Log files and journals are &lt;SPAN&gt;crucial&amp;nbsp;&lt;/SPAN&gt;to a system administrator's work. They reveal a great deal of information about a system and are instrumental during troubleshooting and auditing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, in RHEL, to display boot and other kernel messages, view&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;CODE&gt;/var/log/messages&lt;/CODE&gt;&lt;/SPAN&gt;:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;[server]$ cat /var/log/messages&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;Use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;grep&lt;/CODE&gt;&amp;nbsp;and other filtering tools to gather more specific events from a file. You can also use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;tail&lt;/CODE&gt;&amp;nbsp;to view files as they are updated.&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;[server]$ tail -f /var/log/messages&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;CODE&gt;/var/log/secure&lt;/CODE&gt;&lt;/SPAN&gt;&amp;nbsp;file to view users and their activities:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;[server]$ tail -f /var/log/secure&lt;/CODE&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;Similarly in Ubuntu, we have&lt;/SPAN&gt;&lt;CODE&gt;/var/log/syslog&lt;/CODE&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="x_elementToProof"&gt;What does the &lt;STRONG&gt;syslog &lt;/STRONG&gt;or &lt;STRONG&gt;messages &lt;/STRONG&gt;file contain? how do we read them?&lt;/P&gt;
&lt;P class="x_elementToProof"&gt;These log files contain events and messages generated by the kernel, applications, and users that log into the system.&amp;nbsp;&lt;/P&gt;
&lt;P class="x_elementToProof"&gt;The logs are written in the below format.&lt;/P&gt;
&lt;OL start="1" data-listchain="__List_Chain_869"&gt;
&lt;LI&gt;
&lt;P class="x_elementToProof"&gt;The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;timestamp&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;indicates the time when a log entry was created in the format MMM dd HH:mm:ss. Notice that this format does not include a year.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P class="x_elementToProof"&gt;&lt;STRONG&gt;Hostname&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;is the host or system that originally create the message.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P class="x_elementToProof"&gt;&lt;STRONG&gt;Application&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is the application that created the message.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P class="x_elementToProof"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Message&amp;nbsp;&lt;/STRONG&gt;contains the actual details of an event.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the message/syslog could contain thousands/millions of lines as log entries, using '&lt;STRONG&gt;cat&lt;/STRONG&gt;' command alone might not be the right choice at times. I suggest using grep for filtering text through the files.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using tail -f command allows you to read the current log file in real time. You may combine it with '&lt;STRONG&gt;grep'&lt;/STRONG&gt; to filter on desired text.&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;An alternate method to validate the system events is via the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;journald&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Systemd-journald :&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;journald is a component of systemd responsible for handling logging. It captures logs, records them, and makes them easy to find. Unlike traditional syslog implementations, journald offers features like structured logging, indexing for fast search, access control, and signed messages.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The systemd-journald service does not keep separate files, as rsyslog does. The idea is to avoid checking different files for issues. Systemd-journald saves the events and messages in a binary format that cannot be read with a text editor. You can query the journal with the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;CODE&gt;journalctl&lt;/CODE&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;command.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;journald stores logs in memory (RAM) without persistent storage (by default), while the Traditional syslog (e.g., /var/log/messages) persists log data to flat files.&lt;/P&gt;
&lt;P&gt;To show all event messages, use:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;CODE&gt;[server]$ journalctl&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;P&gt;To view journal entries for today, use:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;[server]$ journalctl --since today&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;To check for messages related to the sql server service for the past hour, you can run:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;journalctl --unit mssql-server.service --since "1 hour ago"&lt;/CODE&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;img /&gt;
&lt;H3&gt;&amp;nbsp;&lt;/H3&gt;
&lt;H3&gt;&lt;STRONG&gt;SQL Server Error logs:&amp;nbsp;&lt;/STRONG&gt;&lt;/H3&gt;
The error log contains informational messages, warnings, and information about critical events. The error log also contains information about user-generated messages and auditing information such as logon events (success and failure).In Linux the default&amp;nbsp;&lt;SPAN&gt;SQL Errorlog location is&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;CODE&gt;/var/opt/mssql/log&lt;/CODE&gt;&lt;/SPAN&gt;
&lt;DIV&gt;(Keep in mind that you will require superuser permissions to traverse these folders and logs.)&lt;/DIV&gt;
&lt;DIV&gt;This is also the default location for XEvents, dump files and trace files.&lt;/DIV&gt;
&lt;DIV&gt;&lt;img /&gt;
&lt;H3 class="heading-anchor"&gt;&amp;nbsp;&lt;/H3&gt;
&lt;H3 id="comparing-error-and-application-log-output" class="heading-anchor"&gt;Comparing Error and System Logs Output&lt;/H3&gt;
&lt;SPAN&gt;You can use both the SQL Server error log and the system logs to identify the cause of problems. For example, while monitoring the SQL Server error log, you may encounter error messages that do not contain cause information. By comparing the dates and times for events between these logs, you can narrow the list of probable causes.&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;U&gt;Consider the following scenario&lt;/U&gt;: We receive an alert indicating that the application is unable to connect to SQL following a maintenance activity over the weekend. We log into the server to verify if SQL Server is operational.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;Upon inspection, we find that the SQL process is not running. We then check the status and attempt to start the SQL Server to see if it comes online.&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;On restarting SQL Server, we observe the following&amp;nbsp;information in the error logs. &lt;/SPAN&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Next, we need to examine the system event logs, specifically the&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;messages&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;file in RHEL &amp;amp; SLES or the&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;syslog&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;file in Ubuntu, where events are recorded.&lt;/SPAN&gt;&lt;SPAN&gt;We can use the following command to retrieve service logs from the recent boot:&lt;/SPAN&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;CODE&gt;journalctl --unit mssql-server.service --boot --no-pager&lt;/CODE&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;By validating the&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;messages&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;or&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;syslog&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;file within the same timeframe, we gather additional information.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;SPAN&gt;From the logs, we identify a permission issue on a specific folder or file that is preventing SQL Server from starting. Granting the necessary permissions should resolve the issue.&lt;/SPAN&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;STRONG&gt;Task Manager:&amp;nbsp;&lt;/STRONG&gt;&lt;/H3&gt;
&lt;SPAN&gt;Where is the Task Manager in Linux? There are command-line utilities that provide similar information to what we see in Windows. We will explore the&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;top&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;htop&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;utilities&lt;/SPAN&gt;
&lt;P&gt;&lt;CODE&gt;top&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;The &lt;U&gt;first line&lt;/U&gt; of numbers on the dashboard includes the time, how long your computer has been running, the number of people logged in, and what the load average has been for the past one, five, and 15 minutes. The&lt;U&gt; second line&lt;/U&gt; shows the number of tasks and their states: running, stopped, sleeping, or zombie.The next 3 lines describe CPU, Memory utilization, Swap Memory of the server.&amp;nbsp;&lt;BR /&gt;The column details of the process are tabulated as below.
&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;DIV&gt;To get into the details of a particular process, (In our case SQL Server) we can use the PID to get the further details of the SQL and the tasks that SQL is currently running.&lt;BR /&gt;To get the child PID of SQLServer, use this short command and run the top command on the pid.
&lt;DIV&gt;&lt;CODE&gt;pidof sqlservr | cut -d' ' -f1&lt;/CODE&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;CODE&gt;top -p (pid output of the above command)&lt;/CODE&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;img /&gt;
&lt;DIV&gt;We can also get them into single command as shown below,&lt;/DIV&gt;
&lt;DIV&gt;&lt;CODE&gt;top -p $(pidof sqlservr | cut -d' ' -f1)&lt;/CODE&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;img /&gt;
&lt;P&gt;We see the utilization of various tasks within SQL Server, that are consuming the resources.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Another utility that provides similar information is&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;htop&lt;/CODE&gt;&lt;SPAN&gt;. The key difference is that&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;htop&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;offers a more user-friendly experience with its use of colors and graphs, compared to the&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;top&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;command.&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;SPAN&gt;While&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;top&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;htop&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;provide valuable information, there are additional command-line tools such as&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;vmstat&lt;/CODE&gt;&lt;SPAN&gt;, System Activity Information (&lt;/SPAN&gt;&lt;CODE&gt;sar&lt;/CODE&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;iostat&lt;/CODE&gt;&lt;SPAN&gt;, and others. I suggest running these commands on your test machines and monitoring the output to become familiar with checking performance metrics on a Linux server.&lt;/SPAN&gt;&lt;BR /&gt;References:&amp;nbsp;
&lt;DIV&gt;&lt;STRONG&gt;SLES&lt;/STRONG&gt;:&amp;nbsp;&lt;A id="LPlnk341924" style="font-family: inherit; background-color: #ffffff;" href="https://documentation.suse.com/sles/12-SP5/html/SLES-all/cha-util.html#" target="_blank" rel="noopener"&gt;https://documentation.suse.com/sles/12-SP5/html/SLES-all/cha-util.html#&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;RHEL:&lt;/STRONG&gt;&lt;A id="LPlnk" style="font-family: inherit; background-color: #ffffff;" href="https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/performance_tuning_guide/sect-red_hat_enterprise_linux-performance_tuning_guide-performance_monitoring_tools-built_in_command_line_tools" target="_blank" rel="noopener"&gt;https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/performance_tuning_guide/sect-red_hat_enterprise_linux-performance_tuning_guide-performance_monitoring_tools-built_in_command_line_tools&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;Ubuntu:&amp;nbsp;&lt;/STRONG&gt;&lt;A id="LPlnk402641" style="font-family: inherit; background-color: #ffffff;" href="https://manpages.ubuntu.com/manpages/jammy/man1/top.1.html#2.%20summary%20display" target="_blank" rel="noopener"&gt;https://manpages.ubuntu.com/manpages/jammy/man1/top.1.html#2.%20summary%20display&lt;/A&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;I hope this serves as a helpful introduction to basic troubleshooting for SQL on Linux.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 19 Jul 2024 15:36:18 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/101-of-troubleshooting-sql-server-on-linux/ba-p/4195732</guid>
      <dc:creator>Infant_Arockiaraj</dc:creator>
      <dc:date>2024-07-19T15:36:18Z</dc:date>
    </item>
    <item>
      <title>Effectively troubleshoot latency in SQL Server Transactional replication: Part 2</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/effectively-troubleshoot-latency-in-sql-server-transactional/ba-p/4193522</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;Let us continue our troubleshooting by checking threads in this part.&lt;/FONT&gt;&lt;/P&gt;
&lt;H3&gt;Step 4.1. Troubleshoot latency in Log Reader agent’s reader thread&lt;/H3&gt;
&lt;OL class="lia-list-style-type-lower-alpha"&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Firstly, define the level of reader thread latency by running below query in Publisher server&lt;/FONT&gt;.&lt;BR /&gt;&lt;LI-CODE lang="sql"&gt;sp_replcounters
GO​&lt;/LI-CODE&gt;&lt;img /&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;The above shows reader thread replicating on average 115 transactions per second and more than 7.5mln transactions are waiting to be replicated to the distribution database. On average, transactions are waiting 134880secs to be replicated, which is high latency.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Run below in publisher server and find session id of Log Reader’ reader thread:&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;SELECT 
   SessionId    = s.session_id, 
   App          = ISNULL(s.program_name, N'')
    FROM sys.dm_exec_sessions s
WHERE s.program_name LIKE '%LogReader%'&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Place the &lt;STRONG&gt;&lt;FONT color="#DF0000"&gt;session id&lt;/FONT&gt;&lt;/STRONG&gt; to the below Event session and create event session. Run the session for about 5mins:&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;CREATE EVENT SESSION [LogReaderMonitor] ON SERVER
  ADD EVENT sqlos.wait_completed(
      ACTION(package0.callstack)
         WHERE ([sqlserver].[session_id]=(123))), ---Change session id here
  ADD EVENT sqlos.wait_info_external(
      ACTION(package0.callstack)
         WHERE (([opcode]=('End')) AND ([sqlserver].[session_id]=(123)))), ---Change session id here
  ADD EVENT sqlserver.rpc_completed(
      ACTION(package0.callstack)
         WHERE ([sqlserver].[session_id]=(123)))  ---Change session id here
ADD TARGET package0.event_file(SET filename=N'C:\Temp\logreader_reader_track',max_file_size=(256),max_rollover_files=(5))
WITH (MAX_MEMORY=8192 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=ON,STARTUP_STATE=OFF)
GO&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Investigate the event file. For example, below you can confirm the activities with the same GUID with sequence ids. As you can see, initially, we are spending time for memory allocation and then sp_replcmds is finishing after 789 microseconds. &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;FONT color="#DF0000"&gt;Note: duration of wait_info_external is in milliseconds while rpc_completed is in microseconds&lt;/FONT&gt;.&lt;/FONT&gt;&lt;img /&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If wait time is high compared to CPU time, check wait type and troubleshoot accordingly. For example, on the above example we faced MEMORY_ALLOCATION_EXT wait_type but duration is 0. So, we are not waiting.&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If&amp;nbsp;CPU time&amp;nbsp;is higher, this means log thread is running but latency is being observed because you have high load. High load can be caused by several causes:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;Large batch of replicated transactions&lt;/STRONG&gt;: large batch of transactions are the main cause of latency in reader thread performance. Check number of commands and transactions in agent statistics from verbose logs we obtained in Step 3.1.b. If the number of commands is significantly high compared to the number of transactions, it is possible that large transactions are being replicated. For example, as below:&lt;/FONT&gt;&lt;BR /&gt;&lt;img /&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;If Reader Latency is caused by large number of pending commands, waiting for the Log Reader to catch up may be the best short-term solution. Long-term options include replicating batches during non-peak time.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;OL start="2"&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;Large number of non-replication transactions: &lt;/STRONG&gt;A transaction log with a high percentage of non-replicated transaction will cause latency as the Log Reader scans over transaction to be ignored. You can check whether this problem exists by looking at Log Reader agent history we checked in Step 3.1.a. For example, in the below log reader history, we can see more than 5mln rows are being scanned but only 142 rows have been marked for replication.&lt;/FONT&gt;&lt;img /&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;In this case, ensure constant transaction log truncation and try to perform maintenance activities offline.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;OL start="3"&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;High number of VLFs: &lt;/STRONG&gt;A large number of Virtual Log Files (VLFs) can contribute to long running read times. For the number of VLFs, execute the following command. Counts in 100K+ may be contributing to Log Reader Reader-Thread performance problems.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;SELECT COUNT (DISTINCT vlf_sequence_number) FROM sys.dm_db_log_info ( PublisherDBID )&lt;/FONT&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;H3&gt;Step 4.2. Troubleshoot latency in Log Reader agent’s writer thread&lt;/H3&gt;
&lt;OL class="lia-list-style-type-lower-alpha"&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;By using log reader’s history log (refer to Step 3.1.a), you can get last transaction sequence number and delivery rate, latency information. If you do not observe latency in reader thread (Step 4.1), this means the latency rate is mainly by writer thread:&lt;/FONT&gt;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;You can use below command to check transaction (xact_seqno) at where we are currently:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;-- Get publisher db id
USE distribution
GO

SELECT * FROM dbo.MSpublisher_databases
-- Get commands we are at
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
GO

BEGIN TRAN
USE distribution
GO

EXEC Sp_browsereplcmds
@xact_seqno_start = 'xact_seqno',
@xact_seqno_end = 'xact_seqno',
@publisher_database_id = PUBLISHERDB_ID
COMMIT TRAN
GO&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Run below in publisher server and find session id of Log Reader’ writer thread:&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;SELECT 
       SessionId    = s.session_id, 
       App            = ISNULL(s.program_name, N'')
FROM sys.dm_exec_sessions s
WHERE s.program_name LIKE '%LogReader%'&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Check whether any blocking happening with this session:&lt;BR /&gt;&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;sp_who2​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Then run the below query in distributor server by changing the session id to log reader session id:&lt;/FONT&gt;&lt;BR /&gt;&lt;LI-CODE lang="sql"&gt;CREATE EVENT SESSION [logreader_writer_track] ON SERVER
  ADD EVENT sqlos.wait_completed(
    ACTION(package0.callstack)
    WHERE ([sqlserver].[session_id]=(64))),  -- Change session id to log reader writer session id
  ADD EVENT sqlos.wait_info_external(
    ACTION(package0.callstack)
    WHERE (([opcode]=('End')) AND ([sqlserver].[session_id]=(64)))), -- Change session id to log reader writer session id
  ADD EVENT sqlserver.sp_statement_completed(  
ACTION(package0.event_sequence,sqlserver.plan_handle,sqlserver.session_id,sqlserver.transaction_id)
    WHERE ([sqlserver].[session_id]=(64)))  -- Change session id to log reader writer session id
ADD TARGET package0.event_file(SET filename=N'C:\Temp\logreader_writer_track',max_file_size=(256),max_rollover_files=(5))
WITH (MAX_MEMORY=8192 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=ON,STARTUP_STATE=OFF)​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Investigate the collected event logs. For example, below you can confirm the activities with the same GUID with sequence ids. Each of this activity is writer threads attempt to write replication logs to distribution database. As you can see, we spent very little time (nearly 0) initially for MEMORY_ALLOCATION_EXT, then select statement is finishing after 39 microseconds.&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;Compare wait time (duration – cpu_time) and cpu_time. If wait time is high compared to CPU time, check wait_type and troubleshoot accordingly. For example, above we face MEMORY_ALLOCATION_EXT wait_type. If CPU time is high, you can investigate the execution plan by using corresponding plan_handle for time consuming query which you can get from above event logs:&lt;/FONT&gt;&lt;BR /&gt;&lt;LI-CODE lang="sql"&gt;SELECT * FROM sys.dm_exec_query_plan(PLAN_HANDLE)​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;H3&gt;Step 4.3. Troubleshoot latency in Distribution agent’s reader thread&lt;/H3&gt;
&lt;OL class="lia-list-style-type-lower-alpha"&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;To find the session id for Distribution agent, you need to find if it is a Push or Pull Subscription.&amp;nbsp;In the case of push subscription, run below command in distributor server. In the case of Pull subscription, run below command in subscriber server.&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;SELECT 
       SessionId    = s.session_id, 
       App            = ISNULL(s.program_name, N'') 
FROM sys.dm_exec_sessions s LEFT OUTER JOIN sys.dm_exec_connections c ON (s.session_id = c.session_id)
WHERE (select text from sys.dm_exec_sql_text(c.most_recent_sql_handle)) LIKE '%sp_MSget_repl_command%'&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Check whether any blocking happening with this session:&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;sp_who2&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Then run the below query in distributor server by changing the session id to distribution agent session id:&lt;/FONT&gt;&lt;BR /&gt;&lt;LI-CODE lang="sql"&gt;CREATE EVENT SESSION [distributor_writer_track] ON SERVER
ADD EVENT sqlos.wait_completed(
    ACTION(package0.callstack)
    WHERE ([sqlserver].[session_id]=(64))),  -- Change session id to dist agent session id
ADD EVENT sqlos.wait_info_external(
    ACTION(package0.callstack)
    WHERE (([opcode]=('End')) AND ([sqlserver].[session_id]=(64)))), -- Change session id to dist agent session id
ADD EVENT sqlserver.sp_statement_completed(
   ACTION(package0.event_sequence,sqlserver.plan_handle,sqlserver.session_id,sqlserver.transaction_id)
    WHERE ([sqlserver].[session_id]=(64)))  -- Change session id to dist agent session id
ADD TARGET package0.event_file(SET filename=N'C:\Temp\distributor_reader_track',max_file_size=(256),max_rollover_files=(5))
WITH (MAX_MEMORY=8192 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=ON,STARTUP_STATE=OFF)&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Investigate the collected event logs. For example, below you can confirm the activities with the same GUID with sequence ids. Each of this activity is reader threads attempt to read replication logs. As you can see, we spent very little time (nearly 0) initially for MEMORY_ALLOCATION_EXT, then select statement is finishing after 29 microseconds.&lt;BR /&gt;&lt;/FONT&gt;&lt;img /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Compare wait time (duration – cpu_time) and cpu_time. If wait time is high compared to CPU time, check wait_type and troubleshoot accordingly. For example, above we face MEMORY_ALLOCATION_EXT wait_type. If CPU time is high, you can investigate the execution plan by using corresponding plan_handle for time consuming query which you can get from above event logs:&lt;/FONT&gt;&lt;BR /&gt;&lt;LI-CODE lang="sql"&gt;SELECT * FROM sys.dm_exec_query_plan(PLAN_HANDLE)​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;FONT size="2"&gt;High CPU time can often mean there is a high load which can be caused by large batch of replicated transactions. You can compare the number of commands and transactions by using the below query.&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;SELECT count(c.xact_seqno) as CommandCount, count(DISTINCT t.xact_seqno) as TransactionCount
FROM MSrepl_commands c with (nolock)
LEFT JOIN msrepl_transactions t with (nolock)
on t.publisher_database_id = c.publisher_database_id and t.xact_seqno = c.xact_seqno
WHERE c.publisher_database_id = 1 --Change to target database id here&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;For the past days’ statistics, you can leverage below command:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;USE distribution
select t.publisher_database_id, t.xact_seqno,
max(t.entry_time) as EntryTime, count(c.xact_seqno) as
CommandCount, count(DISTINCT t.xact_seqno) as TransactionCount
into #results
FROM MSrepl_commands c with (nolock)
LEFT JOIN msrepl_transactions t with (nolock)
on t.publisher_database_id = c.publisher_database_id
and t.xact_seqno = c.xact_seqno
GROUP BY t.publisher_database_id, t.xact_seqno
SELECT publisher_database_id
,datepart(year, EntryTime) as Year
,datepart(month, EntryTime) as Month
,datepart(day, EntryTime) as Day
,datepart(hh, EntryTime) as Hour
,sum(CommandCount) as CommandCountPerTimeUnit
,sum(TransactionCount) as TransactionCountPerTimeUnit
FROM #results
GROUP BY publisher_database_id
,datepart(year, EntryTime)
,datepart(month, EntryTime)
,datepart(day, EntryTime)
,datepart(hh, EntryTime)
ORDER BY publisher_database_id, Month, Day, Hour&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;As you see, I am executing one command per transaction making TransactionCount nearly equal to CommandCount.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;Step 4.4. Troubleshoot latency in Distribution agent’s writer thread&lt;/H3&gt;
&lt;OL class="lia-list-style-type-lower-alpha"&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Find the session id and App name for Distribution agent by inserting your publication name to WHERE clause below:&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;SELECT 
       SessionId    = s.session_id, 
       App            = ISNULL(s.program_name, N'')
    FROM sys.dm_exec_sessions s
WHERE s.program_name LIKE '%publish%'
GO&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Check whether there is blocking for the above session id(s):&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;sp_who2&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;Create event session by inserting &lt;FONT color="#DF0000"&gt;&lt;STRONG&gt;app name&lt;/STRONG&gt;&lt;/FONT&gt;:&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;CREATE EVENT SESSION [distributor_writer_track] ON SERVER
ADD EVENT sqlos.wait_completed(
    ACTION(package0.callstack,sqlserver.session_id,sqlserver.sql_text)
    WHERE ([sqlserver].[client_app_name]=N'SQLVM4-TRANSACR_AdventureWorksLT_test_table_pub' AND [package0].[greater_than_uint64]([duration],(0)))),
ADD EVENT sqlos.wait_info_external(
    ACTION(package0.callstack,sqlserver.session_id,sqlserver.sql_text)
    WHERE ([sqlserver].[client_app_name]=N'SQLVM4-TRANSACR_AdventureWorksLT_test_table_pub' AND [package0].[greater_than_uint64]([duration],(0)))),
ADD EVENT sqlserver.sp_statement_completed(
   ACTION(package0.event_sequence,sqlserver.plan_handle,sqlserver.session_id,sqlserver.transaction_id)
    WHERE ([sqlserver].[client_app_name]=N'SQLVM4-TRANSACR_AdventureWorksLT_test_table_pub'))
ADD TARGET package0.event_file(SET filename=N'C:\Temp\distributor_writer_track',max_file_size=(5),max_rollover_files=(5))
WITH (MAX_MEMORY=8192 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=ON,STARTUP_STATE=OFF)
GO&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Investigate the collected event logs. For example, below you can confirm the activities with the same GUID with sequence ids as statement levels. Can you find any high duration at any of the statements?&lt;/FONT&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Compare wait time (duration – cpu_time) and cpu_time. If wait time is high compared to CPU time, check wait_type and troubleshoot accordingly. For example, above we face NETWORK_IO wait_type. If CPU time is high, you can investigate the execution plan by using corresponding plan_handle for time consuming query which you can get from above event logs:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;SELECT * FROM sys.dm_exec_query_plan(PLAN_HANDLE)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Supervisor: Collin Benkler, Sr EE for SQL Server in Microsoft&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 05:54:04 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/effectively-troubleshoot-latency-in-sql-server-transactional/ba-p/4193522</guid>
      <dc:creator>Arslanov</dc:creator>
      <dc:date>2024-07-17T05:54:04Z</dc:date>
    </item>
    <item>
      <title>Effectively troubleshoot latency in SQL Server Transactional replication: Part 1</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/effectively-troubleshoot-latency-in-sql-server-transactional/ba-p/4193429</link>
      <description>&lt;H2&gt;High level transactional replication architecture&lt;/H2&gt;
&lt;P&gt;&lt;FONT size="2"&gt;The initial stage of transactional replication is initializing the subscriber. &lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Freplication%2Finitialize-a-transactional-subscription-without-a-snapshot%3Fview%3Dsql-server-ver16&amp;amp;data=05%7C02%7Cbarslanov%40microsoft.com%7Ceca4d8754a194f49435008dc23fbd4d7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638424811811103907%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&amp;amp;sdata=tlv7iJc333a1DakLAgaozhwJBpGwjPza9KqxAM9pd%2Fw%3D&amp;amp;reserved=0" target="_blank" rel="noopener"&gt;Although this can be done via backup&lt;/A&gt;, the typical approach generating a snapshot by the Snapshot Agent and storing it in the snapshot folder. It’s C:\Program Files\Microsoft SQL Server\&amp;lt;INST&amp;gt;\MSSQL\ReplData by default and configurable. Then, the Distribution Agent transfers the snapshot to the subscriber.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Afterwards, incremental changes in the published database are tracked and replicated to subscriber database. This replication process is done in three phases:&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;Transactions are marked "for replication" in the transaction log.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;The &lt;STRONG&gt;Log Reader Agent reader&lt;/STRONG&gt; thread scans through the transaction log using &lt;EM&gt;sp_replcmds &lt;/EM&gt;and looks for transactions that are marked "for replication." These transactions are then saved to the distribution database by the &lt;STRONG&gt;Log Reader agent writer thread&lt;/STRONG&gt; using sp_MSadd_replcmds.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;The &lt;STRONG&gt;Distribution Agent reader thread&lt;/STRONG&gt; scans through the distribution database using sp_MSget_repl_commands. Then, by using the &lt;STRONG&gt;distribution writer thread&lt;/STRONG&gt;, this agent connects to the subscriber to apply those changes to the subscriber using sp_MSupd..., sp_MSins..., and sp_Msdel_* (where the “*” denotes the schema and object name of the published article)..&lt;/FONT&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.71429;"&gt;&lt;img /&gt;&lt;/P&gt;
&lt;H6 class="lia-align-center" style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #333333;"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Figure 1. Transactional Replication architecture that shows the locations of each thread and agent in &amp;nbsp;the case of Remote distributor and pull subscription case&lt;/FONT&gt;&lt;/H6&gt;
&lt;H2 style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #333333;"&gt;Troubleshooting steps&lt;/H2&gt;
&lt;P style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.71429;"&gt;&lt;FONT size="2"&gt;The following graph shows the process we use to troubleshoot. We troubleshoot by dividing the process into two parts.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.71429;"&gt;&lt;img /&gt;&lt;/P&gt;
&lt;H3 style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #333333;"&gt;Step 1. Get information about “Big Picture”&lt;/H3&gt;
&lt;P style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.71429;"&gt;&lt;FONT size="2"&gt;Before you dive into solving any issue, you need to fully understand the type of environment you have as there might have been changes you are unaware of. An easy way to do that is to run script&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/sqlserver-parikh/SQLServer/blob/master/Script%20Replication%20Topology" target="_blank" rel="noopener"&gt;SQLServer/Script Replication Topology at master · sqlserver-parikh/SQLServer (github.com)&lt;/A&gt;&amp;nbsp;which gives output like below.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.71429;"&gt;&lt;img /&gt;&lt;/P&gt;
&lt;H3 style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #333333;"&gt;Step 2. Get tracer tokens&lt;/H3&gt;
&lt;P style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.71429;"&gt;&lt;FONT size="2"&gt;After confirming the environment, insert tracer tokens and identify where we are stuck.&amp;nbsp;Tokens can be inserted via Replication Monitor:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.71429;"&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.71429;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.71429;"&gt;&lt;FONT size="2"&gt;For historical tracer token results, you can run below query in distributor and compare with current results, being the last row the last result:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;USE Distribution  
SELECT p.publication_id, p.publication, agent_id,  
Datediff(s,t.publisher_commit,t.distributor_commit) as 'Time To Dist (sec)',   
Datediff(s,t.distributor_commit,h.subscriber_commit) as 'Time To Sub (sec)'  
FROM MStracer_tokens t  
JOIN MStracer_history h  
ON t.tracer_id = h.parent_tracer_id  
JOIN MSpublications p 
ON p.publication_id = t.publication_id &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="box-sizing: border-box; margin: 0px; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: 300; line-height: 1.71429; color: #333333; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;FONT style="box-sizing: border-box;" color="#DF0000"&gt;&lt;STRONG style="box-sizing: border-box; font-weight: bold;"&gt;&lt;FONT size="3" style="box-sizing: border-box;"&gt;NOTE –&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="box-sizing: border-box; margin: 0px; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: 300; line-height: 1.71429; color: #333333; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;FONT size="2" style="box-sizing: border-box;"&gt;“distribution” is the default for the distribution database. Be sure to change this if you configured a different name for the distribution database. Additionally, this history is cleaned up any time replication upgrade scripts are executed, there is a change to the distributor configuration,&amp;nbsp; sp_MShistory_cleanup (depending on retention duration specified), or sp_MSdelete_tracer_history is executed (again, depending on parameters used).&lt;BR style="box-sizing: border-box;" /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="box-sizing: border-box; margin: 0px; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: 300; line-height: 1.71429; color: #333333; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="box-sizing: border-box; margin: 0px; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: 300; line-height: 1.71429; color: #333333; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;I&lt;FONT size="2" style="box-sizing: border-box;"&gt;f you observe latency or “Pending” status in “Publisher to Distributor”, the issue is with Log Reader agent (refer to Step 3.1). If the latency is seen in “Distributor to Subscriber” as the screenshot above, the issue is with Distribution agent (refer to Step 3.2).&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="box-sizing: border-box; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: normal; line-height: 1.2; color: #333333; margin-top: 24px; margin-bottom: 12px; font-size: 18px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;Step 3.1. Troubleshoot latency in Log Reader agent&lt;/H3&gt;
&lt;OL class="lia-list-style-type-lower-alpha" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 12px; list-style-type: lower-alpha; color: #333333; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;
&lt;LI style="box-sizing: border-box; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;&lt;FONT size="2" style="box-sizing: border-box;"&gt;Check agent history table for any errors by specifically paying attention to comments and error text columns:&amp;nbsp;&lt;/FONT&gt;&lt;BR style="box-sizing: border-box;" /&gt;&lt;LI-CODE lang="sql"&gt;USE distribution 

SELECT a.name AS agent_name, 
       CASE [runstatus]  
              WHEN 1 THEN 'Start' 
              WHEN 2 THEN 'Succeed' 
              WHEN 3 THEN 'In progress' 
              WHEN 4 THEN 'Idle' 
              WHEN 5 THEN 'Retry' 
              WHEN 6 THEN 'Fail' 
       END AS Status 
      ,[start_time] 
      ,h.[time] -- The time the message is logged. 
      ,[duration]  --The duration, in seconds, of the message session. 
      ,[comments] 
      ,h.[xact_seqno] -- The last processed transaction sequence number. 
      ,[delivery_time] -- The time first transaction is delivered. 
      ,[delivered_transactions] --The total number of transactions delivered in the session. 
      ,[delivered_commands] -- The total number of commands delivered in the session. 
      ,[average_commands] -- The average number of commands delivered in the session. 
      ,[delivery_rate] -- The average delivered commands per second. 
      ,[delivery_latency] -- The latency between the command entering the published database and being entered into the distribution database. In milliseconds. 
      ,[error_id] -- The ID of the error in the MSrepl_error system table. 
      ,e.error_text -- error text 
  FROM [distribution].[dbo].[MSlogreader_history] h 
  JOIN MSlogreader_agents a 
  ON a.id = h.agent_id 
  LEFT JOIN MSrepl_errors e 
  ON e.id = h.error_id 
ORDER BY h.time DESC​&lt;/LI-CODE&gt;
&lt;P style="box-sizing: border-box; margin: 0px; font-family: inherit; font-size: 16px; font-weight: 300; line-height: 1.71429;"&gt;&lt;FONT size="2" style="box-sizing: border-box;"&gt;Furthermore, 5-min interval performance statistics have been added to the history table.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="box-sizing: border-box; margin: 0px; font-family: inherit; font-size: 16px; font-weight: 300; line-height: 1.71429;"&gt;&lt;img /&gt;&amp;nbsp;&lt;BR /&gt;&lt;FONT size="2" style="box-sizing: border-box;"&gt;If stats state=1, both reader and writer thread of Log Reader agent are performing as expected. If state=2, writer thread is taking a long time to write changes to distribution database. In this case, you should investigate, writer thread (Step 4.2). State=3 means the reader thread is taking a long time scanning the replicated changes from the transaction log and this thread should be investigated (Step 4.1). For example, below, the writer thread is causing latency as reader thread waited for it for 300 seconds to free queue buffer for new replicated data.&lt;/FONT&gt;&lt;img /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;BR /&gt;Ref:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A style="box-sizing: border-box; background-color: #ffffff; color: #146cac; text-decoration: underline; font-size: x-small; font-family: inherit;" href="https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/replication/performance-statistics-log-reader-distribution-agents" target="_blank" rel="noopener"&gt;Statistics for Log Reader and Distribution agents - SQL Server | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI style="box-sizing: border-box; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;&lt;FONT size="2" style="box-sizing: border-box;"&gt;&amp;nbsp;Sometimes the history table is not enough to resolve latency issues. In this case, you should enable verbose logging for detailed logs (-Output C:\Temp\OUTPUTFILE.txt -Outputverboselevel 3&amp;nbsp;).&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A style="box-sizing: border-box; background-color: transparent; color: #146cac; text-decoration: underline;" href="https://learn.microsoft.com/en-US/sql/relational-databases/replication/troubleshoot-tran-repl-errors?view=sql-server-ver16#enable-verbose-logging-on-any-agent" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-US/sql/relational-databases/replication/troubleshoot-tran-repl-errors?view=sql-server-ver16#enable-verbose-logging-on-any-agent&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;BR style="box-sizing: border-box;" /&gt;&lt;/SPAN&gt;You can investigate the verbose detailed logs for any errors. Particularly pay attention to "Status" logs.&lt;/FONT&gt;&lt;img /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;FONT size="2" style="box-sizing: border-box;"&gt;&lt;SPAN&gt;Furthermore, verbose logging provides 5-min interval Log Reader agent statistics as below. Check the Fetch time (reader thread performance) and Write time (writer thread performance) for any latency.&lt;BR /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;img /&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P style="box-sizing: border-box; margin: 0px; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: 300; line-height: 1.71429; color: #333333; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;FONT size="2" style="box-sizing: border-box;"&gt;If you cannot find any error logs but you detect latencies in either reader or writer thread, go to Step 4 and check the corresponding thread. For example, in the above example, we detected high latencies in Fetch time compared to Write time. So, the issue is probably with reader thread (refer to Step 4.1 in Part 2).&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="box-sizing: border-box; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: normal; line-height: 1.2; color: #333333; margin-top: 24px; margin-bottom: 12px; font-size: 18px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"&gt;Step 3.2. Troubleshoot latency in Distribution agent&lt;/H3&gt;
&lt;OL class="lia-list-style-type-lower-alpha"&gt;
&lt;LI style="box-sizing: border-box; font-family: SegoeUI, Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;&lt;FONT size="2" style="box-sizing: border-box;"&gt;Check Distribution agent history for any errors by specifically paying attention to comments and error text:&amp;nbsp;&lt;/FONT&gt;&lt;LI-CODE lang="sql"&gt;USE distribution 

SELECT a.name AS agent_name, 
       CASE [runstatus]  
            WHEN 1 THEN 'Start' 
            WHEN 2 THEN 'Succeed' 
            WHEN 3 THEN 'In progress' 
            WHEN 4 THEN 'Idle' 
            WHEN 5 THEN 'Retry' 
            WHEN 6 THEN 'Fail' 
       END AS Status 
      ,[start_time] 
      ,h.[time] -- The time the message is logged. 
      ,[duration] --The duration, in seconds, of the message session. 
      ,[comments] 
      ,h.[xact_seqno] -- The last processed transaction sequence number. 
      ,[current_delivery_rate] -- The average number of commands delivered per second since the last history entry. 
      ,[current_delivery_latency] --The latency between the command entering the distribution database and being applied to the Subscriber since the last history entry. In milliseconds. 
      ,[delivered_transactions] --The total number of transactions delivered in the session. 
      ,[delivered_commands] -- The total number of commands delivered in the session. 
      ,[average_commands] -- The average number of commands delivered in the session. 
      ,[delivery_rate] -- The average delivered commands per second. 
      ,[delivery_latency] -- The latency between the command entering the distribution database and being applied to the Subscriber. In milliseconds.
      ,[total_delivered_commands] -- The total number of commands delivered since the subscription was created. 
      ,[error_id] -- The ID of the error in the MSrepl_error system table. 
      ,e.error_text -- error text 
  FROM MSdistribution_history h 
  JOIN MSdistribution_agents a 
  ON a.id = h.agent_id 
  LEFT JOIN MSrepl_errors e 
  ON e.id = h.error_id 
  ORDER BY h.time DESC&lt;/LI-CODE&gt;&lt;FONT size="2"&gt;Furthermore, 5-min interval performance statistics have been added to the history table. &lt;/FONT&gt;&lt;img /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;If stats state=1, both reader and writer thread of Log Reader agent are performing as expected. If state=2, writer thread is taking a long time to write changes to distribution database. In this case, you should investigate, writer thread (Step 4.2). State=3 means the reader thread is taking a long time scanning the replicated changes from the transaction log and this thread should be investigated (Step 4.1). For example, below, the writer thread is causing latency as reader thread waited for it for 300 seconds to free queue buffer for new replicated data.&lt;/FONT&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Ref&lt;/FONT&gt;: &lt;/SPAN&gt;&lt;A style="font-size: x-small; font-family: inherit; background-color: #ffffff;" href="https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/replication/performance-statistics-log-reader-distribution-agents" target="_blank" rel="noopener"&gt;Statistics for Log Reader and Distribution agents - SQL Server | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="2"&gt;&amp;nbsp;Sometimes the history table is not enough to resolve latency issues. In this case, you should enable verbose logging for detailed logs (-Output C:\Temp\OUTPUTFILE.txt -Outputverboselevel 3&amp;nbsp;).&amp;nbsp; &lt;A href="https://learn.microsoft.com/en-US/sql/relational-databases/replication/troubleshoot-tran-repl-errors?view=sql-server-ver16#enable-verbose-logging-on-any-agent" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-US/sql/relational-databases/replication/troubleshoot-tran-repl-errors?view=sql-server-ver16#enable-verbose-logging-on-any-agent&lt;/A&gt;You can investigate the verbose detailed logs for any errors. Particularly pay attention to "Status" logs.&lt;/FONT&gt;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;Furthermore, verbose logging provides distribution agent statistics as below. Check the Fetch time (reader thread performance) and Write time (writer thread performance) for any latency.&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;img /&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If you cannot find any error logs but you detect latencies in either reader or writer thread, go to Step 4 and check the corresponding thread. For example, in the above example, we detected high latencies in Reader thread compared to Writer thread. Therefore, the issue is with reader thread (Step 4.3).&amp;nbsp; Let us continue doing the next steps in Part 2!!&lt;BR /&gt;&lt;BR /&gt;Supervisor: Collin Benkler, Sr. EE for SQL Server in Microsoft.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 05:53:05 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/effectively-troubleshoot-latency-in-sql-server-transactional/ba-p/4193429</guid>
      <dc:creator>Arslanov</dc:creator>
      <dc:date>2024-07-17T05:53:05Z</dc:date>
    </item>
    <item>
      <title>SQL Server 2022 分散型可用性グループにおける同期失敗</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/sql-server-2022-%E5%88%86%E6%95%A3%E5%9E%8B%E5%8F%AF%E7%94%A8%E6%80%A7%E3%82%B0%E3%83%AB%E3%83%BC%E3%83%97%E3%81%AB%E3%81%8A%E3%81%91%E3%82%8B%E5%90%8C%E6%9C%9F%E5%A4%B1%E6%95%97/ba-p/4189002</link>
      <description>&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;"&gt;&lt;SPAN&gt;こんにちは。SQL Server サポート チームです。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;"&gt;&lt;SPAN&gt;今回は、分散型可用性グループにおける同期が突然失敗する事象についてご紹介します。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;" lang="ja"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;"&gt;&lt;STRONG&gt;&lt;U&gt;事象&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-size: 10.0pt;"&gt;&lt;SPAN&gt;SQL Server 2022 &lt;/SPAN&gt;&lt;SPAN&gt;で分散型可用性グループを構成し&lt;/SPAN&gt;&lt;SPAN&gt; FILESTREAM &lt;/SPAN&gt;&lt;SPAN&gt;を使用している環境において、正常に稼働していた分散型可用性グループが突如同期に失敗し、同期の状態が&lt;/SPAN&gt; &lt;SPAN&gt;NOT_HEALTHY &lt;/SPAN&gt;&lt;SPAN&gt;になります。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Yu Gothic'; font-size: 10.0pt; color: #333333;"&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;事象発生構成&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Yu Gothic'; font-size: 10.0pt; color: #333333;"&gt;&lt;SPAN&gt;・&lt;/SPAN&gt;&lt;SPAN&gt;SQL Server 2022&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Yu Gothic'; font-size: 10.0pt; color: #333333;"&gt;&lt;SPAN&gt;・分散型可用性グループ&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Yu Gothic'; font-size: 10.0pt; color: #333333;"&gt;&lt;SPAN&gt;・&lt;/SPAN&gt;&lt;SPAN&gt;FILESTREAM &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;" lang="ja"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;"&gt;&lt;U&gt;&lt;STRONG&gt;原因&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-size: 10.0pt;"&gt;&lt;SPAN&gt;前提として、&lt;/SPAN&gt;&lt;SPAN&gt;FILESTREAM &lt;/SPAN&gt;&lt;SPAN&gt;の機能&lt;/SPAN&gt;&lt;SPAN&gt;はログの順序性が重要になっています。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;SPAN&gt;SQL Server 2022 &lt;/SPAN&gt;&lt;SPAN&gt;より、パフォーマンス向上を目的に分散型可用性グループ間で、下記の弊社公開情報に記載している通り複数の&lt;/SPAN&gt;&lt;SPAN&gt; TCP &lt;/SPAN&gt;&lt;SPAN&gt;接続を使用できるようになりました。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;" lang="ja"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-size: 10.0pt;"&gt;&lt;SPAN&gt;SQL Server 2022 &lt;/SPAN&gt;&lt;SPAN&gt;の新機能により複数の&lt;/SPAN&gt;&lt;SPAN&gt; TCP &lt;/SPAN&gt;&lt;SPAN&gt;セッションからログを転送することで、&lt;/SPAN&gt;&lt;SPAN&gt;FILESTREAM &lt;/SPAN&gt;&lt;SPAN&gt;の内部的なログの順序がずれてしまうことで、同期に異常が発生することが原因です。&lt;/SPAN&gt;&lt;/P&gt;
&lt;H4 lang="ja" style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;本事象についてはSQL Server 2022 の動作上の制限になります。&lt;/H4&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;" lang="ja"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;SPAN&gt;SQL Server 2022 (16.x) &lt;/SPAN&gt;&lt;SPAN&gt;の新機能&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;SPAN&gt;- &lt;/SPAN&gt;&lt;SPAN&gt;可用性&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flearn.microsoft.com%2Fja-jp%2Fsql%2Fsql-server%2Fwhat-s-new-in-sql-server-2022%23availability&amp;amp;data=05%7C02%7Ckatsuyaito%40microsoft.com%7C3ff994d521544d84ddee08dc8faaebf1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638543211548844056%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&amp;amp;sdata=0UUe5HUWHCkPuw%2FC4wYOq%2Fd7%2FeCzc8%2F98hgECsHmp6w%3D&amp;amp;reserved=0" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;https://learn.microsoft.com/ja-jp/sql/sql-server/what-s-new-in-sql-server-2022#availability&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;" lang="en-US"&gt;*****&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;SPAN&gt;分散型可用性グループ&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - tcp &lt;/SPAN&gt;&lt;SPAN&gt;待機時間が長いリモート リンク間のネットワーク帯域幅使用率を向上させるために、複数の&lt;/SPAN&gt;&lt;SPAN&gt; TCP &lt;/SPAN&gt;&lt;SPAN&gt;接続を使用するようになりました。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;" lang="en-US"&gt;*****&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;" lang="en-US"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;"&gt;&lt;U&gt;&lt;STRONG&gt;対処策&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;SPAN&gt;本事象の対処策は、トレースフラグ&lt;/SPAN&gt;&lt;SPAN&gt; 5597 &lt;/SPAN&gt;&lt;SPAN&gt;を設定することです。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;SPAN&gt;トレースフラグ&lt;/SPAN&gt;&lt;SPAN&gt; 5597 &lt;/SPAN&gt;&lt;SPAN&gt;は、&lt;/SPAN&gt;&lt;SPAN&gt;SQL Server 2022&lt;/SPAN&gt;&lt;SPAN&gt;の新機能&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;分散型可用性グループにおける複数&lt;/SPAN&gt;&lt;SPAN&gt;TCP&lt;/SPAN&gt;&lt;SPAN&gt;使用&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;を無効するのみで、&lt;/SPAN&gt;&lt;SPAN&gt;以前のバージョンと同等な動作となり、&lt;/SPAN&gt;&lt;SPAN&gt;他への影響はありません。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;"&gt;&lt;U&gt;&lt;STRONG&gt;変更手順&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-size: 10.0pt;"&gt;&lt;SPAN&gt;トレースフラグ&lt;/SPAN&gt; &lt;SPAN&gt;5597 &lt;/SPAN&gt;&lt;SPAN&gt;の設定方法は、以下の通りです。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt; color: #333333;" lang="ja"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;トレースフラグ設定方法&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;" lang="en-US"&gt;--------------------------------&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;SPAN&gt;1) SQL Server Configuration Manager (&lt;/SPAN&gt;&lt;SPAN&gt;構成マネージャー&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;を起動します。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;SPAN&gt;2) SQL Server&lt;/SPAN&gt;&lt;SPAN&gt;のサービス&lt;/SPAN&gt;&lt;SPAN&gt;-&amp;gt; SQL Server (MSSQLSERVER &lt;/SPAN&gt;&lt;SPAN&gt;もしくは インスタンス名&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;を右クリックし、プロパティを開きます。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;SPAN&gt;3) [&lt;/SPAN&gt;&lt;SPAN&gt;起動時のパラメーター&lt;/SPAN&gt;&lt;SPAN&gt;] &lt;/SPAN&gt;&lt;SPAN&gt;タブの&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;起動時のパラメーターの指定&lt;/SPAN&gt;&lt;SPAN&gt;] &lt;/SPAN&gt;&lt;SPAN&gt;ボックスに下記の値を入力し、&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;追加&lt;/SPAN&gt;&lt;SPAN&gt;] &lt;/SPAN&gt;&lt;SPAN&gt;をクリックします。&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;" lang="en-US"&gt;-T5597&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 游ゴシック; font-size: 10.0pt;"&gt;&lt;SPAN&gt;5) [OK]&lt;/SPAN&gt;&lt;SPAN&gt;をクリックし、設定を確定します。設定は、次回&lt;/SPAN&gt;&lt;SPAN&gt;SQL Server &lt;/SPAN&gt;&lt;SPAN&gt;サービス起動後に有効になります。&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 06:51:48 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/sql-server-2022-%E5%88%86%E6%95%A3%E5%9E%8B%E5%8F%AF%E7%94%A8%E6%80%A7%E3%82%B0%E3%83%AB%E3%83%BC%E3%83%97%E3%81%AB%E3%81%8A%E3%81%91%E3%82%8B%E5%90%8C%E6%9C%9F%E5%A4%B1%E6%95%97/ba-p/4189002</guid>
      <dc:creator>Katsuya_Ito</dc:creator>
      <dc:date>2024-09-16T06:51:48Z</dc:date>
    </item>
    <item>
      <title>How to perform unattended uninstall for SQL Server Express</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/how-to-perform-unattended-uninstall-for-sql-server-express/ba-p/4175148</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;Recently, I received a question&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;about unattended uninstall for SQL Server Express edition.&amp;nbsp;&lt;SPAN&gt;This article describes how to perform this task.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We need to take in consideration before to proceed&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;User that performs the process must be a local administrator with permissions to log on as a service. You can review more information about required permissions &lt;A href="https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/install/windows/installation-fails-if-remove-user-right" target="_self"&gt;here.&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;If the machine has the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;minimum&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;required amount of physical memory, increase the size of the page file to two times the amount of physical memory. Insufficient virtual memory can result in an incomplete removal of SQL Server.&lt;/LI&gt;
&lt;LI&gt;On a system with multiple instances of SQL Server, the SQL Server browser service is uninstalled only once the last instance of SQL Server is removed. The SQL Server Browser service can be removed manually from&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Programs and Features&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Control Panel&lt;/STRONG&gt;.&lt;/LI&gt;
&lt;LI&gt;Uninstalling SQL Server deletes&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;tempdb&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;data files that were added during the install process. Files with tempdb_mssql_*.ndf name pattern are deleted if they exist in the system database directory.&lt;/LI&gt;
&lt;LI&gt;Backup your databases.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Uninstall process&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Open Command Prompt with admin rights&lt;/LI&gt;
&lt;LI&gt;Navigate to the below directory&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;C:\Program Files\Microsoft SQL Server\&lt;FONT color="#0000FF"&gt;160&lt;/FONT&gt;\Setup Bootstrap\&lt;FONT color="#0000FF"&gt;MyInstanceName&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Please note that 160 version is the&amp;nbsp;major build version of SQL Server.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/sql/database-engine/install-windows/view-and-read-sql-server-setup-log-files?view=sql-server-ver15" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/sql/database-engine/install-windows/view-and-read-sql-server-setup-log-files?view=sql-server-ver15&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="bash"&gt;C:\&amp;gt;cd C:\Program Files\Microsoft SQL Server\160\Setup Bootstrap\SQL2022&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Run the below command&lt;BR /&gt;&lt;LI-CODE lang="bash"&gt;C:\Program Files\Microsoft SQL Server\160\Setup Bootstrap\SQL2022&amp;gt;setup.exe /Q /ACTION=uninstall /INSTANCENAME=SQLEXPRESS /FEATURES=SQLENGINE&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;For more information on uninstall options, see&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fsql%2Fdatabase-engine%2Finstall-windows%2Finstall-sql-server-from-the-command-prompt%3Fview%3Dsql-server-ver16%23Uninstall&amp;amp;data=05%7C02%7CIdalia.Loria%40microsoft.com%7C415ab821b2f141d1b83908dc86ea67fc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638533588614108989%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&amp;amp;sdata=H%2FOmNIsVWrxtSBrW9LnsL6KkSMuqJHNYzNiyPUCInmY%3D&amp;amp;reserved=0" target="_blank" rel="noopener" data-auth="Verified" data-linkindex="1" data-ogsc=""&gt;https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt?view=sql-server-ver16#Uninstall&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Idalia - SQL Server CSS&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 16:22:32 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/how-to-perform-unattended-uninstall-for-sql-server-express/ba-p/4175148</guid>
      <dc:creator>IdaliaL</dc:creator>
      <dc:date>2024-06-25T16:22:32Z</dc:date>
    </item>
    <item>
      <title>Migration sql server from sql 2017 to sql 2022 with Minimal Down time</title>
      <link>https://techcommunity.microsoft.com/t5/sql-server-support-blog/migration-sql-server-from-sql-2017-to-sql-2022-with-minimal-down/ba-p/4167885</link>
      <description>&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;Below is our suggestion for the migration activity:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt; Always on&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;High Availability&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt; DB Mirroring&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt; Logshipping&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;H2&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;SQL Always on High Availability :&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;It is possible to configure a SQL Server Always On availability group with a primary replica running on SQL Server 2017 and a secondary replica running on SQL Server 2022, but there are important considerations and limitations to keep in mind:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Backward Compatibility:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;SQL Server supports having replicas on different versions, but the primary replica must be on an older version than or equal to the secondary replicas. Therefore, having SQL Server 2017 as the primary and SQL Server 2022 as the secondary is valid.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Database Upgrade Path:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;When you decide to upgrade the primary replica to a newer version, you need to follow a specific upgrade path to ensure minimal downtime and data integrity. Typically, this involves:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp; Adding the newer version as a secondary replica.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp; Failing over to the secondary replica running the newer version (making it the new primary).&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp; Upgrading the former primary to the newer version.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp; Adding it back to the availability group.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="3"&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;Feature Compatibility:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;Some features available in SQL Server 2022 might not be fully supported or behave differently when the primary replica is running on SQL Server 2017. It's essential to test the behavior of your applications and workloads thoroughly in this mixed-version environment.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Support and Documentation:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;Always refer to the official Microsoft documentation for the most accurate and up-to-date information about version compatibility and supported configurations. Microsoft's official [documentation on Always On availability groups](&lt;/SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/always-on-availability-groups-sql-server?view=sql-server-ver15" target="_blank" rel="noopener"&gt;&lt;SPAN data-contrast="auto"&gt;https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/always-on-availability-groups-sql-server?view=sql-server-ver15&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN data-contrast="auto"&gt;) is a good place to start.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Licensing and Maintenance:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;Ensure that your licensing agreements and maintenance plans support such a configuration. Running different versions might have implications for your support agreements with Microsoft.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Here&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;is a high-level example of setting up such a configuration:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Install SQL Server 2017&lt;/STRONG&gt;&amp;nbsp;on the primary server and configure it as the primary replica.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Install SQL Server 2022&lt;/STRONG&gt;&amp;nbsp;on the secondary server and configure it as the secondary replica.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Create the availability group&lt;/STRONG&gt;&amp;nbsp;on SQL Server 2017 and add the database(s) to the group.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Add the SQL Server 2022 instance&lt;/STRONG&gt;&amp;nbsp;as a secondary replica to the availability group.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Configure synchronization&lt;/STRONG&gt;&amp;nbsp;and verify that the secondary replica is properly synchronized with the primary replica.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;H5&gt;&amp;nbsp;&lt;/H5&gt;
&lt;H5&gt;&lt;SPAN data-contrast="auto"&gt;Example Steps for Adding SQL Server 2022 as a Secondary Replica&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/H5&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;On the Primary Server (SQL Server 2017):&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;  ALTER AVAILABILITY GROUP [YourAGName] 
  ADD REPLICA ON 'SQL2022ServerName' 
  WITH (ENDPOINT_URL = 'TCP://SQL2022ServerName:5022', AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT, FAILOVER_MODE = MANUAL); &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="2"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;On the Secondary Server (SQL Server 2022):&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;ALTER DATABASE [YourDatabaseName] SET HADR AVAILABILITY GROUP = YourAGName; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="3"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Join the Secondary Replica to the Availability Group:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;ALTER AVAILABILITY GROUP [YourAGName] JOIN; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="4"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Start Data Synchronization:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;  ALTER DATABASE [YourDatabaseName] SET HADR RESUME; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;Always test such configurations in a non-production environment to ensure that everything works as expected and to understand any potential issues or performance implications.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/upgrading-always-on-availability-group-replica-instances?view=sql-server-ver16" target="_blank" rel="noopener"&gt;&lt;SPAN data-contrast="auto"&gt;https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/upgrading-always-on-availability-group-replica-instances?view=sql-server-ver16&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;DB Mirroring :&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;Using database mirroring to migrate a SQL Server database from SQL Server 2017 to SQL Server 2022 is a viable strategy. Database mirroring provides a way to maintain a synchronized copy of your database on the new server. Here are the detailed steps to perform the migration:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Step-by-Step Migration Process&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;Prepare the Environment&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Install SQL Server 2022&lt;/STRONG&gt;: Set up SQL Server 2022 on your new server where you want to migrate your database.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Network Configuration&lt;/STRONG&gt;: Ensure that the network between the old (SQL Server 2017) and the new server (SQL Server 2022) is properly configured and both servers can communicate with each other.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;OL start="2"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Backup the Primary Database&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Full Backup&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;BACKUP DATABASE YourDatabaseName TO DISK = 'C:\Backup\YourDatabaseName_Full.bak'; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Transaction Log Backup&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;BACKUP LOG YourDatabaseName TO DISK = 'C:\Backup\YourDatabaseName_Log.trn'; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="3"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Restore the Backup on the New Server&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Copy the backup files&lt;/STRONG&gt;&amp;nbsp;to the new server.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Restore the Full Backup:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;RESTORE DATABASE YourDatabaseName FROM DISK = 'C:\Backup\YourDatabaseName_Full.bak' 
WITH NORECOVERY; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Restore the Transaction Log Backup:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;RESTORE LOG YourDatabaseName FROM DISK = 'C:\Backup\YourDatabaseName_Log.trn' 
WITH NORECOVERY; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="4"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Configure Database Mirroring&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;On the Principal (SQL Server 2017):&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;ALTER DATABASE YourDatabaseName 
SET PARTNER = 'TCP://SQL2022ServerName:5022'; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;On the Mirror (SQL Server 2022):&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;ALTER DATABASE YourDatabaseName 
SET PARTNER = 'TCP://SQL2017ServerName:5022'; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Security Configuration&lt;/STRONG&gt;: Ensure that the database mirroring endpoints are configured correctly and that the service accounts have the necessary permissions.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;OL start="5"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Monitor the Synchronization&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;Verify that the mirroring session is established and that the databases are synchronizing. You can use the following query to check the status:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;SELECT 
     db_name(database_id) AS DatabaseName, 
     mirroring_state_desc, 
     mirroring_role_desc, 
     mirroring_partner_name, 
     mirroring_partner_instance 
   FROM 
      sys.database_mirroring; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="6"&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Failover to the New Server (SQL Server 2022)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;Once the database is fully synchronized, you can perform a manual failover to make the SQL Server 2022 instance the principal server.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;ALTER DATABASE YourDatabaseName SET PARTNER FAILOVER;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="7"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Update Applications and Services&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Point your applications&lt;/STRONG&gt;&amp;nbsp;and services to the new SQL Server 2022 instance.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Update connection strings&lt;/STRONG&gt;&amp;nbsp;to reflect the new server name or IP address.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;OL start="8"&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Remove Mirroring (Optional)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;If you no longer need mirroring after the migration, you can remove the mirroring configuration.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;-- On the Principal (now SQL Server 2022) 
ALTER DATABASE YourDatabaseName SET PARTNER OFF; 
-- On the Mirror (SQL Server 2017) 
ALTER DATABASE YourDatabaseName SET PARTNER OFF; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Considerations and Best Practices&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Compatibility&lt;/STRONG&gt;: Ensure that your database and applications are compatible with SQL Server 2022. Test in a non-production environment before migrating.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Downtime&lt;/STRONG&gt;: Plan for a maintenance window, as there might be a brief downtime during the failover.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Backup and Restore&lt;/STRONG&gt;: Always have a recent backup before starting the migration.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;Using database mirroring can provide a smooth transition with minimal downtime, ensuring that your data remains consistent throughout the migration process.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/database-engine/database-mirroring/database-mirroring-sql-server?view=sql-server-ver16" target="_blank" rel="noopener"&gt;&lt;SPAN data-contrast="auto"&gt;https://learn.microsoft.com/en-us/sql/database-engine/database-mirroring/database-mirroring-sql-server?view=sql-server-ver16&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Log Shippig :&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;Using log shipping to upgrade from SQL Server 2017 to SQL Server 2022 involves setting up log shipping between the two servers, synchronizing them, and then performing a cutover. Here are the steps to perform the migration using log shipping:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Step-by-Step Migration Process&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Prepare the Environment&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Install SQL Server 2022&lt;/STRONG&gt;: Set up SQL Server 2022 on your new server.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Network Configuration&lt;/STRONG&gt;: Ensure that the network between the old (SQL Server 2017) and the new server (SQL Server 2022) is properly configured and both servers can communicate with each other.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;OL start="2"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Configure Log Shipping&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Full Backup of the Primary Database (SQL Server 2017):&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;BACKUP DATABASE YourDatabaseName TO DISK = 'C:\Backup\YourDatabaseName_Full.bak';&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Copy the Full Backup&lt;/STRONG&gt;&amp;nbsp;to the new server (SQL Server 2022).&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Restore the Full Backup on the New Server (SQL Server 2022)&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;RESTORE DATABASE YourDatabaseName FROM DISK = 'C:\Backup\YourDatabaseName_Full.bak' 
WITH NORECOVERY; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Enable Log Shipping on the Primary Database (SQL Server 2017):&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp; &amp;nbsp;Right-click the database in SQL Server Management Studio (SSMS), go to "Properties," and select "Transaction Log Shipping."&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp; &amp;nbsp;Check "Enable this as a primary database in a log shipping configuration."&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp; &amp;nbsp;Configure the backup settings (backup path, schedule).&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Configure the Secondary Server (SQL Server 2022)&lt;/STRONG&gt;&lt;STRONG&gt;:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp; Specify the new server as the secondary.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp; Set the path to the backup folder where transaction log backups will be copied.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp; Configure the restore settings to restore the logs with the `STANDBY` option (so the database can be read-only for verification purposes) or `NORECOVERY` (if you want to keep it in a restoring state).&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;OL start="3"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Start Log Shipping&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Initial Transaction Log Backup:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;BACKUP LOG YourDatabaseName TO DISK = 'C:\Backup\YourDatabaseName_Log1.trn';&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Copy and Restore the Log Backup on SQL Server 2022:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;RESTORE LOG YourDatabaseName FROM DISK = 'C:\Backup\YourDatabaseName_Log1.trn' 
WITH NORECOVERY;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Schedule Regular Log Backups&lt;/STRONG&gt;: Configure SQL Server Agent jobs to take regular transaction log backups on the primary and copy them to the secondary server.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;OL start="4"&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Monitor Log Shipping&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;- Monitor the log shipping status using the Log Shipping Monitor or SQL Server Management Studio to ensure that the transaction logs are being backed up, copied, and restored correctly.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL start="5"&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Perform the Cutover to SQL Server 2022&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Stop All Transactions on the Primary Database (SQL Server 2017)&lt;/STRONG&gt;: Ensure no new transactions are occurring on the primary database.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;STRONG&gt;Take a Final Log Backup on the Primary (SQL Server 2017)&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;BACKUP LOG YourDatabaseName TO DISK = 'C:\Backup\YourDatabaseName_LogFinal.trn';&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Copy and Restore the Final Log Backup on the Secondary (SQL Server 2022)&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;RESTORE LOG YourDatabaseName FROM DISK = 'C:\Backup\YourDatabaseName_LogFinal.trn' 
WITH RECOVERY;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Bring the New Database Online&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="applescript"&gt;ALTER DATABASE YourDatabaseName SET MULTI_USER; &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL start="6"&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Update Applications and Services&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Point your applications&lt;/STRONG&gt;&amp;nbsp;and services to the new SQL Server 2022 instance.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Update connection strings&lt;/STRONG&gt;&amp;nbsp;to reflect the new server name or IP address.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;Considerations and Best Practices&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Testing&lt;/STRONG&gt;: Thoroughly test the log shipping configuration and the final cutover process in a non-production environment before doing it in production.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Downtime&lt;/STRONG&gt;: Plan for a maintenance window during the cutover process as there will be some downtime.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Backup and Restore&lt;/STRONG&gt;: Always have recent backups before starting the migration.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-contrast="auto"&gt;&lt;STRONG&gt;Log Shipping Monitor&lt;/STRONG&gt;: Use the Log Shipping Monitor to ensure that all log shipping processes are running smoothly.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;Log shipping for the upgrade provides a way to minimize downtime and ensure data consistency throughout the migration process.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/sql/database-engine/log-shipping/configure-log-shipping-sql-server?view=sql-server-ver16" target="_blank" rel="noopener"&gt;&lt;SPAN data-contrast="auto"&gt;https://learn.microsoft.com/en-us/sql/database-engine/log-shipping/configure-log-shipping-sql-server?view=sql-server-ver16&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 08:57:13 GMT</pubDate>
      <guid>https://techcommunity.microsoft.com/t5/sql-server-support-blog/migration-sql-server-from-sql-2017-to-sql-2022-with-minimal-down/ba-p/4167885</guid>
      <dc:creator>Yohei_Kawajiri</dc:creator>
      <dc:date>2024-06-14T08:57:13Z</dc:date>
    </item>
  </channel>
</rss>

