# SQL Server CDC Source(Debezium) - Lock-free Snapshot

**URL:** <https://forum.confluent.io/t/sql-server-cdc-source-debezium-lock-free-snapshot/1652>\
**Category:** Managed Connectors\
**Created:** [3 May 2021 15:03 UTC](https://forum.confluent.io/t/sql-server-cdc-source-debezium-lock-free-snapshot/1652 "2021-05-03T15:03:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![batu](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/batu/32/741_2.png) [@batu](https://forum.confluent.io/u/batu)\
**Post date:** [3 May 2021 15:03 UTC](https://forum.confluent.io/t/sql-server-cdc-source-debezium-lock-free-snapshot/1652/1 "2021-05-03T15:03:36Z")

</div>

Hi everyone 🖖

We’re implementing cdc on Confluent Cloud to a mission critical SQL Server so locking the database is not an option for us when the connector starts.

According to the [doc](https://docs.confluent.io/5.5.1/cloud/connectors/cc-microsoft-sql-server-source-cdc-debezium.html) there are 2 options(‘never’ and ‘exported’ ) which looks like lock-free but we can’t decide if they are appropriate for this scenario because both using replica slots.

Could you help about the best ways to connect **Microsoft SQL Server CDC Source** without locking the database?

Greetings from Istanbul,  
Batu

---

<div class="post-metadata">

**Author:** ![rick](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/rick/32/49_2.png) [@rick](https://forum.confluent.io/u/rick)\
**Post date:** [4 May 2021 13:11 UTC](https://forum.confluent.io/t/sql-server-cdc-source-debezium-lock-free-snapshot/1652/2 "2021-05-04T13:11:34Z")

</div>

@batu could you please clarify why the Snapshot mode `exported` may not work for your use case?

---

<div class="post-metadata">

**Author:** ![batu](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/batu/32/741_2.png) [@batu](https://forum.confluent.io/u/batu)\
**Post date:** [4 May 2021 16:49 UTC](https://forum.confluent.io/t/sql-server-cdc-source-debezium-lock-free-snapshot/1652/3 "2021-05-04T16:49:25Z")

</div>

Hi @rick,  
Thank you for the response.

There are two main concerns about the exported mode that I am not sure about. First of all, I did not fully understand what the replication slot is and when it was created. Secondly, i can’t estimate what are the tradeoffs when we choose export instead of initial mode, especially in the long term?

Thanks

---

<div class="post-metadata">

**Author:** ![shlomi](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@shlomi](https://forum.confluent.io/u/shlomi)\
**Post date:** [6 May 2021 15:18 UTC](https://forum.confluent.io/t/sql-server-cdc-source-debezium-lock-free-snapshot/1652/4 "2021-05-06T15:18:26Z")

</div>

@rick you can see my question here [https://groups.google.com/g/debezium/c/c3Pa8n-wm6w/m/HQegKoGRAQAJ](https://groups.google.com/g/debezium/c/c3Pa8n-wm6w/m/HQegKoGRAQAJ), according to the debezium team both methods will result in the same data, but exported will not use locks. They also plan to make it the default in future releases.  
The replication slots is been created when you start the connector and is that part that keeps track in Postgres on where “debezium” is in the log, to know if any data can be removed.

To be clear I’m not related to debezium, just came across all those great questions a few weeks ago 🙂

---

<div class="post-metadata">

**Author:** ![batu](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/batu/32/741_2.png) [@batu](https://forum.confluent.io/u/batu)\
**Post date:** [7 May 2021 09:24 UTC](https://forum.confluent.io/t/sql-server-cdc-source-debezium-lock-free-snapshot/1652/5 "2021-05-07T09:24:47Z")

</div>

@shlomi thanks for the explanation, i tried something similar with a self-managed Debezium connector[debezium-doc](https://debezium.io/documentation/reference/connectors/sqlserver.html#sqlserver-property-snapshot-mode) which has parameters called `snapshot.mode` and `snapshot.isolation.mode`. When i implemented it on my test environment with `snapshot.mode = "schema_only"` and `snapshot.isolation.mode="read_committed"` it gave me an abstract solution without locking the Db. But this is self-managed in a docker-container. Due to your answers @rick, @shlomi, i tested it with` snapshot=exported` in Confluent Cloud full-managed connector and it actually behaved similar way as i wanted. As debezium team considering to make **exported** as default, it looks like i shouldn’t worry about the consistency or any possible tradeoffs that much.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [14 May 2021 09:25 UTC](https://forum.confluent.io/t/sql-server-cdc-source-debezium-lock-free-snapshot/1652/6 "2021-05-14T09:25:26Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
