Skip to content

More about preparing an Oracle destination

Privileges

Why the user in Create the user needs each privilege:

Privilege Why it's needed
CREATE SESSION To connect.
CREATE TABLE To create the destination tables in the user's schema, the global temporary merge tables of Merge groups, and the work tables of ADD Copy. A table's owner may also alter, index, empty and drop it, and insert, update and delete its rows, so nothing else is needed for tables in the user's own schema.
Quota on the default tablespace For the rows and indexes of the tables. A global temporary table's rows are kept in the temporary tablespace and need no quota.

Test the privileges

The privileges are first used when a subscription runs. When you create subscriptions, you can test them first with a snapshot subscription of a small table, which needs CREATE TABLE (or the existing table), the emptying statement and INSERT. Its replication events show each step and any Oracle error (ORA-01031: insufficient privileges names a missing privilege, ORA-01950 a missing quota).

Tables in another schema

For destination tables in a schema another user owns (for example APPDATA), the Replicator Service needs system privileges that act on other schemas. They apply to every schema in the database except SYS, which is why a user that owns its schema is simpler. Grant them in addition to the ones above:

GRANT CREATE ANY TABLE, ALTER ANY TABLE, DROP ANY TABLE,
      CREATE ANY INDEX, ALTER ANY INDEX, DROP ANY INDEX,
      SELECT ANY TABLE, INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY TABLE
  TO sqdruser;

ALTER USER appdata QUOTA UNLIMITED ON users;
Privilege Why it's needed
CREATE ANY TABLE CREATE TABLE in the other schema.
DROP ANY TABLE DROP TABLE, and TRUNCATE TABLE, which Oracle allows on another user's table only with this privilege. With Delete existing data before replication, DELETE is used instead.
ALTER ANY TABLE ALTER TABLE for primary keys, foreign keys and ALTER processing.
CREATE ANY INDEX, DROP ANY INDEX The index on the replication key and the replicated indexes.
ALTER ANY INDEX Only with Allow disable/enable indexes: ALTER INDEX ... UNUSABLE and REBUILD.
SELECT ANY TABLE, INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY TABLE Loading and applying changes. Oracle also requires the SELECT privilege for an UPDATE or DELETE whose WHERE clause reads the table's columns, and for MERGE.
Quota for the schema's owner (APPDATA) The tables belong to APPDATA, so their space counts against its quota, not sqdruser's.

CREATE TABLE is still needed: the merge tables of Merge groups are always created in sqdruser's own schema.

Tables you create yourself. If every subscription uses Use existing table for baseline, the Replicator Service never creates, alters, drops or indexes the tables. Object privileges on each table are then enough for Batch and Sequence, plus CREATE TABLE for Merge:

GRANT SELECT, INSERT, UPDATE, DELETE ON appdata.orders TO sqdruser;

Use Delete existing data before replication for their baselines, or grant DROP ANY TABLE so that TRUNCATE TABLE works. Create the index on the replication key yourself (see The key at the destination).

Character set and length semantics

The Replicator Service moves character data as Unicode and declares character lengths in characters by default (VARCHAR2(n CHAR); see setOracleSemantics), so a value fits whatever its size in bytes. The characters must also exist in the database's character set: VARCHAR2, CHAR and CLOB columns use the database character set, and NVARCHAR2, NCHAR and NCLOB the national character set. Check them:

SELECT parameter, value
  FROM nls_database_parameters
 WHERE parameter IN ('NLS_CHARACTERSET', 'NLS_NCHAR_CHARACTERSET', 'NLS_LENGTH_SEMANTICS');

If the source holds characters the database character set lacks (for example a WE8MSWIN1252 database and Asian text at the source), use a Unicode database character set (AL32UTF8), or create the character columns as national types with Promote CHAR types to wide-CHAR equivalent types (see Options that change the mapping).