Setting up replication between SQL Server and PostgreSQL involves more than creating an Extract and a Replicat. Network access, authentication, source capture, target data types, initial loading, and the transition to ongoing replication all have to agree.
The oci-gg-setup toolkit uses configuration to describe a SQL Server source and a target in OCI Database with PostgreSQL. It separates discovery, review, execution, and verification so that each installation has its own resource names, schema plan, and execution state.
This article introduces version 0.3.0 of oci-gg-setup and shows how to approach a new installation. The reusable execution code is experimental: it has passed 85 offline tests and local PostgreSQL 18 SQL checks, but it has not yet completed live acceptance testing as a generic installer. Start with the repository’s disposable lab before using another database.
Get the source and detailed runbooks from the GitHub repository.
The replication architecture
The design uses two private OCI GoldenGate deployments: one for SQL Server capture and one for PostgreSQL delivery. An Extract captures source data into trail files. The Distribution Service transfers those trails over secure WebSocket transport, and a Replicat applies the records to the target SQL database.

Figure 1. The replication data path and the separate setup runner. Source placement is logical; SQL Server can also reside in the same VCN when routing and access rules permit.
The Python runner executes the OCI CLI for service operations, calls GoldenGate REST endpoints for runtime configuration, and invokes sqlcmd and psql for database work. Replication data flows through GoldenGate; the Python runner is not a continuous data-transfer process.
The target is an existing SQL database within an OCI Database with PostgreSQL DB system. Its SQL database name is distinct from the DB system display name. A SQL Server source can be on OCI Compute or on premises, provided private connectivity is already established.
What the toolkit automates
The package includes configuration and metadata discovery, target schema planning, database account preparation, private GoldenGate deployment creation, connection assignment and testing, capture logging, an initial snapshot and load, whole-value verification, and CDC startup. Change data capture, or CDC, delivers subsequent source changes after the initial copy.
The workflow separates read-only collection from operations that change databases or create billable OCI resources. An execution plan binds the reviewed configuration, metadata, settings, and generated definitions to a SHA-256 hash. Execution requires that exact hash.

Figure 2. The command groups correspond to ordered execution stages. A persistent journal records mutation requests and their observed results.
The toolkit also records an operation’s intent before sending a mutation. If a response is lost and the outcome is uncertain, it stops for review instead of sending a speculative duplicate. Supported reconciliation can acknowledge a matching, owned OCI deployment or connection through read-only checks. Unknown SQL, GoldenGate REST, and assignment outcomes still require diagnosis.
Prepare a fresh test environment
Run the toolkit from Oracle Linux 9 with Python 3.10 or later. The Python package uses the standard library; running it from the extracted source directory does not require a pip installation. Install and configure the OCI CLI, Microsoft ODBC Driver 18 with the ODBC version of sqlcmd, and psql. OpenSSL is used when retrieving and validating the destination CA.
Before execution, provide:
- An isolated source SQL Server database without existing CDC consumers, and an existing destination SQL database with the selected application objects absent.
- Supported database versions, source edition, and GoldenGate builds reviewed against the applicable Oracle support documentation.
- A private subnet, NSGs, routing, DNS, and host firewall rules. Allow the configured database ports and the required HTTPS/WSS access between the relevant endpoints.
- OCI permissions for deployments, connections, and assignments, plus GoldenGate access to the selected Vault secrets.
- Four existing password secrets: source console, target console, SQL Server capture login, and PostgreSQL apply login. The target console secret is also used for the WSS connection.
- Database administrator credentials, dedicated capture/apply names, and a window to pause application writes and source/target DDL through setup.
This release does not create the databases, network, IAM policies, or Vault secrets. Use a separate environment directory and unique resource names for each installation. Do not import a previous installation’s journal, trails, checkpoints, or snapshot position.
Discover the databases and review the schema
From the extracted project directory, initialize an environment:
python3 -m ggsetup init --environment demo --directory private/demo
The wizard collects OCI profile, authentication, region, compartment, database endpoints, and naming settings without storing database passwords. Supply the private subnet OCID before the first inspection if you intend to execute setup; the first inspection binds the configuration to its journal.
Validate the configuration, retrieve the destination certificate authority, and check local prerequisites:
python3 -m ggsetup validate --config private/demo/environment.json
python3 -m ggsetup fetch-ca --config private/demo/environment.json
python3 -m ggsetup doctor --config private/demo/environment.json
python3 -m ggsetup inspect --config private/demo/environment.json
doctor checks local prerequisites; it does not certify network connectivity or client compatibility. inspect prompts for inspection passwords and collects metadata from both databases. Preserve partial reports and resolve incomplete metadata before planning.
The target uses TLS verify-full with its primary DNS name and CA certificate. The CA retrieval uses OCI PostgreSQL connection metadata, exposed through the connection-details CLI command. Use a trusted SQL Server certificate and matching hostname as well. An explicit source certificate-verification bypass is available for accepted test environments, but encryption alone does not authenticate the server.
Create a schema plan using the actual inspection path printed by the command:
python3 -m ggsetup plan \
--config private/demo/environment.json \
--inspection private/demo/state/inspection-REPLACE_WITH_PRINTED_TIMESTAMP.json \
--output private/demo/plan-01
A schema_plan_ready result emits target DDL and explicit capture/apply mappings for review. A blocked plan identifies unsupported objects and does not silently remove their columns.
The execution subset includes common integer, decimal, text, binary, UUID, and date/time mappings, with a usable primary key required for every selected table. Source identity values become ordinary target values; target sequences are not created. Computed columns, hierarchyid, spatial types, rowversion, and other special features require explicit handling and currently block the generic workflow. Float and real are planning-only in this release and block execution.
Special columns require explicitly tested adapters; the toolkit does not automatically convert them. Review the repository’s support matrix for the exact scope. The target is a data mirror: stored procedures, application triggers, defaults, foreign keys, and SQL Server application behavior are not migrated.
Compile the execution plan
Create execution settings:
python3 -m ggsetup execution-template \
--output private/demo/execution-settings.json
Edit every placeholder. Choose the actual regional SQL Server and PostgreSQL GoldenGate builds, existing NSGs, Vault secret OCIDs, administrator names, account mode, license model, deployment environment type, and OCPUs. The template uses License Included and disables autoscaling; review these choices for your environment.
For new accounts, the capture and apply passwords entered during preparation must match their Vault secret values. The toolkit does not retrieve the secret contents to compare them. Account preparation grants the SQL Server capture user db_owner in the source database and SQLAgentReaderRole in msdb; it does not grant sysadmin. Review those privileges before proceeding.
Compile the plan:
python3 -m ggsetup execution-plan \
--config private/demo/environment.json \
--schema-plan private/demo/plan-01/plan.json \
--settings private/demo/execution-settings.json \
--output private/demo/execution-01
Review execution-plan.json, source-account.review.sql, and target-schema.review.sql. Source preparation enables database CDC and snapshot isolation. Later stages configure table capture and managed CDC cleanup, including removal of the source database’s native cleanup job after the managed setup checks. This is why the initial release requires a source without other CDC consumers. Oracle’s SQL Server CDC operational guidance describes the underlying capture and cleanup considerations.
MAX/LOB columns also require review of SQL Server’s instance-wide max text repl size setting. The toolkit offers an explicit opt-in for unlimited size and refuses to apply RECONFIGURE when unrelated options have pending values.
Copy the printed execution hash:
GGSETUP_PLAN_SHA='PASTE_THE_PRINTED_SHA256'
Keep generated artifacts unchanged. A plan preview does not contain an executable snapshot position; the controller obtains that position from a verified fresh Extract run.
Execute the setup in stages
Pause application writes and source/target DDL. The --writes-paused flag records your declaration; it does not stop applications.
For a first trial, stop after account and target schema preparation, before deployment creation begins:
python3 -m ggsetup execute-all \
--config private/demo/environment.json \
--execution-plan private/demo/execution-01/execution-plan.json \
--approve-sha256 "$GGSETUP_PLAN_SHA" \
--writes-paused --until target-schema
After reviewing the result, continue the sequence with the same configuration, plan, and journal:
python3 -m ggsetup execute-all \
--config private/demo/environment.json \
--execution-plan private/demo/execution-01/execution-plan.json \
--approve-sha256 "$GGSETUP_PLAN_SHA" \
--writes-paused
Completed stages are retained. Known resource IDs are reused and checked rather than blindly recreated. The separate execute-stage command can run one ordered stage, as documented in the execution runbook.
Deployment creation starts billable service usage. Review the two-deployment design and resource settings before continuing. Planned stop/resume recovery is not automated by this release, and a cleanup age setting is not a guaranteed safe outage duration. Recovery depends on actual retained CDC data, trails, and checkpoints.
Connect the initial load to ongoing CDC
The transition from the initial copy to ongoing changes needs a precise source position. The finite initial-load Extract establishes a snapshot and reports a log sequence number, or LSN. The controller verifies that execution and its reported LSN, checks that the position remains covered by retained CDC data, and prepares a distinct CDC pipeline at that position.

Figure 3. The snapshot position links the initial load and ongoing capture. Application writes remain paused throughout the toolkit’s setup sequence.
Oracle documents precise instantiation for SQL Server, including snapshot isolation and positioning CDC from the initial Extract’s reported LSN. GoldenGate supports this method while application updates continue. Version 0.3.0 of this toolkit deliberately requires writes to stay paused through initial verification and CDC startup.
After loading, the toolkit compares every selected row and column using canonical values and SHA-256 fingerprints. It accounts for supported type representations and primary keys rather than relying only on matching row counts. This is a point-in-time verification while writes are paused, not a continuous consistency check.
Only after initial verification succeeds does the workflow start the saved CDC Extract, distribution path, and Replicat. It does not use HANDLECOLLISIONS to conceal duplicate records or reset checkpoints to bypass an error.
Verify changes and inspect runtime health
Run the health and observation commands:
python3 -m ggsetup execution-health \
--config private/demo/environment.json \
--execution-plan private/demo/execution-01/execution-plan.json
python3 -m ggsetup execution-observe \
--config private/demo/environment.json \
--execution-plan private/demo/execution-01/execution-plan.json
Health checks runtime execution identities, lag, source capture prerequisites, cleanup, target shape, privileges, and TLS. Observation reads recorded resources and available process/checkpoint information. Neither command is a continuous end-to-end heartbeat, and health does not repeat the full initial data comparison.
Before allowing normal application writes, use the repository’s disposable lab to test committed inserts, updates, deletes, and a rolled-back transaction. Confirm the expected target results and rerun health. Each installation needs its own acceptance tests using uniquely identified test rows.
If a stage stops, preserve the entire environment directory and reports. Do not delete pending operation intents, replay a source batch, truncate target tables, or reset positions to make a retry proceed. An error can leave a component running; observe the actual state before taking recovery action.
Use the repository as a starting point
The repository contains the Python package, configuration examples, tests, support matrix, discovery tutorial, execution runbook, and disposable lab. Run the offline suite from the project root:
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests -v
The 85 tests exercise ordered execution and failure guards with simulated service responses. Separate local PostgreSQL 18 checks exercise generated account, schema, grant, checkpoint, and comparison SQL. These checks do not establish live SQL Server, OCI GoldenGate, or managed-service certification for the generic installer.
Start with the supported lab schema, establish a successful initial load and DML test, and then inspect your intended tables. Keep real configurations, certificates, reports, and journals outside Git.
Use the discovery tutorial, execution runbook, and disposable lab together when preparing the first installation.
