Configure a self-managed Oracle database

  1. Verify that your database is running in ARCHIVELOG mode.
  2. To do so, sign in to your Oracle database and run the following command at the SQL prompt:

    SELECT LOG_MODE FROM V$DATABASE;

    1. If the result is ARCHIVELOG, then move on to step 2.
    2. If the result is NOARCHIVELOG, then you'll need to enable ARCHIVELOG mode for your database.
    3. Run the following commands when logged in as SYSDBA:
      SHUTDOWN IMMEDIATE;
      STARTUP MOUNT;
      ALTER DATABASE ARCHIVELOG;
      ALTER DATABASE OPEN;
    4. Archived log files consume disk space, so you'll want to configure the DB_RECOVERY_FILE_DEST_SIZE parameter for your database. Use this parameter to specify (in bytes) the hard limit on the total space to be used by target database recovery files. By setting this parameter, you can manage the tradeoff between protecting the database from running out of disk space and the stream failing because of log position loss.

  3. Define a data retention policy for your database by running these Oracle Recovery Manager (RMAN) commands:
    TARGET /
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 4 DAYS;
    

    We recommend that you retain backups and archive logs for a minimum of 4 days, and 7 days is recommended.

  4. Return to the SQL prompt of the database tool that you're using to configure the Oracle log file rotation policy. We recommend setting a maximum log file size of no more than 512MB.
  5. Enable supplemental log data. To do so, first enable minimal database-level supplemental logging by running the following command:
    ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

    Next, choose whether to turn on logging for specific tables or the entire database.

    To log changes only for specific tables, run the following command for each table that you want to replicate:

    ALTER TABLE SCHEMA.TABLE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS

    Replace the following:

    • SCHEMA: the name of the schema that contains the table.
    • TABLE: the name of the table for which you want to log changes.

    To replicate most or all tables in your database, consider turning logging on for the entire database.

    Run the following command to enable supplemental log data for the entire database:

    ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
  6. Grant the appropriate privileges to the user account that will be used to connect to your database. To do so, run the following commands:
    GRANT EXECUTE_CATALOG_ROLE TO USER_NAME;
    GRANT CONNECT TO USER_NAME;
    GRANT CREATE SESSION TO USERNAME;
    GRANT SELECT ON SYS.V$DATABASE TO USERNAME;
    GRANT SELECT ON SYS.V$ARCHIVED_LOG TO USERNAME;
    GRANT SELECT ON SYS.V$LOGMNR_CONTENTS TO USER_NAME;
    GRANT EXECUTE ON DBMS_LOGMNR TO USER_NAME;
    GRANT EXECUTE ON DBMS_LOGMNR_D TO USER_NAME;
    GRANT SELECT ANY TRANSACTION TO USER_NAME;
    GRANT SELECT ANY TABLE TO USER_NAME;
    

    If your organization doesn't permit granting the GRANT SELECT ANY TABLE permission, use the solution described in the Oracle change data capture (CDC) section of the Datastream FAQ page.

    If your source database is Oracle 12c or newer, then grant the following additional privilege:

    GRANT LOGMINING TO USER_NAME;