---
title: "CDC Sink: Enable/Disable Task"
description: "How to pause and resume a CDC Sink task using the RavenDB Client API (ToggleOngoingTaskStateOperation) and through the Management Studio."
url: "https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/manage-cdc-sink-tasks/enable-disable-task"
version: "7.2"
language: "csharp"
---

# CDC Sink: Enable/Disable Task

> Client language: C#.
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

> **Note**
>
> - You can enable or disable CDC Sink at two levels:
>   - **Task level**:  
>     Pause or resume the entire CDC Sink task without deleting it.  
>     A disabled task keeps its full configuration but stops consuming changes from the source.
>   - **Table level**:  
>     Enable or disable an individual configured table.  
>     A disabled table is skipped by CDC Sink while the task can continue syncing its other enabled tables.
>
> - A CDC Sink task can be reported as one of the following:
>   - `Enabled` - the task is enabled, with all configured tables enabled.
>   - `PartiallyEnabled` - the task is enabled, but some configured tables are disabled.
>   - `Disabled` - the task itself is disabled, or all configured tables are disabled.
>
> - This article shows how to enable or disable a CDC Sink task or a specific table using the Client API, Studio,  
>   or REST API where applicable.
>
> - In this article:
>   - [Enable/Disable a CDC Sink task via Client API](#enable-disable-a-cdc-sink-task-via-client-api)
>   - [Enable/Disable a CDC Sink task via Studio](#enable-disable-a-cdc-sink-task-via-studio)
>   - [Enable/Disable a CDC Sink task via REST API](#enable-disable-a-cdc-sink-task-via-rest-api)
>   - [Enable/Disable a configured table via Client API](#enable-disable-a-configured-table-via-client-api)
>   - [Enable/Disable a configured table via Studio](#enable-disable-a-configured-table-via-studio)
>   - [Source-side effects of pausing a CDC Sink task](#source-side-effects-of-pausing-a-cdc-sink-task)

## Enable/Disable a CDC Sink task via Client API {#enable-disable-a-cdc-sink-task-via-client-api}

Pause or resume the entire CDC Sink task using `ToggleOngoingTaskStateOperation`.  
Pass the CDC Sink task ID, `OngoingTaskType.CdcSink`, and `disable: true` to pause or `disable: false` to resume.

This operation affects the task as a whole.  
To enable or disable a single table, see [Enable/Disable a configured table via Client API](#enable-disable-a-configured-table-via-client-api).

### Sync

```csharp
// Pause (disable) the task
store.Maintenance.Send(
    new ToggleOngoingTaskStateOperation(taskId, OngoingTaskType.CdcSink, disable: true));

// Resume (enable) the task
store.Maintenance.Send(
    new ToggleOngoingTaskStateOperation(taskId, OngoingTaskType.CdcSink, disable: false));
```

### Async

```csharp
// Pause (disable) the task
await store.Maintenance.SendAsync(
    new ToggleOngoingTaskStateOperation(taskId, OngoingTaskType.CdcSink, disable: true));

// Resume (enable) the task
await store.Maintenance.SendAsync(
    new ToggleOngoingTaskStateOperation(taskId, OngoingTaskType.CdcSink, disable: false));
```

## Enable/Disable a CDC Sink task via Studio {#enable-disable-a-cdc-sink-task-via-studio}

To enable or disable the entire CDC Sink task from the Studio:

![Enable/Disable task](https://docs.ravendb.net/assets/images/enable-disable-1-3745e949bfa140a8c34d1110ffd77803.png)

1. Navigate to **Databases** → your database → **Tasks** → **Ongoing Tasks**.
2. On the CDC Sink task, click its state dropdown and select **Enable** or **Disable**.  
   Alternatively, open the task for editing and use the **Task State** selector, then **Save**.

To enable or disable individual tables, see [Enable/Disable a configured table via Studio](#enable-disable-a-configured-table-via-studio).

## Enable/Disable a CDC Sink task via REST API {#enable-disable-a-cdc-sink-task-via-rest-api}

Use the shared ongoing-task state endpoint to pause or resume the entire CDC Sink task.  
Pass the CDC Sink task ID as `key`, `type=CdcSink`, and `disable=true` to pause or `disable=false` to resume.  
No request body is required.

| Method | Endpoint | Auth |
| - | - | - |
| `POST` | `/databases/{databaseName}/admin/tasks/state?key={taskId}&type=CdcSink&disable={true\|false}` | `DatabaseAdmin` |

This endpoint affects the task as a whole.  
To enable or disable a single table, see:

- [Enable/Disable a configured table via Client API](#enable-disable-a-configured-table-via-client-api)
- [Enable/Disable a configured table via Studio](#enable-disable-a-configured-table-via-studio)

## Enable/Disable a configured table via Client API {#enable-disable-a-configured-table-via-client-api}

In addition to enabling or disabling the task as a whole, you can enable or disable an **individual table** within a CDC Sink task.
Each table is defined by a `CdcSinkTableConfig` that carries its own `Disabled` flag.

When a table is disabled, CDC Sink skips it:
the table is not initial-loaded, and changes from that table are not applied to RavenDB while it is disabled.
The task's other enabled tables keep syncing.

Disabling a single table is a configuration change, so there is no dedicated toggle operation for it.  
Set `Disabled` on the relevant table and send the complete updated configuration with `UpdateCdcSinkOperation`  
(the same operation used to [update a task](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/manage-cdc-sink-tasks/update-task.md)).

### Sync

```csharp
// config holds the existing task configuration.

// Disable a single table by setting its Disabled flag
var table = config.Tables.First(t => t.SourceTableName == "orders");
table.Disabled = true;

// To re-enable the table later, set:
// table.Disabled = false;

// Send the complete updated configuration
store.Maintenance.Send(new UpdateCdcSinkOperation(taskId, config));
```

### Async

```csharp
// config holds the existing task configuration.

// Disable a single table by setting its Disabled flag
var table = config.Tables.First(t => t.SourceTableName == "orders");
table.Disabled = true;

// To re-enable the table later, set:
// table.Disabled = false;

// Send the complete updated configuration
await store.Maintenance.SendAsync(new UpdateCdcSinkOperation(taskId, config));
```

## Enable/Disable a configured table via Studio {#enable-disable-a-configured-table-via-studio}

To enable or disable a configured root table from the Studio, open the CDC Sink task for editing  
(**Ongoing Tasks** → click the task name or the edit icon), then go to the **Configured Tables** section:

![Enable/Disable table](https://docs.ravendb.net/assets/images/enable-disable-2-6def05741a63b54c32926624a29cc0aa.png)

1. In the **Tables** list, click the three-dots **Table actions** icon for the table you want to change.
2. Select **Disable** (the same action shows **Enable** when the table is already disabled).

Click **Save task configuration** to apply the change.

A disabled table is shown dimmed in the **Tables** list.  
If the task itself remains enabled and at least one other configured table remains enabled,  
the task is listed as `PartiallyEnabled` in the **Ongoing Tasks** view.

## Source-side effects of pausing a CDC Sink task {#source-side-effects-of-pausing-a-cdc-sink-task}

These effects apply when the **whole task is paused** and CDC Sink stops advancing its source-database position.  
They do not apply in the same way when an individual table is disabled while the task keeps running.

**PostgreSQL:**  
Pausing a CDC Sink task stops the replication slot from being consumed.
PostgreSQL retains WAL segments for unconsumed slots, so pausing for an extended period causes WAL to accumulate on disk.  
Monitor disk usage if a task is paused for more than a short time.
See [Monitoring PostgreSQL](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/source-database-setup/postgres/monitoring-postgres.md).

**SQL Server:**  
Pausing a CDC Sink task for longer than SQL Server's CDC retention period can cause SQL Server to clean up CDC change-table rows that have not yet been consumed.
If cleanup occurs while the task is paused, CDC Sink will report an error on resume - the task may need to be recreated rather than simply resumed.

## See also

- [Get Task Info](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/manage-cdc-sink-tasks/get-task-info.md)
- [Monitoring](https://docs.ravendb.net/7.2/server/ongoing-tasks/cdc-sink/monitoring.md)
- [Ongoing Task Operations](https://docs.ravendb.net/7.2/client-api/operations/maintenance/ongoing-tasks/ongoing-task-operations.md)
