Skip to content

Connect SPSync to Oracle Database

SPSync writes to Oracle Database through the python-oracledb driver in thin mode. No Oracle Instant Client and no other library is needed on the machine that runs SPSync.

  • An Oracle Database you can reach, and the name of the pluggable database service, for example FREEPDB1 on current releases. You need a DBA login to do the one-time setup.
  • A name for the schema SPSync loads into. On Oracle a schema is a user account, so that name must be a user that already exists.
  • Identifier names: Oracle 12.2 and later allow 128 bytes. A release before 12.2 allows 30, so SharePoint list and column names have to be short enough that the generated names fit.

Create the database and a least-privilege user

Section titled “Create the database and a least-privilege user”

This is the part that differs from every other destination. Oracle cannot create a schema on the fly, and the merge SPSync uses needs a second schema for staging. A DBA creates two users once. SPSync’s own tests run the staging user, the quotas and the ANY TABLE grants below against a throwaway Oracle container, with the passwords replaced. The container image creates the app user itself, so the CREATE USER sync_app lines are from vendor docs, not run here.

CREATE USER sync_app IDENTIFIED BY "use-a-long-random-password";
GRANT CONNECT, RESOURCE TO sync_app;
ALTER USER sync_app QUOTA UNLIMITED ON USERS;
CREATE USER sync_app_staging IDENTIFIED BY "use-another-long-password";
GRANT CONNECT, RESOURCE TO sync_app_staging;
ALTER USER sync_app_staging QUOTA UNLIMITED ON USERS;
GRANT CREATE ANY TABLE, ALTER ANY TABLE, DROP ANY TABLE, SELECT ANY TABLE,
INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY TABLE TO sync_app;

You can print this script, with your own names, instead of typing it. Nothing is run and no password is printed:

Terminal window
spsync oracle-grants --dataset sync_app --tablespace USERS --views

Use --tablespace DATA on Autonomous Database, --auth-mode wallet for a wallet connection, and leave --views off if you do not use reporting views. The command only prints; SPSync does not run it against your database.

sync_app is the schema SPSync loads into and the user it connects as, so dataset_name is sync_app. sync_app_staging must be called <dataset_name>_staging. The ANY TABLE privileges are database-wide. Oracle has no way to scope them to one schema, so think before granting them on a shared production instance.

If you switch on reporting views, sync_app also needs CREATE VIEW. This grant is from vendor docs, not run here:

GRANT CREATE VIEW TO sync_app;

The listener is on TCP 1521 by default. On the desktop app and a self-hosted server the connection starts from that machine, so allow that machine through the host firewall and any network access list. For the Azure managed application, allow the address it connects out from instead of the whole internet.

For Oracle on a cloud virtual machine, that means a security group or network security group rule for the listener port. For a managed Oracle service, use that service’s access control list for the same purpose.

Plain Oracle Net traffic is not encrypted unless the server is set up for it. SPSync can connect over TLS (the tcps protocol, usually port 1522 or 2484) in two ways.

Wallet (TCPS), preview. Choose Wallet (TCPS) under Authentication on the Destination screen, or set auth.mode: oracle_wallet in the CLI config. This is the mode Oracle Autonomous Database uses (mutual TLS), and it works for any TCPS listener.

  • Download the wallet from the Oracle console, protect it with a password, and unzip it. SPSync reads the PEM wallet (ewallet.pem). The auto-login wallet (cwallet.sso) needs Oracle’s thick client mode, which SPSync does not include.
  • Wallet folder: the folder holding ewallet.pem. It also holds tnsnames.ora, so a connect-alias such as mydb_high works as the host name. Set tnsnames.ora folder only if your aliases live somewhere else.
  • Wallet password: you do not type it into SPSync. Put it in an environment variable on the machine that runs SPSync and enter the variable’s name.
  • Verify the server certificate name stays on. Turn it off only to diagnose a problem: spsync doctor and every run warn while it is off. If the certificate’s name differs from the host name, enter the expected name in Expected server certificate DN.
oracle+oracledb://sync_app:PASSWORD@HOST:1522/?service_name=SERVICE&protocol=tcps
oracle+oracledb://sync_app:PASSWORD@mydb_high
destination:
kind: oracle
connection_string_env: SPSYNC_ORACLE_DSN
dataset_name: sync_app
auth:
mode: oracle_wallet
wallet_location: /home/me/wallets/mydb
wallet_password_env: SPSYNC_ORACLE_WALLET_PASSWORD

This mode is a preview. SPSync’s tests check how the wallet and TLS settings are handed to the driver, but it has not been run against a live Autonomous Database or a TCPS listener, so run Test connection and a first sync before you rely on it.

TLS without a wallet. If your database accepts TLS connections without a client wallet (an access control list instead of mutual TLS), keep Password and add &protocol=tcps to the connection string. SPSync rewrites the connect descriptor so the session really starts with a TLS handshake (a plain host:port DSN would otherwise connect in clear text). This is also untested against a live listener here, so run Test connection.

If the database is reachable only through a jump host, SPSync can open an SSH tunnel to that host for each run, forward a local port to the database, and close the tunnel when the run ends. This is a preview: it is tested against a real SSH server in the SPSync test suite, but it has not been run against a live Oracle Database behind a customer’s jump host. Use a host:port/service connection string; a tnsnames alias has no host for SPSync to forward to.

  1. On a machine you trust, read the jump host’s host key fingerprint. This prints a line containing SHA256: followed by 43 characters:

    Terminal window
    ssh-keyscan -t ed25519 bastion.example.com | ssh-keygen -lf -

    SPSync asks the server for an ed25519 host key first, then ECDSA, then RSA, so pin the fingerprint of the first of those the server has. If you are unsure, run ssh-keyscan without -t and pin every fingerprint it prints.

  2. In the connection string, give the database’s address as the jump host sees it, for example db.internal:1521. SPSync rewrites the address to the local port while the tunnel is open; the string you save is not changed.

  3. On the Destination screen, tick Reach the database through an SSH bastion and fill in the host, port, user and fingerprint, then paste a private key (and its passphrase) or enter a password. The key is kept in the computer’s keychain and is not shown again.

  4. In the CLI, add an ssh_tunnel block to the destination in the config file, as below. export-config does not write it. With the admin MCP server, the assistant can set the host, port, user and fingerprint, and you enter the key or password on the secure entry page.

destination:
kind: oracle
connection_string_env: SPSYNC_DSN
ssh_tunnel:
host: bastion.example.com
port: 22 # optional, 22 by default
user: spsync
host_key_fingerprints:
- "SHA256:<the fingerprint from step 1>"
private_key_env: keychain:spsync/bastion-key # or file:/path/to/key, or an environment variable name
# passphrase_env: BASTION_KEY_PASSPHRASE # only if the key has one
# password_env: BASTION_PASSWORD # instead of private_key_env

The host key is always checked. If the jump host presents a key that is not in host_key_fingerprints, SPSync stops before it sends any credential, and there is no setting that turns the check off. Keep a second fingerprint in the list while you rotate the host key. SPSync ignores ~/.ssh/config, known_hosts and any SSH agent: it uses exactly what is configured here. The key, its passphrase and the password are never written to the config file or to the control store; they are stored as keychain or Key Vault references, and a plain environment variable name works for the CLI.

Test connection and spsync doctor open the same tunnel as a run and say so in their result: connected through SSH tunnel, then the user, host and port, and host key pinned. The read-only MCP server (spsync mcp serve) opens its own connection to the replica and does not go through the tunnel.

SSH encrypts the hop to the jump host. A TCPS listener’s certificate name is checked against the host in the connection string, which the tunnel changes to the loopback address; with a wallet, set ssl_server_cert_dn (Expected server certificate DN on the Destination screen) to the certificate’s DN so the check still runs. SPSync does not switch the check off for you.

Method Status
User name and password in the connection string Supported
Wallet (TCPS) with a wallet password from an environment variable Preview, not run against a live Autonomous Database
Kerberos and external (operating-system) authentication Not supported. Needs Oracle’s thick client mode, which SPSync does not ship.
Oracle Cloud (OCI IAM) or Microsoft Entra ID token sign-in Not supported

spsync doctor shows who the connection ran as, using Oracle’s SYS_CONTEXT('USERENV','AUTHENTICATED_IDENTITY').

The string names the pluggable database with service_name, not in the path. HOST is your server’s name:

oracle+oracledb://sync_app:PASSWORD@HOST:1521/?service_name=FREEPDB1

Putting the name in the path (.../FREEPDB1) makes Oracle treat it as an old-style SID, which does not find a pluggable database.

  • Desktop app: open the Destination screen, choose Oracle Database, paste the string into Connection string and choose Test connection.

  • CLI:

    Terminal window
    export SPSYNC_ORACLE_DSN='oracle+oracledb://sync_app:PASSWORD@HOST:1521/?service_name=FREEPDB1'
    spsync export-config --output replication.yaml \
    --site-url https://contoso.sharepoint.com/sites/x --list Projects \
    --pipeline-name spsync_dev --prefix dev \
    --destination-kind oracle --connection-string-env SPSYNC_ORACLE_DSN --dataset-name sync_app \
    --client-id <entra-app-client-id>
  • AI assistant: with the admin MCP server connected, ask for the destination requirements, then let the assistant create the destination. You enter the string on the secure entry page.

Both open a connection and run SELECT 1 FROM dual. With the wallet mode they use the wallet settings you chose. A pass means the listener is reachable, the service name resolves and the password is accepted. It does not check that sync_app exists as a schema, that sync_app_staging exists, or that the privileges are granted. A missing user or privilege appears on the first sync.

What you see What it means and the fix
ORA-12541: TNS:no listener or DPY-6005 The host or port is wrong, or a firewall blocks 1521.
ORA-12514 or DPY-6001 The service name is not registered. Check service_name with your DBA.
ORA-01017: invalid username/password Wrong password, or the user is locked.
ORA-01918: user 'SYNC_APP_STAGING' does not exist The staging user is missing or has the wrong name. It must be <dataset_name>_staging.
ORA-01031: insufficient privileges The ANY TABLE grants or CREATE VIEW are missing.
ORA-01950: no privileges on tablespace The user needs QUOTA UNLIMITED ON USERS (or its tablespace).