Skip to main content

PostgreSQL to Sybase Data Replication

NineData Data Replication supports replicating data from PostgreSQL to Sybase, including full and incremental replication.

Overview

NineData data replication supports schema, full data, and incremental data replication between data sources. For supported data sources, it also supports bidirectional replication for geo-distributed active-active architectures.

  • Schema replication: Replicates object structures between homogeneous and heterogeneous data sources.
  • Full data replication: Uses data sharding and row-level concurrent batch replication to improve throughput. Breakpoint resume helps preserve data accuracy, including for tables without primary keys.
  • Incremental data replication: Replicates DML and DDL changes for supported object types. Row-level concurrency and hotspot merge processing help maintain replication throughput.
  • Bidirectional real-time data replication (only between MySQL instances): Replicates changes in both directions between nodes so data can stay current across participating nodes.

Use these capabilities for full or incremental data replication, migration, synchronization, data integration, and low-downtime migration workflows.

Before you begin

  • Add the source and target data sources to NineData. For instructions, see Create a PostgreSQL data source and Create a Sybase data source.

  • The source data source is PostgreSQL.

  • The target data source is Sybase.

  • Tables must already be created manually in the target data source (Sybase), and their structure must be compatible with the source tables in PostgreSQL. This replication path does not support schema replication. See Appendix 1: Target Table Design Suggestions.

  • You must have the appropriate permissions on both the source and target data sources. For more detailed guidance, trigger behavior, and grant examples, see PostgreSQL and Sybase Replication Permission Guide.

    Replication Content
    PostgreSQL
    Sybase
    Full ReplicationCONNECT, SELECTSELECT, INSERT, UPDATE, DELETE on the target tables
    Incremental ReplicationPermissions required to read source-side changes, plus the PostgreSQL parameter configuration described belowSELECT, INSERT, UPDATE, DELETE on the target tables; if target triggers stay disabled during replication, replication_role is also required
  • For incremental replication, open postgresql.conf and configure the following parameters. If the file location is unknown, run SHOW config_file; in a psql client.

    • The wal_level parameter of the source data source must be logical. To confirm the current value, run SHOW wal_level.
    • The wal_sender_timeout parameter of the source data source must be set to 0. This parameter interrupts replication connections that remain stalled longer than the specified number of milliseconds. The default is 60000 milliseconds. Setting it to 0 disables the timeout. To confirm the current value, run SHOW wal_sender_timeout.
    • The max_replication_slots parameter of the source data source must be greater than 1. This parameter specifies the maximum number of replication slots the server supports. The default value is 10.
    • The max_wal_senders parameter of the source data source must be greater than 1. This parameter specifies the maximum number of concurrent replication connections. The default value is 10. To confirm the current value, run SHOW max_wal_senders.

Restrictions

  • This replication path does not support schema replication. Prepare the target database, tables, and required indexes in Sybase before you create the task.
  • This replication path does not support column mapping. Target table names and column names must stay consistent with the source side.
  • This replication path supports field expressions on existing target columns in Configuration Mapping > Mapping and Filtering > Field Expression. See the recommended function list below.
  • This replication path does not support incremental DDL replication. During incremental replication, only data changes are synchronized. If the source adds columns or changes data types, handle those structural changes manually before continuing.
  • Before you run a replication task, evaluate the performance of both the source and target data sources. Run the task during off-peak hours when possible because full initialization can consume read and write resources and increase database load.
  • Ensure that each replicated table has a primary key or unique constraint, and that column names are unique. Otherwise, duplicate synchronization may occur.

Field Mapping and Field Expressions

  • Target fields must remain consistent with actual columns in the Sybase target table.
  • In Configuration Mapping > Mapping and Filtering > Field Expression, configure field expressions for existing target columns.

For the entry, usage rules, and common writing patterns of field expressions, see ETL Functions.

Procedure

  1. Sign in to the NineData Console.

  2. From the navigation menu, click Replication.

  3. On the Replication page, click Create Replication in the page header.

  4. On the Source & Target tab, configure the task using this table, then click Next.

    Parameter
    Description
    NameEnter a meaningful task name. Up to 64 characters are supported.
    SourceSelect the PostgreSQL source data source.
    TargetSelect the Sybase target data source.
    Target DBSelect the target database that will receive the synchronized objects.
    TypeSelect Full for full replication. If you need continuous synchronization of source-side changes, also enable Incremental.
    Target Table Exists DataChoose how to handle data that already exists in the target tables: stop, ignore conflicting rows, or delete and rewrite them.
    TriggerChoose whether to execute target-side Sybase triggers during replication. The default is disabled. If you keep the default, the target account needs replication_role. If you enable target triggers, writes may fail because of foreign keys, audit logic, or business-trigger behavior.
  5. On the Objects tab, choose the objects to replicate, then click Next.

    • Choose All Objects to replicate all source objects, or choose Customized Object to replicate only selected objects.
    • This replication path does not support column mapping, so target table names and column names must stay consistent with the source side.
  6. On the Mapping tab, confirm the target database and target table mapping, then click Save and Pre-Check.

    • NineData prefers the database with the same name on the target side. If no same-name database exists, select the target database manually.
    • This replication path does not support schema replication. Confirm that target tables, columns, primary keys, and required indexes already exist.
    • If metadata changes on the source or target side during configuration, click Refresh Metadata in the page header to refresh the metadata.
  7. On the Pre-check tab, wait for the precheck to complete. After the precheck passes, click Launch.

    tip
    • Enable Enable data consistency comparison to start a consistency comparison based on the source data source after synchronization completes.
    • If the precheck fails, click Details in the Actions column for the failed item, fix the problem manually, then click Check Again until the precheck passes.
    • For items whose Result is Warning, fix the issue or ignore the warning based on your scenario.
  8. After the Launch page shows Launch Successfully, the replication task starts running. Click View Details to view details, or click Back to list to return to the task list.

Result

  1. Sign in to the NineData Console.

  2. In the navigation menu, select Replication > Data Replication.

  3. On the Replication page, click the Task ID of the target synchronization task, and review the task details page.

    result_sybase

    No.
    Function
    Description
    1Synchronization DelayThe synchronization delay between the source and target data sources. 0 seconds means the target has caught up with the source. Switch traffic based on your migration plan.
    2Configure AlertsWhen the task fails, NineData notifies the selected channel through the configured alert.
    3More
    • Pause: Pause the task, only available for tasks in the running status.
    • Duplicate: Create a new replication task with the same configuration as the current task.
    • Terminate: End tasks that are incomplete or in listening mode (i.e., incremental synchronization). After terminating the task, it cannot be restarted, proceed with caution. If the synchronization object includes triggers, trigger replication options appear for selection.
    • Delete: Delete the task, the task cannot be recovered after deletion, proceed with caution.
    4Full Replication (displayed in scenarios including full replication)Displays the progress and detailed information of full replication.
    • Select Monitor to view various monitoring metrics during the full replication process. During the full replication process, select Flow Control Settings on the monitoring page to limit the rate of writing to the target data source per second. The unit is rows/second.
    • Select Log to view the execution logs of full replication.
    • Select the refresh to view the latest information.
    5Incremental Replication (displayed in scenarios including incremental replication)Displays various monitoring metrics for incremental replication.
    • Select View Threads to view the operations currently being executed by the replication task, including:
      • Thread ID: The replication task is executed by multiple threads, displaying the current thread number.
      • Execute SQL: Details of the SQL statement currently being executed by the current thread.
      • Response Time: The response time of the current thread, if this value increases, it indicates that the current thread may be stuck for some reason.
      • Event Time: The timestamp when the current thread started.
      • Status: The status of the current thread.
    • Select Flow Control Settings to limit the rate of writing to the target data source per second. The unit is rows/second.
    • Select Log to view the execution logs of incremental replication.
    • Select the refresh to view the latest information.
    6Modify ObjectsDisplays the modification records of synchronization objects.
    • Select Modify Objects to configure synchronization objects.
    • Select the refresh to view the latest information.
    7Data ComparisonDisplays the results of the comparison between the source and target data sources. If data comparison is not enabled, select Enable Comparison on the page to enable it.
    • Select Re-compare to rerun the comparison for the current source and target data sources.
    • Select Stop: After the comparison task starts, select this button to stop the comparison task immediately.
    • Select Log to view the execution logs of consistency comparison.
    • Select Monitor (only displayed during data comparison) to view the trend chart of comparison RPS (records compared per second). Select Details to view records from earlier times.
    • Select the details in the Actions column in the comparison list (only displayed under the Data tab when inconsistencies are found) to view the comparison details between the source and target data sources.
    • Select the sql in the Actions column in the comparison list (displayed when inconsistencies are found): Generate change SQL. Copy this SQL to the target data source and run it to fix the mismatch.
    8ExpandDisplays detailed information of the current replication task.

Appendix 1: Target Table Design Suggestions

Because PostgreSQL to Sybase replication does not currently support schema replication, create the target tables in Sybase manually before you create the task.

Common Data Type Mapping

PostgreSQL Data TypeRecommended Sybase TypeNotes
SMALLINTSMALLINTDirect mapping is usually fine.
INTEGER / INT4INTDirect mapping is usually fine.
BIGINT / INT8BIGINTDirect mapping is usually fine.
NUMERIC(p,s) / DECIMAL(p,s)DECIMAL(p,s)Keep precision and scale aligned whenever possible.
REALREALDirect mapping is usually fine.
DOUBLE PRECISIONDOUBLE PRECISIONAdjust based on precision requirements if needed.
BOOLEANBITStandardize the business meaning around 0 / 1.
CHAR(n) / VARCHAR(n)CHAR(n) / VARCHAR(n)Length definitions can usually be preserved.
TEXTTEXT / UNITEXTUNITEXT is often a good choice for large text content.
BYTEAVARBINARY / IMAGEEvaluate whether large binary objects should use IMAGE.
DATEDATEDirect mapping is usually fine.
TIMESTAMPDATETIME / BIGDATETIMEIf you need higher timestamp precision, prefer BIGDATETIME.
TIMETIME / BIGTIMEChoose based on precision requirements.
UUIDCHAR(36) / VARCHAR(36)It is generally safest to store UUID values as strings.
JSON / JSONBUNITEXT / VARCHARStore JSON content as string/text data.

Table Design Suggestions

  • Keep target table names and column names consistent with the source side whenever possible, because this link does not support column mapping.
  • Create primary keys, unique constraints, and required indexes in advance so that incremental writes and data comparison stay stable.
  • If target tables contain triggers, confirm whether they should run during replication. Keeping them disabled is usually the safer default.
  • If the target tables contain identity columns, auto-increment logic, or audit columns, validate both full initialization and incremental replay in a test environment first.

Appendix 2: Precheck items

Check ItemDescription
Target object existence checkCheck whether the objects to be replicated already exist in the target database.
Source data source connection checkCheck gateway status, connectivity, and account credentials for the source data source.
Target data source connection checkCheck gateway status, connectivity, and account credentials for the target data source.
Target privilege checkCheck whether the target account has sufficient permissions.
Source privilege checkCheck whether the source account has sufficient permissions.
Target data existence checkCheck whether target objects already contain data.
Check wal_levelCheck whether the source wal_level is logical.
Check max_wal_sendersCheck whether max_wal_senders satisfies replication connection requirements.
Check max_replication_slotsCheck whether max_replication_slots satisfies replication-slot requirements.

Next steps