Add a Replicat for Google Cloud Spanner

Learn about the configurations required before adding a Replicat for Google Cloud Spanner in an Oracle GoldenGate deployment and the steps to add a Replicat.

Before Adding a Replicat

You need to configure a database connection to Google Cloud, set up the Checkpoint table, and establish a database connection to Google Cloud before you begin adding a Replicat. Optionally, you can also create the heartbeat table.

Also, make sure to go through the list of supported data types, objects and operations. For details, see Google Spanner: Supported Data Types, Objects and Operations.

Learn how to configure Google Cloud for Oracle GoldenGate Replicat.

Authenticate Connection to Google Cloud Using IAM

Google Spanner is a fully managed, cloud-native distributed database. For Oracle GoldenGate Replicat for Google Spanner, passwordless authentication is implemented.

Authentication in Google Cloud Spanner is fundamentally different from traditional relational databases like MySQL, PostgreSQL, or SQL Server because it is not a standalone database server that is logged into directly.

Spanner uses Google Cloud IAM (Identity and Access Management) and authentication happens at the cloud platform level, not inside Google Spanner.

Following are the steps for authenticating a connection to Google Cloud through IAM:

  1. User application is authenticated to Google Cloud using service account credentials in the JSON file.

    Service account needs to have roles/Spanner.databaseUser, roles/spanner.databaseAdmin roles.

  2. Download the credentials file:

    1. Log in to your Google account at cloud.google.com.

    2. Click Console, and then to go to the Dashboard where you can select your project.

    3. From the navigation menu, click APIs & Services then select Credentials.

    4. From the Create Credentials menu, choose Service account key.

    5. Choose the JSON key type to download the JSON credentials file for your system. This JSON credential file should be provided as input while adding the database connection in the web interface.

    Spanner supports only the https_proxy and does not support the http_proxy. If you connect to Spanner behind a proxy server, then https_proxy must be set and http_server must not be set. The https_proxy can be set in the environment variable for configuration of the Service Manager.

Add a Database Connection, Checkpoint Table, and Heartbeat Table

The process to add a Replicat for Google Cloud Spanner is the same as adding any Replicat. Set up the following configurations before you begin adding a Replicat:

  1. Add a database connection.

Adding a database connection on the target

  1. Connect to the database after creating the Database alias to ensure that the connection is successful. After the database connects, you can add the checkpoint table.

  2. Click the plus sign next to Checkpoint to open the Add Checkpoint screen and specify the checkpoint table name in the schema.table_name format.

    Add checkpoint table

  3. Click Submit. The checkpoint table is added.

  4. In the left-navigation pane under the connected database, check the heartbeat table. The heartbeat table is enabled to check heartbeat lag.

Heartbeat table is displayed as enabled for Spanner Replicat

Add a Replicat for Google Spanner

Before you start adding a Replicat, make sure that you have set up the database connections and created the checkpoint table. See Add a Database Connection, Checkpoint Table, and Heartbeat Table for details.

Use the following steps to create a classic or coordinated Replicat for Google Spanner:

  1. Open the Add Replicat wizard and select Classic Replicat for Spanner.

    Add Classic Replicat for Google Spanner

  2. Specify the Replicat name and click Next.

  3. Specify the Replicat Options such as the trail name, target credentials, and checkpoint table name.

    Specify the Replicat options such as trail file name, and checkpoint table name

  4. On the Parameter File screen, specify the MAP and TARGET details and clickCreate and Run. This would create the Spanner Replicat.

    Specify the MAP and TARGET values in the Replicat parameter file.

Note: If unqualified table name is used in the MAP statement of Replicat parameter, the schema name is taken from GGSCHEMA specified in the GLOBALS file. If GGSCHEMA is not defined in the GLOBALS parameter, then the default (unnamed) schema is used for the replication.

If all the specifications are correctly configured, the Replicat runs successfully.

GoldenGate Replicat for Google Spanner in Running state

Add a Replicat Using the Admin Client

Before you start adding a Replicat, make sure that you have set up the database connections and created the checkpointtable and heartbeattable. See Add a Database Connection, Checkpoint Table, and Heartbeat Table for details.

Use the following steps to create a classic or coordinated Replicat for Google Spanner from Admin Client:

  1. Connect to the deployment from the Admin Client prompt.

  2. Run the following command to create a database connection:

    ALTER CREDENTIALSTORE ADD USER "oggh-440221@xxxxxx/srcdb;client_secrets=/scratch/creds.json" nopassword alias spanner
  3. Connect to the database credential that you created in the preceding step:

    DBLOGIN USERIDALIAS spanner
  4. Run the commnad to add the Replicat:

    ADD REPLICAT nrep, classic, EXTTRAIL ea, checkpointtable ggadmin.ckpt1

    The output confirms if the Replicat is added successfully.

  5. You can add other parameters for the Replicat in the Replicat parameter file using the EDIT PARAMS command.

    EDIT PARAMS nrep

    Specify the required parameters in the Replicat parameter file. Following is a sample Replicat parameter file:

    DDL EXCLUDE ALL
    DDLERROR default discard
    REPERROR (default,discard)
    DDLOPTIONS REPORT
    SOURCECATALOG spanner MAP hr.*, TARGET hr.*;
  6. Start the Replicat and make sure it runs successfully.

    START REPLICAT nrep

    ### Additional References {#GUID-C737B199-8182-47BC-986C-088BC1171863}

See Handling Transient and Permanent Errors in Replicat for Google Spanner to learn about handling errors in Replicat for Google Cloud Spanner.