<?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>article Why are there two open transactions on source SQL database when we use Qlik Replicate? in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/Why-are-there-two-open-transactions-on-source-SQL-database-when/ta-p/1946320</link>
    <description>&lt;P&gt;This article aims to explain how SQL server T-log cleans up works when Microsoft replication\publication is enabled on the database.&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Environment&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;LI-PRODUCT title="Qlik Replicate" id="qlikReplicate"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When the Qlik Replicate task first time runs to capture CDC, Qlik Replicate will create a publication on the database with required articles. As part of this publication log reader agent job also will be created and this job will continuously run to mark replicated transactions on the database.&lt;/P&gt;
&lt;P&gt;Apart from the Replicate process, there will be a transactional log backup job that will run every 15 mins or 30 mins depends on source team policy. As part of this log backup job, all the transactions will be backup up to that point in time and truncate all replicated and committed transactions from T-log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assume, there is a scheduled t-log backup job going to run at 10 am, and the replicate task is reading transaction log with 5 mins latency, there is a high possibility that the backup job will remove the transaction(s) from a transactional log which hasn't read by the Qlik Replicate. In this scenario, the Qlik Replicate task will be failed with a missing LSN error.&lt;/P&gt;
&lt;P&gt;To prevent such kinds of issues Qlik Replicate implemented an option to hold T-log for a couple of mins without truncating based on the below setting:&lt;/P&gt;
&lt;P&gt;Qlik Replicate creates an internal table called &lt;STRONG&gt;attrep_truncation_safeguard&lt;/STRONG&gt; on the source database and always runs two update queries (2 update queries for each Qlik Replicate task running on the database) without commit (called Latch Lock A and B), only when you enable Start transactions in the database setting on source SQL endpoint. Qlik Replicate will update the time on these queries every 5 mins by default and we can control time by using an Option called "&lt;STRONG&gt;Apply TLOG truncation prevention policy every (seconds):&lt;/STRONG&gt; ".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the screenshots to explain how to check these open transactions on the database.&amp;nbsp;&lt;/P&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;You can find the setting below in the source endpoint which controls truncate policy:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Start transactions in the database.png" style="width: 883px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82346i81D4640A8CFA84B3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Start transactions in the database.png" alt="Start transactions in the database.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;We can see the uncommitted transactions from Qlik Replicate UI.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Accumulating transactions.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82347i42818062F37E82BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Accumulating transactions.png" alt="Accumulating transactions.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Verify Open transactions on the database. You can check the task name in the open Tran.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DBCC opentran.png" style="width: 717px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82348i7B9379F58EED6861/image-size/large?v=v2&amp;amp;px=999" role="button" title="DBCC opentran.png" alt="DBCC opentran.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;We can check the&amp;nbsp;&lt;STRONG&gt;attrep_truncation_safeguard &lt;/STRONG&gt;table for latch lock information.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="script for selecttoprows.png" style="width: 589px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82349iB4BB72A1D30D4B7B/image-size/large?v=v2&amp;amp;px=999" role="button" title="script for selecttoprows.png" alt="script for selecttoprows.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Here is how we can find corresponding SQL sessions for each latch key.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="select from sysprocesses.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82350iB76DBA86CB614736/image-size/large?v=v2&amp;amp;px=999" role="button" title="select from sysprocesses.png" alt="select from sysprocesses.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="select DBname.png" style="width: 525px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82351iD2B14929763FCFBA/image-size/large?v=v2&amp;amp;px=999" role="button" title="select DBname.png" alt="select DBname.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Finally, we can see the exact update queries without commit(open transactions) running on the database.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="begin transaction.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82352i0FEA600E740FE430/image-size/large?v=v2&amp;amp;px=999" role="button" title="begin transaction.png" alt="begin transaction.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2022 07:34:02 GMT</pubDate>
    <dc:creator>SwathiPulagam</dc:creator>
    <dc:date>2022-06-22T07:34:02Z</dc:date>
    <item>
      <title>Why are there two open transactions on source SQL database when we use Qlik Replicate?</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Why-are-there-two-open-transactions-on-source-SQL-database-when/ta-p/1946320</link>
      <description>&lt;P&gt;This article aims to explain how SQL server T-log cleans up works when Microsoft replication\publication is enabled on the database.&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Environment&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;LI-PRODUCT title="Qlik Replicate" id="qlikReplicate"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When the Qlik Replicate task first time runs to capture CDC, Qlik Replicate will create a publication on the database with required articles. As part of this publication log reader agent job also will be created and this job will continuously run to mark replicated transactions on the database.&lt;/P&gt;
&lt;P&gt;Apart from the Replicate process, there will be a transactional log backup job that will run every 15 mins or 30 mins depends on source team policy. As part of this log backup job, all the transactions will be backup up to that point in time and truncate all replicated and committed transactions from T-log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assume, there is a scheduled t-log backup job going to run at 10 am, and the replicate task is reading transaction log with 5 mins latency, there is a high possibility that the backup job will remove the transaction(s) from a transactional log which hasn't read by the Qlik Replicate. In this scenario, the Qlik Replicate task will be failed with a missing LSN error.&lt;/P&gt;
&lt;P&gt;To prevent such kinds of issues Qlik Replicate implemented an option to hold T-log for a couple of mins without truncating based on the below setting:&lt;/P&gt;
&lt;P&gt;Qlik Replicate creates an internal table called &lt;STRONG&gt;attrep_truncation_safeguard&lt;/STRONG&gt; on the source database and always runs two update queries (2 update queries for each Qlik Replicate task running on the database) without commit (called Latch Lock A and B), only when you enable Start transactions in the database setting on source SQL endpoint. Qlik Replicate will update the time on these queries every 5 mins by default and we can control time by using an Option called "&lt;STRONG&gt;Apply TLOG truncation prevention policy every (seconds):&lt;/STRONG&gt; ".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the screenshots to explain how to check these open transactions on the database.&amp;nbsp;&lt;/P&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;You can find the setting below in the source endpoint which controls truncate policy:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Start transactions in the database.png" style="width: 883px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82346i81D4640A8CFA84B3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Start transactions in the database.png" alt="Start transactions in the database.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;We can see the uncommitted transactions from Qlik Replicate UI.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Accumulating transactions.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82347i42818062F37E82BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Accumulating transactions.png" alt="Accumulating transactions.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Verify Open transactions on the database. You can check the task name in the open Tran.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DBCC opentran.png" style="width: 717px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82348i7B9379F58EED6861/image-size/large?v=v2&amp;amp;px=999" role="button" title="DBCC opentran.png" alt="DBCC opentran.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;We can check the&amp;nbsp;&lt;STRONG&gt;attrep_truncation_safeguard &lt;/STRONG&gt;table for latch lock information.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="script for selecttoprows.png" style="width: 589px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82349iB4BB72A1D30D4B7B/image-size/large?v=v2&amp;amp;px=999" role="button" title="script for selecttoprows.png" alt="script for selecttoprows.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Here is how we can find corresponding SQL sessions for each latch key.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="select from sysprocesses.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82350iB76DBA86CB614736/image-size/large?v=v2&amp;amp;px=999" role="button" title="select from sysprocesses.png" alt="select from sysprocesses.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="select DBname.png" style="width: 525px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82351iD2B14929763FCFBA/image-size/large?v=v2&amp;amp;px=999" role="button" title="select DBname.png" alt="select DBname.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Finally, we can see the exact update queries without commit(open transactions) running on the database.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="begin transaction.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82352i0FEA600E740FE430/image-size/large?v=v2&amp;amp;px=999" role="button" title="begin transaction.png" alt="begin transaction.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 07:34:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Why-are-there-two-open-transactions-on-source-SQL-database-when/ta-p/1946320</guid>
      <dc:creator>SwathiPulagam</dc:creator>
      <dc:date>2022-06-22T07:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why are there two open transactions on source SQL database when we use Qlik Replicate?</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Why-are-there-two-open-transactions-on-source-SQL-database-when/tac-p/2483617#M14661</link>
      <description>&lt;P&gt;Hi Qlik Team,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question regarding&amp;nbsp;&lt;STRONG&gt;attrep_truncation_safeguard&lt;/STRONG&gt; internal table. Can we get this table created in [instance] schema instead of [dbo]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Aldy&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 01:43:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Why-are-there-two-open-transactions-on-source-SQL-database-when/tac-p/2483617#M14661</guid>
      <dc:creator>Aldy</dc:creator>
      <dc:date>2024-09-26T01:43:01Z</dc:date>
    </item>
  </channel>
</rss>

