Skip to content
Home » Oracle » How to Resolve ORA-31541: Supplemental logging is not enabled in CDB$ROOT.

How to Resolve ORA-31541: Supplemental logging is not enabled in CDB$ROOT.

ORA-31541

Tried to enable flashback transaction query starting from adding minimal supplemental logs, but it failed with ORA-31541.

SQL> alter database add supplemental log data;
alter database add supplemental log data
*
ERROR at line 1:
ORA-31541: Supplemental logging is not enabled in CDB$ROOT.

ORA-31541 means that adding supplemental log cannot be done in a pluggable database (PDB) before enabling minimal one in the root container (CDB). In fact, you don't have to add the minimal supplemental log at PDB level, you should do it at CDB level.

Solution

To ORA-31541, we should switch to the root container.

SQL> show user
USER is "SYS"
SQL> alter session set container=CDB$ROOT;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

Then we add the minimal supplemental log to the CDB.

SQL> alter database add supplemental log data;

Database altered.

Since the minimal supplemental log has been enabled in CDB, we can safely enable 2 additional supplemental logs in PDB.

SQL> alter session set container=orclpdb1;

Session altered.

SQL> alter database add supplemental log data (primary key) columns;

Database altered.

SQL> alter database add supplemental log data (foreign key) columns;

Database altered.

We solved the problem.

Leave a Reply

Your email address will not be published. Required fields are marked *