Monday, April 23, 2018

Oracle GoldenGate replicat abends with ORA-01031 when trying to replicate a CREATE MATERIALIZED VIEW DDL statement


After enabling DDL replication, GoldenGate replicat abends with:

Oracle GoldenGate Delivery for Oracle, <replicat>.prm: Fatal error executing DDL replication: error [Error code [1031], ORA-01031: insufficient privileges SQL create materialized view "<USER>"."<MVNAME>" enable query rewrite as ...

This happens, although I have given the ggadmin replicat user all the required privileges to create the materialized view (CREATE ANY MATERIALIZED VIEW, SELECT ANY TABLE, GLOBAL QUERY REWRITE). Even dba is not sufficient for the replicat user to be able to create the MV on another schema.

Reason is, that the schema owning the table (SCOTT in my case) does not have the "CREATE TABLE" priviledge directly, but only through the RESOURCE role.

After granting CREATE TABLE to the owner of the table, the GoldenGate replicat user can now create the materialized view.