> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate and Replicate Data with Qlik Replicate

[Qlik](https://www.qlik.com) offers a service called Qlik Replicate that you can use to do the following:

* [Migrate data to CockroachDB](#migrate-and-replicate-data-to-cockroachdb) from an existing, publicly hosted database containing application data, such as PostgreSQL, MySQL, Oracle, or Microsoft SQL Server.

As of this writing, Qlik supports the following database [sources](https://www.qlik.com/us/products/data-sources):

* Cassandra
* Couchbase
* DB2 for iSeries
* DB2 for LUW
* DB2 for z/OS
* HP Nonstop Enscribe (AIS)
* HP Nonstop SQL/MP (AIS)
* IBM Informix
* IMS/DB
* MariaDB
* Microsoft SQL Server
* MongoDB
* MySQL
* OpenVMS RMS
* Oracle
* Percona
* PostgreSQL
* SAP HANA
* SAP Sybase ASE
* Other via ODBC (with or without CDC)

This page describes the Qlik Replicate functionality at a high level. For detailed information, refer to the tutorial and documentation provided when [signing up for Qlik Replicate](https://www.qlik.com/us/products/qlik-replicate).

## Before you begin

Complete the following items before using Qlik Replicate:

* Ensure you have a secure, publicly available CockroachDB cluster running the latest [production release](/docs/releases/index.md), and have created a [SQL user](/docs/stable/security-reference/authorization.md#sql-users) that you can use for your Qlik Replicate target endpoint.
  * Set the following [session variables](/docs/stable/set-vars.md#supported-variables) using [`ALTER ROLE ... SET session variable`](/docs/stable/alter-role#set-default-session-variable-values-for-a-role):

    ```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
    ALTER ROLE {username} SET copy_from_retries_enabled = true;
    ```

    ```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
    ALTER ROLE {username} SET copy_from_atomic_enabled = false;
    ```

    This prevents a potential issue when migrating especially large tables with millions of rows.

* If you are migrating to a CockroachDB Cloud cluster and plan to [use replication as part of your migration strategy](#migrate-and-replicate-data-to-cockroachdb), you must first **disable** [revision history for cluster backups](/docs/stable/take-backups-with-revision-history-and-restore-from-a-point-in-time.md) for the migration to succeed.

> [!CAUTION]
>
> You will not be able to run a [point-in-time restore](/docs/stable/take-backups-with-revision-history-and-restore-from-a-point-in-time.md#point-in-time-restore) as long as revision history for cluster backups is disabled. Once you verify in the Qlik Replicate Monitor view that the migration succeeded, you should re-enable revision history.

* If the output of [`SHOW SCHEDULES`](/docs/stable/show-schedules) shows any backup schedules, run [`ALTER BACKUP SCHEDULE {schedule_id} SET WITH revision_history = 'false'`](/docs/stable/alter-backup-schedule) for each backup schedule.
* If the output of `SHOW SCHEDULES` does not show backup schedules, [contact Support](https://support.cockroachlabs.com) to disable revision history for cluster backups.
* Manually create all schema objects in the target CockroachDB cluster. Qlik can create a basic schema, but does not create indexes or constraints such as foreign keys and defaults.
  * If you are migrating from PostgreSQL, MySQL, Oracle, or Microsoft SQL Server, [use the **Schema Conversion Tool**](/docs/cockroachcloud/migrations-page.md) to convert and export your schema. Ensure that any schema changes are also reflected on your tables, or add transformation rules. If you make substantial schema changes, the Qlik Replicate migration may fail.

> [!NOTE]
>
> All tables must have an explicitly defined primary key. For more guidance, see [Migration Strategy](/docs/molt/migration-strategy.md#schema-design-best-practices).

## Migrate and replicate data to CockroachDB

You can use Qlik Replicate to migrate tables from a source database to CockroachDB. This can comprise an initial load that copies the selected schemas and their data from the source database to CockroachDB, followed by continuous replication of ongoing changes using Qlik change data capture (CDC).

In the Qlik Replicate interface, the source database is configured as a **source endpoint** with the appropriate dialect, and CockroachDB is configured as a PostgreSQL **target endpoint**. For information about where to find the CockroachDB connection parameters, see [Connect to a CockroachDB Cluster](/docs/stable/connect-to-the-database.md).

> [!NOTE]
>
> To use a CockroachDB Standard or Basic cluster as the target endpoint, set the **Database name** to `{host}.{database}` in the Qlik Replicate dialog. For details on how to find these parameters, see [Connect to your cluster](/docs/cockroachcloud/connect-to-your-cluster.md?filters=connection-parameters#connect-to-your-cluster). Also set **Secure Socket Layer (SSL) mode** to **require**.

* To perform both an initial load and continuous replication of ongoing changes to the target tables, select **Full Load** and **Apply Changes**. This minimizes downtime for your migration.
* To perform a one-time migration to CockroachDB, select **Full Load** only.

To preserve the schema you manually created, select **TRUNCATE before loading** or **Do nothing**.

## See also

* [Migration Overview](/docs/molt/migration-overview.md)
* [Schema Conversion Tool](/docs/cockroachcloud/migrations-page.md)
* [Change Data Capture Overview](/docs/stable/change-data-capture-overview.md)
* [Third-Party Tools Supported by Cockroach Labs](/docs/stable/third-party-database-tools.md)
* [Migrate with AWS Database Migration Service (DMS)](/docs/stable/aws-dms.md)
