Chat now with support
Chat with Support

SharePlex 9.2.5 - Reference Guide

About this guide Conventions used in this guide SharePlex commands SharePlex parameters General SharePlex utilities Database Setup utilities SharePlex environment variables

Trigger Scripts

Description

SharePlex provides three interactive scripts that you can run in SQL*Plus to manage triggers so that they do not interfere with replication. Review the following points before you run the scripts.

  • To run the trigger scripts, you must have access to both the SYS and DBA objects. If the SharePlex database account was set up properly during installation, that account has this access.

  • After applying an Oracle patch (which sometimes creates or modifies triggers), re-run sp_add_trigger.sql on the target system if triggers are not disabled.
  • The scripts reside in the util sub-directory of the SharePlex product directory.

  • The SharePlex trigger scripts support row-level triggers only. Statement-level triggers must be disabled/enabled for the SharePlex user separately.
  • Triggers that modify data in tables NOT being replicated and do not affect tables in the replication configuration can fire on the target system without special treatment. However, the scripts operate on all objects in the Oracle instance, whether or not they are part of replication.
  • SharePlex provides other interactive scripts for managing triggers.
  • The scripts must be run for target objects. Do not run them on the source objects unless you are using peer-to-peer replication.
  • The scripts should not be used if source and target objects are both on the same machine. In this configuration, the user can disable triggers on target objects.

Supported databases

Oracle on supported platforms

sp_add_trigger.sql

Use sp_add_trigger.sql when you cannot disable triggers on target objects, such as for peer-to-peer and high-availability configurations. This script changes the triggers so that they ignore the SharePlex Oracle user associated with the Post process, but fire for all other users. It inserts the following WHEN clause into each trigger in the database.

when user != ‘SharePlex_username’ begin

The script prompts for the SharePlex user name, and then it modifies the triggers. It does not modify triggers belonging to SYS, SYSTEM, and SCOTT.

Syntax

@absolute_pathname/sp_add_trigger.sql

sp_change_trigger.sql

Use sp_change_trigger.sql to replace the name of the SharePlex user in the WHEN clause that was created with sp_add_trigger.sql. It prompts for the current SharePlex user name and for the new user name. Change the SharePlex user in Oracle before you run this script.

Syntax

@absolute_pathname/sp_change_trigger.sql

sp_remove_trigger.sql

Use sp_remove_trigger.sql to remove the WHEN clause created with sp_add_trigger.sql. It prompts for the SharePlex user name and then automatically removes the WHEN clause from all of the triggers. Use this script if you no longer will be replicating to those tables. If you continue to use SharePlex to replicate to those tables without disabling the triggers, the triggers will fire when SharePlex posts data, and SharePlex will generate out-of-sync errors.

Syntax

@absolute_pathname/sp_remove_trigger.sql

Database Setup utilities

The Database Setup utilities automatically configure a source or target database to allow Shareplex connections and to establish required database components that support replication.

Contents

HANA Setup (hana_setup)

Overview

Run the Database Setup utility for HANA (hana_setup) on a target HANA system to establish a user account, schema, and tables for use by SharePlex.

Supported databases

HANA on supported platforms

Guidelines for use

  • Run the setup utility on all target HANA instances in the SharePlex replication configuration.
  • Within a server cluster, run the setup utility on the node that has the mount point to the shared disk that contains the SharePlex variable-data directory.
  • For consolidated replication, run the setup utility for each variable-data directory.
  • The only supported connection method to HANA is by connect string. Connection through a DSN is not supported.

  • Make certain that you assign the required permissions that are shown in this setup process.

Required privileges

The setup utility must be run as a HANA Administrator in order to grant SharePlex the required privileges to operate on the database and to create the SharePlex database account.

Run Database Setup for HANA

  1. Shut down any running SharePlex processes and sp_cop on the target system.
  2. Run the hana_setup program from the bin subdirectory of the SharePlex product directory.

    Important! If you installed the SharePlex instance on any port other than the default of 2100, use the -p option to specify the port number. For example, in the following command the port number is 9400.

    $ /users/splex/bin> hana_setup -p9400

Table 3: Setup Prompts and Responses

Prompt Response

Enter the HANA connection string [] :

Enter a connection string that connects to the HANA database system. The required components of a connection string for SharePlex to connect to HANA are:

  • SERVERNODE: The name of the target HANA server, then a colon, then the HANA port number.
  • DRIVER: The path to the HANA ODBC driver.
  • CHAR_AS_UTF8: This must be passed as CHAR_AS_UTF8=1.

Example:

SERVERNODE=server1.dept.abc.corp:30015;DRIVER=/usr/sap/hdbclient/libodbcHDB.so;CHAR_AS_UTF8=1

You do not have to supply a user, password, and default database, because the setup utility prompts for those.

Enter the HANA Administrator name :

Enter the name of the HANA Administrator. This user will perform the work on the SharePlex account.

Enter the password for the Administrator account :

Enter the password of the Administrator.

Enter the name of the database :

Enter the name of the database that you want to contain the tables and other objects for use by SharePlex. You can enter the name of a new or existing database.

Database name database does not exist. Would you like to create it? [y] :

If this prompt is displayed, the specified database does not exist. Press Enter to have the setup utility create it for you.

Would you like to create a new SharePlex user [y]:

Press Enter to accept the default to create a new SharePlex database user account and schema of the same name in the specified database, or enter n to use an existing SharePlex account.

Enter the name of the new SharePlex user:

Enter the name of the existing SharePlex user:

One of these prompts is displayed depending on whether you elected to create a new user or use an existing user. Enter the name of the SharePlex user.

 

Enter the password of the SharePlex user :

Enter the password of the SharePlex user account.

Re-enter the password for the SharePlex user :

This prompt is only shown if you created a new user. Enter the SharePlex password again.

A successful setup terminates with a message similar to the following:

Completed SharePlex for HANA database configuration

SharePlex User name: splex

Database name: ndb5

Target specification in SharePlex configuration: r.ndb5

Grant privileges to SharePlex

Before you start SharePlex replication to a HANA target, grant the following privileges to the SharePlex database user in that target (where SP_USER is the name of the SharePlex database user):

  • GRANT USER ADMIN TO sp_user;
  • GRANT TABLE ADMIN TO sp_user;
  • GRANT CATALOG READ TO sp_user;
  • GRANT DATA ADMIN TO sp_user WITH ADMIN OPTION;
  • GRANT ROLE ADMIN TO sp_user WITH ADMIN OPTION;

Additionally, log in as the owner of each schema that contains objects that you want to replicate, then make the following grants on the schema:

  • GRANT CREATE ANY ON SCHEMA schema_name TO sp_user;
  • GRANT DEBUG ON SCHEMA schema_name TO sp_user;
  • GRANT DELETE, DROP, EXECUTE, INDEX, INSERT, SELECT, UPDATE ON SCHEMA schema_name TO sp_user;

MySQL Setup (mysql_setup)

Overview

Run the Database Setup utility for MySQL (mysql_setup) on a MySQL system to establish SharePlex as a MySQL database user. This utility creates the following:

  • A SharePlex user account with full DBA privileges
  • Tables and indexes for use by SharePlex and owned by the SharePlex user in a database of your choosing
  • A default database connection.

Supported databases

MySQL on Linux. For supported Linux platforms and versions, see the SharePlex Release Notes.

Guidelines for use

  • Run the setup utility on all MySQL instances in the SharePlex replication configuration.
  • Within a cluster, run the setup utility on the node to which the shared disk that contains the SharePlex variable-data directory is mounted.
  • For consolidated replication, run the setup utility for each variable-data directory.

Required privileges

Review the following requirements to ensure that the setup succeeds.

  • The setup utility must be run as a MySQL Administrator that retains all of that user's default privileges. Both local and cloud MySQL Administrators should have the required privileges by default. The Administrator user is able to grant SharePlex the required privileges to operate on the database and to create the SharePlex database account and objects.
  • (Cloud installations) Common restrictions on privileges in cloud-hosted database services make it difficult for the setup utility to succeed in every possible type of scenario. To ensure that the database setup succeeds, only use the setup utility for the following purposes: To do a first-time database setup with a new SharePlex user, or, to modify an existing SharePlex user that either owns the database or has access to it.

Run Database Setup for MySQL

  1. Shut down any running SharePlex processes and sp_cop on the MySQL system.
  2. Run the mysql_setup program from the bin subdirectory of the SharePlex product directory.

    Important! If you installed the SharePlex instance on any port other than the default of 2100, use the -p option to specify the port number. For example, in the following command the port number is 9400.

    C:\users\splex\bin> mysql_setup -p9400

Table 4: Setup prompts and responses

Prompt Response

Enter the MySQL connection string [] :

Enter a connection string that connects to the MySQL database.

Do not use a DSN.

If you are replicating data larger than 500 MB to MySQL Aurora on Amazon RDS, include the MySQL parameter max_allowed_packet in the connection string and set its value to the maximum size of the data. See the example.

Example connection string

DRIVER=/usr/lib64/libmyodbc5.so;socket=/var/lib/mysql/mysql.sock;character-set-server=utf8;collation-server=utf8_general_ci;max_allowed_packet=2G;wait_timeout= 6000;Server=servername.amazonaws.com

Enter the MySQL Administrator name :

Enter the name of the MySQL Administrator. This user will perform the setup work on the SharePlex account and schema.

Enter the password for the Administrator account :

Enter the password of the Administrator.

Enter the replication target database name :

Enter the name of the MySQL database where you want to install the SharePlex objects.

Database name database does not exist. Would you like to create it? [y] :

If this prompt is displayed, the specified database does not exist. Press Enter to have the setup utility create it for you.

Would you like to create a new SharePlex user [y]:

Press Enter to accept the default to create a new SharePlex database user account, or enter n to use an existing account as the SharePlex database user.

Enter the name of the new SharePlex user:

Enter the name of the existing SharePlex user:

One of these prompts is displayed depending on whether you elected to create a new user or use an existing user. Enter the name of the SharePlex user.

 

Enter the password for the SharePlex user :

Enter the password of the SharePlex user account.

Re-enter the password for the SharePlex user :

Enter the SharePlex password again.

A successful setup terminates with a message similar to the following:

Completed SharePlex for MySQL database configuration

SharePlex User name: mysql29

Database name: mysql29

Target specification in SharePlex configuration: r.mysql29

Related Documents