Skip to content

Oracle users and privileges

What the Capture Agent user and the publishing user need on an Oracle source, and how a DBA sets them up in advance. For the overview, see Users and privileges.

Agent user

The wizard creates the agent user if it doesn't exist and grants it these privileges (for a CDB, in the root and in the PDB). If your security policy doesn't allow giving the wizard an administrator, the DBA can create the user in advance with the same statements; enter that user both as Userid on step 1 and as Agent User on step 2. Some of the wizard's own grants then fail, which doesn't stop it.

CREATE USER SQDR IDENTIFIED BY "password" DEFAULT TABLESPACE USERS ACCOUNT UNLOCK;
ALTER USER SQDR QUOTA 100M ON USERS;
GRANT CREATE SESSION TO SQDR;
GRANT CREATE TABLE TO SQDR;
GRANT CREATE PROCEDURE TO SQDR;
GRANT SELECT ANY TRANSACTION TO SQDR;
GRANT EXECUTE ON SYS.DBMS_LOGMNR TO SQDR;
GRANT SELECT ON V_$DATABASE TO SQDR;
GRANT SELECT ANY DICTIONARY TO SQDR;
GRANT SELECT_CATALOG_ROLE TO SQDR;
GRANT EXECUTE_CATALOG_ROLE TO SQDR;
GRANT ANALYZE ANY TO SQDR;
GRANT ANALYZE ANY DICTIONARY TO SQDR;
GRANT LOGMINING TO SQDR;      -- Oracle 12c and later

For a CDB, create a common user (CREATE USER C##SQDR ... CONTAINER=ALL), run the grants in the root and again in the PDB (ALTER SESSION SET CONTAINER = pdb_name;), and add GRANT SET CONTAINER TO C##SQDR; in both. So that the wizard can list the PDBs when C##SQDR is also the Userid, run this in the root:

ALTER USER C##SQDR SET CONTAINER_DATA = ALL FOR DBA_PDBS CONTAINER = CURRENT;

ANALYZE ANY and ANALYZE ANY DICTIONARY are optional: the wizard grants them, but the agent runs without them.

Grants that fail

When the Userid on step 1 isn't an administrator (for example the agent user you created in advance), the wizard's own grants fail, either because that user can't grant them or because the agent user already has them. The wizard continues, and logs each failure in the Jetty wrapper log (C:\ProgramData\StarQuest\sqdrplus\jetty\logs\wrapper.log; see Log files). If you created the agent user with the statements above, these failures are expected and harmless:

Statement Error
The quota, and the grants of SELECT ANY TRANSACTION, EXECUTE on SYS.DBMS_LOGMNR, CREATE TABLE, CREATE SESSION, ANALYZE ANY, ANALYZE ANY DICTIONARY, SELECT ANY DICTIONARY, CREATE PROCEDURE, LOGMINING and EXECUTE_CATALOG_ROLE ORA-01031: insufficient privileges
GRANT SELECT_CATALOG_ROLE ORA-01932: ADMIN option not granted for role 'SELECT_CATALOG_ROLE'
GRANT SELECT ON V_$DATABASE ORA-00942: table or view does not exist

Create the control tables in advance

The agent creates its control tables and stored procedures in its control schema the first time it starts, which is why the agent user needs CREATE TABLE and CREATE PROCEDURE. If your security policy doesn't allow that either, the DBA can create them in advance with the Oracle preparation scripts that Stelo Capture installs, in C:\Program Files\StarQuest\sqdrplus\Tools\Oracle_Scripts\SQDRPlusOracleScripts.zip. The zip file has a nonPDB folder and a PDB folder (for a CDB, where the agent user and the publishing user are common users); the comments at the start of each script say what to edit, usually the user names and passwords.

  1. In SQL*Plus, sign in as SYS AS SYSDBA and run the scripts in this order, checking the output of each for errors before you run the next:

    SQL> @CreateUser
    SQL> @CreateTables
    SQL> @CreateProcs
    SQL> @CreatePub
    

    CreateUser creates the agent user (on Amazon RDS for Oracle, make the change its comments describe), CreateTables and CreateProcs the control tables and procedures, and CreatePub a publishing user. Without CreateTables and CreateProcs, grant the agent user CREATE TABLE and CREATE PROCEDURE instead. 2. Optionally, as the owner of the tables, run CreateTableGrants. It generates a script, TableGrants, that adds supplemental logging to every table of the owner's schema and grants the publishing user access to them. Check it before you run it: you may not want every table of the schema. 3. Add the agent with the wizard, entering the agent user both as Userid on step 1 and as Agent User on step 2.

The scripts match the Stelo Capture version they came with. A later version may add or change control tables or procedures: an agent user with CREATE TABLE and CREATE PROCEDURE makes these changes itself, but with tables and procedures created by the scripts, the DBA makes them, with Stelo Support. The zip file also has scripts that drop what the others created; run them in the reverse order.

Publishing user

Publishing a table adds supplemental logging to it and grants the agent user SELECT on it (see Publish the tables). The SQDR Control Center asks for a privileged user to do this the first time you publish, and keeps it until you sign out. Use SYSTEM, or create a publishing user, for example SQDRPUB (C##SQDRPUB as a common user for a CDB, with these rights in the PDB). As SYS AS SYSDBA, once the agent has started (so that its SQ_CATALOG control table exists), replace password and SQDR (the control schema):

CREATE USER SQDRPUB IDENTIFIED BY "password" DEFAULT TABLESPACE USERS ACCOUNT UNLOCK;
ALTER USER SQDRPUB QUOTA 100M ON USERS;
GRANT CREATE SESSION TO SQDRPUB;
GRANT ALL ON SQDR.SQ_CATALOG TO SQDRPUB;

Then, as the tables' owner or a privileged user, either grant the publishing user all rights on each table to replicate, and publishing adds the supplemental logging:

GRANT ALL ON MYSCHEMA.MYTABLE TO SQDRPUB WITH GRANT OPTION;

or grant only SELECT and add the supplemental logging yourself:

GRANT SELECT ON MYSCHEMA.MYTABLE TO SQDRPUB WITH GRANT OPTION;
ALTER TABLE MYSCHEMA.MYTABLE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;

To generate these statements for every table of a schema, run the statements this query returns:

SELECT 'GRANT SELECT ON "' || OWNER || '"."' || TABLE_NAME || '" TO SQDRPUB WITH GRANT OPTION; '
    || 'ALTER TABLE "' || OWNER || '"."' || TABLE_NAME || '" ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;'
  FROM DBA_TABLES
 WHERE OWNER = 'MYSCHEMA';

To log only the key columns instead of all columns, see the agent's supplementalLogging property (supplementalLogging).