Oracle Database Prerequisites¶
Oracle 11g, 12c and 18c Deprecation
Oracle discontinued support for the following Oracle Database versions:
- Version 11g on December 31, 2022
- Version 12c on July 31, 2022
- Version 18c on June 30, 2021
Confluent currently supports Oracle Database versions 19c and later.
This page includes the prerequisite Oracle database configuration steps and post-configuration validation steps. Note that you must complete the following steps before the Oracle CDC Source connector can produce expected results:
- Configure database user privileges
- Turn on ARCHIVELOG mode
- Enable supplemental logging
- Grant the User Flashback Query Privileges
- Validate start-up configuration and prerequisite completion
Configure database user privileges¶
The connector requires a database user with role privileges to use LogMiner and to select from all tables captured by the connector. For this reason, you may need to create a new database user for the connector. Note the following:
- Create a local user for a non-container database. The username must not
start with
c##
orC##
. - Create a common user for a multitenant database. The username must start
with
c##
orC##
.
The following steps are for Oracle Database 19c.
To set up a new user with the correct database privileges, log in as SYSDBA
and enter the following commands to create a role for the user with the required
privileges. You can use any preferred name for the role. Note that CDC_PRIVS
is the role name used in the following steps:
As
SYSDBA
, enter the following SQL commands to create the role and grant privileges to the role.CREATE ROLE CDC_PRIVS; GRANT CREATE SESSION TO CDC_PRIVS; GRANT LOGMINING TO CDC_PRIVS; GRANT SELECT ON V_$DATABASE TO CDC_PRIVS; GRANT SELECT ON V_$INSTANCE to CDC_PRIVS; GRANT SELECT ON V_$THREAD TO CDC_PRIVS; GRANT SELECT ON V_$PARAMETER TO CDC_PRIVS; GRANT SELECT ON V_$NLS_PARAMETERS TO CDC_PRIVS; GRANT SELECT ON V_$TIMEZONE_NAMES TO CDC_PRIVS; GRANT SELECT ON <schema>.<table> TO CDC_PRIVS; GRANT SELECT ON V_$LOG TO CDC_PRIVS; GRANT SELECT ON V_$LOGFILE TO CDC_PRIVS; GRANT SELECT ON V_$LOGMNR_CONTENTS TO CDC_PRIVS; GRANT SELECT ON V_$ARCHIVED_LOG TO CDC_PRIVS; GRANT SELECT ON V_$ARCHIVE_DEST_STATUS TO CDC_PRIVS; GRANT EXECUTE ON SYS.DBMS_LOGMNR TO CDC_PRIVS; GRANT EXECUTE ON SYS.DBMS_LOGMNR_D TO CDC_PRIVS;
Create a username and password, and grant privileges for the user (you may use any username and password):
CREATE USER MYUSER IDENTIFIED BY password DEFAULT TABLESPACE USERS; ALTER USER MYUSER QUOTA UNLIMITED ON USERS; GRANT SELECT ON <schema>.<table> TO CDC_PRIVS; GRANT CDC_PRIVS to MYUSER;
The following steps are for Oracle Database 19c and 21c.
To set up a new user with the correct database privileges, log in as SYSDBA
and enter the following commands to create a role for the user with the required
privileges. You can use any preferred name for the role. Note that
C##CDC_PRIVS
is the role name used in the following example steps.
As
SYSDBA
, enter the following SQL commands to create the role and grant privileges to the role.CREATE ROLE C##CDC_PRIVS; GRANT CREATE SESSION TO C##CDC_PRIVS; GRANT LOGMINING TO C##CDC_PRIVS; GRANT SELECT ON V_$DATABASE TO C##CDC_PRIVS; GRANT SELECT ON V_$INSTANCE to C##CDC_PRIVS; GRANT SELECT ON V_$THREAD TO C##CDC_PRIVS; GRANT SELECT ON V_$PARAMETER TO C##CDC_PRIVS; GRANT SELECT ON V_$NLS_PARAMETERS TO C##CDC_PRIVS; GRANT SELECT ON V_$TIMEZONE_NAMES TO C##CDC_PRIVS; GRANT SELECT ON <schema>.<table> TO C##CDC_PRIVS; GRANT SELECT ON V_$LOG TO C##CDC_PRIVS; GRANT SELECT ON V_$LOGFILE TO C##CDC_PRIVS; GRANT SELECT ON V_$LOGMNR_CONTENTS TO C##CDC_PRIVS; GRANT SELECT ON V_$ARCHIVED_LOG TO C##CDC_PRIVS; GRANT SELECT ON V_$ARCHIVE_DEST_STATUS TO CDC_PRIVS; GRANT EXECUTE ON SYS.DBMS_LOGMNR TO C##CDC_PRIVS; GRANT EXECUTE ON SYS.DBMS_LOGMNR_D TO C##CDC_PRIVS;
Create a username, password, and grant privileges for the user. You can use any username and password.
CREATE USER C##MYUSER IDENTIFIED BY password DEFAULT TABLESPACE USERS; ALTER USER C##MYUSER QUOTA UNLIMITED ON USERS; GRANT SELECT ON <schema>.<table> TO C##CDC_PRIVS; GRANT C##CDC_PRIVS to C##MYUSER;
Important
When you configure the connector, use this user account for the JDBC credentials. Use the entire user name, including the
c##
, as the JDBC user name.`
The following steps are for Oracle Database 19c and 21c.
To set up a common user with the correct database privileges, log in as
SYSDBA
and enter the following SQL commands to create a role for the
user with the required privileges (you can use any preferred name for
the role):
Note that common user accounts are created in cdb$root
and must use the
convention: c##<name>
or C##<name>
. The user C##MYUSER
and the role
C##CDC_PRIVS
are used in the following example.
ALTER SESSION SET CONTAINER=CDB$ROOT;
CREATE ROLE C##CDC_PRIVS;
CREATE USER C##MYUSER IDENTIFIED BY password CONTAINER=ALL;
ALTER USER C##MYUSER QUOTA UNLIMITED ON USERS;
ALTER USER C##MYUSER SET CONTAINER_DATA = (CDB$ROOT, <pdb-name>) CONTAINER=CURRENT;
GRANT C##CDC_PRIVS to C##MYUSER CONTAINER=ALL;
GRANT CONNECT TO C##CDC_PRIVS CONTAINER=ALL;
GRANT CREATE SESSION TO C##CDC_PRIVS CONTAINER=ALL;
GRANT LOGMINING TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON V_$DATABASE TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON V_$INSTANCE to C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON V_$THREAD TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON V_$PARAMETER TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON V_$NLS_PARAMETERS TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON V_$TIMEZONE_NAMES TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON DBA_PDBS TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON CDB_TABLES TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON CDB_TAB_PARTITIONS TO C##CDC_PRIVS CONTAINER=ALL;
ALTER SESSION SET CONTAINER=<pdb-name>;
GRANT SELECT ON <schema>.<table> TO C##CDC_PRIVS;
ALTER SESSION SET CONTAINER=CDB$ROOT;
GRANT SELECT ON V_$LOG TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON V_$LOGFILE TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON V_$LOGMNR_CONTENTS TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON V_$ARCHIVED_LOG TO C##CDC_PRIVS CONTAINER=ALL;
GRANT SELECT ON V_$ARCHIVE_DEST_STATUS TO CDC_PRIVS CONTAINER=ALL;
GRANT EXECUTE ON SYS.DBMS_LOGMNR TO C##CDC_PRIVS CONTAINER=ALL;
GRANT EXECUTE ON SYS.DBMS_LOGMNR_D TO C##CDC_PRIVS CONTAINER=ALL;
-- Need this only if using Full Supplemental Logging for only a select few tables
-- GRANT SELECT ON DBA_SUPPLEMENTAL_LOGGING TO C##CDC_PRIVS CONTAINER=ALL;
Important
When you configure the connector, use this user account for the JDBC
credentials. Use the entire user name, including the c##
, as the JDBC
user name.
The following steps are for Oracle Database 19c.
Important
The Oracle CDC Source connector does not work with an Oracle read-only replica for Amazon RDS. The connector uses the Oracle-recommended Online Catalog, which requires the database to be open for write access. For related details, see Working with an Oracle read-only replica for Amazon RDS.
Amazon RDS doesn’t allow users to log in as SYSDBA
, so it is
impossible to create a role–first, you must create a user and then
grant the necessary privileges by completing the following steps:
Create a user by entering the following commands:
CREATE USER DB_USER IDENTIFIED BY PASSWORD DEFAULT TABLESPACE USERS; ALTER USER DB_USER QUOTA UNLIMITED ON USERS; GRANT CREATE SESSION TO DB_USER; GRANT SELECT ON DBA_TABLESPACES TO DB_USER; GRANT LOGMINING TO DB_USER; GRANT SELECT ON <schema>.<table> TO DB_USER;
Enter the following command to grant
SELECT
andEXECUTE
permissions on SYS objects using the Amazon RDS procedure:exec rdsadmin.rdsadmin_util.grant_sys_object('V_$DATABASE', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$INSTANCE', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$THREAD', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$PARAMETER', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$NLS_PARAMETERS', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$TIMEZONE_NAMES', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$TRANSACTION', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$LOG', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGFILE', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_LOGS', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_CONTENTS','DB_USER','SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$ARCHIVED_LOG', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('V_$ARCHIVE_DEST_STATUS', 'DB_USER', 'SELECT'); exec rdsadmin.rdsadmin_util.grant_sys_object('DBMS_LOGMNR', 'DB_USER', 'EXECUTE'); exec rdsadmin.rdsadmin_util.alter_supplemental_logging(p_action => 'ADD');
Turn on ARCHIVELOG mode¶
To extract a LogMiner dictionary to the redo log files, the database must be open and in ARCHIVELOG mode. Note that you shut down the database when completing the following steps:
Note that you can skip the following steps if ARCHIVELOG
mode is already
enabled for the database. ARCHIVELOG
mode is enabled by default for AWS RDS
Oracle instances.
Connect as a user with
SYSDBA
privileges. Check the databaseARCHIVELOG
mode. If theLOG_MODE
showsARCHIVELOG
, you can skip theTurn on ARCHIVELOG mode
section.SQL> SELECT LOG_MODE FROM V$DATABASE; LOG_MODE ------------ NOARCHIVELOG
Shut down the database instance using the command
SHUTDOWN IMMEDIATE
.SQL> SHUTDOWN IMMEDIATE;
Create a full database backup including all data and control files. You can use operating system commands or RMAN to perform this operation. This backup can be used in the future for recovery with archived redo log files created once the database is in
ARCHIVELOG
mode.Start the instance and mount the database using the command
STARTUP MOUNT
.SQL> STARTUP MOUNT;
Place the database in
ARCHIVELOG
mode using the commandALTER DATABASE ARCHIVELOG
and open the database using the commandALTER DATABASE OPEN
.SQL> ALTER DATABASE ARCHIVELOG; SQL> ALTER DATABASE OPEN;
Check the database
ARCHIVELOG
mode.SQL> SELECT LOG_MODE FROM V$DATABASE; LOG_MODE ------------ ARCHIVELOG
If you use Oracle Real Application Clusters (RAC), please follow the following
steps to enable ARCHIVELOG
.
SQL> SELECT LOG_MODE FROM V$DATABASE;
LOG_MODE
------------
NOARCHIVELOG
Stop the database service.
srvctl stop database -d <Service Name>
Start the database in mount state.
srvctl start database -d <Service Name> -o mount
Enable
ARCHIVELOG
mode.SQL> ALTER DATABASE ARCHIVELOG; Database altered.
Restart the database service (using SRVCTL)
srvctl stop database -d <Service Name> srvctl start database -d <Service Name>
Check the database
ARCHIVELOG
mode.SQL> SELECT LOG_MODE FROM V$DATABASE; LOG_MODE ------------ ARCHIVELOG
Enable supplemental logging¶
This section includes the commands to enable supplemental logging.
Non-container and multitenant databases¶
Enter the following commands to specify that when a row is updated, all columns of that row (except for LOBs, LONGS, and ADTs) are placed in the redo log file ( you must have correct privileges to execute the command):
Set the session container:
ALTER SESSION SET CONTAINER=cdb$root;
To enable full supplemental logging for all tables, enter the following commands:
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
Or, to enable full supplemental logging for specific tables, run the following commands:
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; ALTER SESSION SET CONTAINER=<pdb-name>; -- ONLY FOR PDB ALTER TABLE <schema name>.<table name> ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
To enable minimal supplemental logging (
PRIMARY KEY
) for specific tables, run the following commands:ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; ALTER SESSION SET CONTAINER=<pdb-name>; -- ONLY FOR PDB ALTER TABLE <schema name>.<table name> ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
Or, to enable minimal supplemental logging (
UNIQUE INDEX
) for specific tables, run the following commands:ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; ALTER SESSION SET CONTAINER=<pdb-name>; -- ONLY FOR PDB ALTER TABLE <schema name>.<table name> ADD SUPPLEMENTAL LOG GROUP <LogGroupName> (UniqueIndexColumn1[, UniqueIndexColumn2] ...) ALWAYS;
For more help with enabling minimal supplemental logging, see Minimal Supplemental Logging for Oracle CDC Source Connector for Confluent Platform.
Note
For a pluggable databases:
- Up to version 21c, enable minimal supplemental logging for the root container (CDB$ROOT). In version 23ai, enable minimal supplemental logging at either the CDB$ROOT or the specific PDB level.
- Finally, enable full supplemental logging either for the entire database or specifically for the tables of interest within the PDB (recommended).
Amazon RDS Oracle 19c instance¶
Important
The Oracle CDC Source connector does not work with an Oracle read-only replica for Amazon RDS. The connector uses the Oracle-recommended Online Catalog, which requires the database to be open for write access. For related details, see Working with an Oracle read-only replica for Amazon RDS.
Run the following
exec
command:exec rdsadmin.rdsadmin_util.set_configuration('archivelog retention hours',24);
To enable full supplemental logging for all tables, run this command:
exec rdsadmin.rdsadmin_util.alter_supplemental_logging('ADD','ALL');
Or, to enable full supplemental logging for individual tables, run these commands:
exec rdsadmin.rdsadmin_util.alter_supplemental_logging('ADD'); ALTER TABLE <table_name> ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
To enable minimal supplemental logging (PRIMARY KEY) for specific tables, run the following commands:
exec rdsadmin.rdsadmin_util.alter_supplemental_logging('ADD'); ALTER TABLE <schema name>.<table name> ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
Or, to enable minimal supplemental logging (UNIQUE INDEX) for specific tables, run the following commands:
exec rdsadmin.rdsadmin_util.alter_supplemental_logging('ADD'); ALTER TABLE <schema name>.<table name> ADD SUPPLEMENTAL LOG GROUP <LogGroupName> (UniqueIndexColumn1[, UniqueIndexColumn2] ...) ALWAYS;
Grant the User Flashback Query Privileges¶
To perform snapshots on captured tables, the connector requires the user to have
privileges to perform Flashback queries (that is, SELECT AS OF
) on the
captured tables. Enter the following command to grant the user privileges to
perform Flashback queries on the database:
GRANT FLASHBACK ANY TABLE TO myuser;
To enable FLASHBACK query for specific tables:
GRANT FLASHBACK ON <schema>.<table> TO myuser;
Note that this command is not required if you want to capture the redo log
(without generating change events) or generate change events starting from a
known System Change Number (SCN) or timestamp using start.from
.
For example, you enter the following commands to grant the example role created
previously FLASHBACK
privileges for a non-container database:
GRANT FLASHBACK ON <schema>.<table> TO CDC_PRIVS
For example, you enter the following commands to grant the example role created
above FLASHBACK
privileges for a container database or multitenant database:
ALTER SESSION SET CONTAINER=<pdb-name>;
GRANT FLASHBACK ON <schema>.<table> TO C##CDC_PRIVS
Amazon RDS for Oracle 19c instance¶
GRANT FLASHBACK ON <schema>.<table> TO DB_USER;
Validate start-up configuration and prerequisite completion¶
Use this section to ensure all prerequisites are met. You can perform an automate readiness check, or choose to validate readiness manually.
Automated readiness check¶
Download the oracle-readiness.sql
script to
ensure your database is ready to use the Oracle CDC connector. Be sure to run
the script with the user having the DBA role and a PDB name if you are working
with a multitenant database. For example:
SQLPlus > @oracle-readiness.sql C##MYUSER ORCLPDB1
If you’re not using PDB:
SQLPlus > @oracle-readiness.sql C##MYUSER ''
Note that the use of the oracle-readiness.sql
script is subject to the same
usage rights and terms as the use of the Oracle CDC connector.
Manual readiness check¶
If you’d like to verify all prerequisites manually, follow the steps in this section. The following sample values are used:
- Role name:
CDB_PRIVS
andC##CDC_PRIVS
- Usernames:
MYUSER
,C##MYUSER
andDB_USER
- Table name:
CUSTOMERS
. TheCUSTOMERS
table is created under one of the following schema:ANOTHERUSER
: for Non-container database 19cC##ANOTHERUSER
: for Container Database (CDB) and Multitenant Database (PDB) including 19c and 21cADMIN
: for Amazon RDS for Oracle
Note that numeric values used in the following subsections may be different from the values you see when you run through the validation example.
The following steps are for Oracle Database 19c.
Log in as
SYSDBA
and enter the following commands:-- Use the following SQL statement if privileges granted to a role (``CDC_PRIVS``) and the role granted to a user (``MYUSER``). SELECT GRANTEE, OWNER, TABLE_NAME FROM DBA_TAB_PRIVS WHERE GRANTEE IN (SELECT granted_role FROM DBA_ROLE_PRIVS WHERE GRANTEE = 'MYUSER') AND (TABLE_NAME='DBMS_LOGMNR' OR TABLE_NAME='V_$LOGMNR_CONTENTS'); GRANTEE OWNER TABLE_NAME ------------------------------------------- CDC_PRIVS SYS DBMS_LOGMNR CDC_PRIVS SYS V_$LOGMNR_CONTENTS -- Use the following SQL statement if privileges granted directly to a user (``MYUSER``). SELECT GRANTEE, OWNER, TABLE_NAME FROM DBA_TAB_PRIVS WHERE GRANTEE = 'MYUSER' AND (TABLE_NAME='DBMS_LOGMNR' OR TABLE_NAME='V_$LOGMNR_CONTENTS'); GRANTEE OWNER TABLE_NAME ------------------------------------------- MYUSER SYS DBMS_LOGMNR MYUSER SYS V_$LOGMNR_CONTENTS
Create
check_prerequisites.sql
with the following commands.SELECT * FROM SESSION_PRIVS; SELECT LOG_MODE FROM V$DATABASE; SELECT COUNT(*) FROM V$DATABASE; SELECT COUNT(*) FROM V$THREAD; SELECT COUNT(*) FROM V$PARAMETER; SELECT COUNT(*) FROM V$NLS_PARAMETERS; SELECT COUNT(*) FROM V$TIMEZONE_NAMES; SELECT COUNT(*) FROM ALL_INDEXES; SELECT COUNT(*) FROM ALL_OBJECTS; SELECT COUNT(*) FROM ALL_USERS; SELECT COUNT(*) FROM ALL_CATALOG; SELECT COUNT(*) FROM ALL_CONSTRAINTS; SELECT COUNT(*) FROM ALL_CONS_COLUMNS; SELECT COUNT(*) FROM ALL_TAB_COLS; SELECT COUNT(*) FROM ALL_IND_COLUMNS; SELECT COUNT(*) FROM ALL_ENCRYPTED_COLUMNS; SELECT COUNT(*) FROM ALL_LOG_GROUPS; SELECT COUNT(*) FROM ALL_TAB_PARTITIONS; SELECT COUNT(*) FROM ANOTHERUSER.CUSTOMERS; -- Flashback query privilege SELECT COUNT(*) FROM ANOTHERUSER.CUSTOMERS AS OF TIMESTAMP SYSDATE; -- Added for 19C SELECT count(*) FROM V$ARCHIVED_LOG; SELECT count(*) FROM V$LOG; SELECT count(*) FROM V$LOGFILE; SELECT count(*) FROM V$INSTANCE; SELECT SEQUENCE# FROM V$LOG WHERE STATUS = 'CURRENT';
Log in using
MYUSER
(created previously) and then enter the following:SQL> @check_prerequisites.sql PRIVILEGE ---------------------------------------- CREATE SESSION LOGMINING LOG_MODE ------------ ARCHIVELOG COUNT(*) ---------- 1 COUNT(*) ---------- 1 COUNT(*) ---------- 344 COUNT(*) ---------- 19 COUNT(*) ---------- 2164 COUNT(*) ---------- 88 COUNT(*) ---------- 7261 COUNT(*) ---------- 14 COUNT(*) ---------- 5656 COUNT(*) ---------- 197 COUNT(*) ---------- 266 COUNT(*) ---------- 20926 COUNT(*) ---------- 142 COUNT(*) ---------- 0 COUNT(*) ---------- 2 COUNT(*) ---------- 0 COUNT(*) ---------- 10 COUNT(*) ---------- 10 COUNT(*) ---------- 2 COUNT(*) ---------- 3 COUNT(*) ---------- 3 COUNT(*) ---------- 1 SEQUENCE# ---------- 20
Log in using
MYUSER
(created previously) and then enter the following commands:SELECT SUPPLEMENTAL_LOG_DATA_MIN, SUPPLEMENTAL_LOG_DATA_PK, SUPPLEMENTAL_LOG_DATA_ALL FROM V$DATABASE; -- If full supplemental logging is enabled for all tables, the following is returned. SUPPLEME SUP SUP -------- --- ---- YES NO YES -- If full supplemental logging is enabled for specific tables, the following is returned. SUPPLEME SUP SUP -------- --- ---- YES NO NO -- If full supplemental logging is enabled for specific tables, enter the following command. SELECT * FROM ALL_LOG_GROUPS WHERE LOG_GROUP_TYPE='ALL COLUMN LOGGING' and OWNER='ANOTHERUSER' and TABLE_NAME='CUSTOMERS'; OWNER LOG_GROUP_NAME TABLE_NAME LOG_GROUP_TYPE ALWAYS GENERATED -------------- ----------------------- -------------------- ----------------------- ----------------- ------------------------- ANOTHERUSER SYS_C007542 CUSTOMERS ALL COLUMN LOGGING ALWAYS GENERATED NAME
The following steps are for Oracle Database 19c and 21c.
Log in as
SYSDBA
and enter the following commands:-- Use the following SQL statement if privileges granted to a role (``C##CDC_PRIVS``) and the role granted to a user (``C##MYUSER``). SELECT GRANTEE, OWNER, TABLE_NAME FROM DBA_TAB_PRIVS WHERE GRANTEE IN (SELECT granted_role FROM DBA_ROLE_PRIVS WHERE GRANTEE = 'C##MYUSER') AND (TABLE_NAME='DBMS_LOGMNR' OR TABLE_NAME='V_$LOGMNR_CONTENTS'); GRANTEE OWNER TABLE_NAME ------------------------------------------- C##CDC_PRIVS SYS DBMS_LOGMNR C##CDC_PRIVS SYS V_$LOGMNR_CONTENTS -- Use the following SQL statement if privileges granted directly to a user (``C##MYUSER``). SELECT GRANTEE, OWNER, TABLE_NAME FROM DBA_TAB_PRIVS WHERE GRANTEE = 'C##MYUSER' AND (TABLE_NAME='DBMS_LOGMNR' OR TABLE_NAME='V_$LOGMNR_CONTENTS'); GRANTEE OWNER TABLE_NAME ------------------------------------------- C##MYUSER SYS DBMS_LOGMNR C##MYUSER SYS V_$LOGMNR_CONTENTS
Create
check_prerequisites.sql
with the following commands:SELECT * FROM SESSION_PRIVS; SELECT LOG_MODE FROM V$DATABASE; SELECT COUNT(*) FROM V$DATABASE; SELECT COUNT(*) FROM V$THREAD; SELECT COUNT(*) FROM V$PARAMETER; SELECT COUNT(*) FROM V$NLS_PARAMETERS; SELECT COUNT(*) FROM V$TIMEZONE_NAMES; SELECT COUNT(*) FROM ALL_INDEXES; SELECT COUNT(*) FROM ALL_OBJECTS; SELECT COUNT(*) FROM ALL_USERS; SELECT COUNT(*) FROM ALL_CATALOG; SELECT COUNT(*) FROM ALL_CONSTRAINTS; SELECT COUNT(*) FROM ALL_CONS_COLUMNS; SELECT COUNT(*) FROM ALL_TAB_COLS; SELECT COUNT(*) FROM ALL_IND_COLUMNS; SELECT COUNT(*) FROM ALL_ENCRYPTED_COLUMNS; SELECT COUNT(*) FROM ALL_LOG_GROUPS; SELECT COUNT(*) FROM ALL_TAB_PARTITIONS; SELECT COUNT(*) FROM C##ANOTHERUSER.CUSTOMERS; -- Flashback query privilege SELECT COUNT(*) FROM C##ANOTHERUSER.CUSTOMERS AS OF TIMESTAMP SYSDATE; -- Added for 19c and 21c SELECT count(*) FROM V$ARCHIVED_LOG; SELECT count(*) FROM V$LOG; SELECT count(*) FROM V$LOGFILE; SELECT count(*) FROM V$INSTANCE; SELECT SEQUENCE# FROM V$LOG WHERE STATUS = 'CURRENT';
Log in using
C##MYUSER
(created previously) and then enter the following:SQL> @check_prerequisites.sql PRIVILEGE ---------------------------------------- CREATE SESSION LOGMINING LOG_MODE ------------ ARCHIVELOG COUNT(*) ---------- 1 COUNT(*) ---------- 1 COUNT(*) ---------- 344 COUNT(*) ---------- 19 COUNT(*) ---------- 2164 COUNT(*) ---------- 88 COUNT(*) ---------- 7261 COUNT(*) ---------- 14 COUNT(*) ---------- 5656 COUNT(*) ---------- 197 COUNT(*) ---------- 266 COUNT(*) ---------- 20926 COUNT(*) ---------- 142 COUNT(*) ---------- 0 COUNT(*) ---------- 2 COUNT(*) ---------- 0 COUNT(*) ---------- 10 COUNT(*) ---------- 10 COUNT(*) ---------- 2 COUNT(*) ---------- 3 COUNT(*) ---------- 3 COUNT(*) ---------- 1 SEQUENCE# ---------- 20
Log in using
C##MYUSER
(created previously) and then enter the following commands:SELECT SUPPLEMENTAL_LOG_DATA_MIN, SUPPLEMENTAL_LOG_DATA_PK, SUPPLEMENTAL_LOG_DATA_ALL FROM V$DATABASE; -- If full supplemental logging is enabled for all tables, the following is returned. SUPPLEME SUP SUP -------- --- ---- YES NO YES -- If full supplemental logging is enabled for specific tables, the following is returned. SUPPLEME SUP SUP -------- --- ---- YES NO NO -- If full supplemental logging is enabled for specific tables, enter the following command. SELECT * FROM ALL_LOG_GROUPS WHERE LOG_GROUP_TYPE='ALL COLUMN LOGGING' and OWNER='C##ANOTHERUSER' and TABLE_NAME='CUSTOMERS'; OWNER LOG_GROUP_NAME TABLE_NAME LOG_GROUP_TYPE ALWAYS GENERATED -------------- ----------------------- -------------------- ----------------------- ----------------- ------------------------- C##ANOTHERUSER SYS_C007542 CUSTOMERS ALL COLUMN LOGGING ALWAYS GENERATED NAME
Create
check_prerequisites.sql
with the following commands:SELECT * FROM SESSION_PRIVS; SELECT LOG_MODE FROM V$DATABASE; SELECT COUNT(*) FROM V$DATABASE; SELECT COUNT(*) FROM V$THREAD; SELECT COUNT(*) FROM V$PARAMETER; SELECT COUNT(*) FROM V$NLS_PARAMETERS; SELECT COUNT(*) FROM V$TIMEZONE_NAMES; SELECT COUNT(*) FROM ALL_INDEXES; SELECT COUNT(*) FROM ALL_OBJECTS; SELECT COUNT(*) FROM ALL_USERS; SELECT COUNT(*) FROM ALL_CATALOG; SELECT COUNT(*) FROM ALL_CONSTRAINTS; SELECT COUNT(*) FROM ALL_CONS_COLUMNS; SELECT COUNT(*) FROM ALL_TAB_COLS; SELECT COUNT(*) FROM ALL_IND_COLUMNS; SELECT COUNT(*) FROM ALL_ENCRYPTED_COLUMNS; SELECT COUNT(*) FROM ALL_LOG_GROUPS; SELECT COUNT(*) FROM ALL_TAB_PARTITIONS; SELECT COUNT(*) FROM C##ANOTHERUSER.CUSTOMERS; -- Flashback query privilege SELECT COUNT(*) FROM C##ANOTHERUSER.CUSTOMERS AS OF TIMESTAMP SYSDATE;
Log in using
C##MYUSER
(created previously) and then enter the following:SQL> @check_prerequisites.sql PRIVILEGE ---------------------------------------- CREATE SESSION LOGMINING LOG_MODE ------------ ARCHIVELOG COUNT(*) ---------- 1 COUNT(*) ---------- 1 COUNT(*) ---------- 344 COUNT(*) ---------- 19 COUNT(*) ---------- 2164 COUNT(*) ---------- 88 COUNT(*) ---------- 7261 COUNT(*) ---------- 14 COUNT(*) ---------- 5656 COUNT(*) ---------- 197 COUNT(*) ---------- 266 COUNT(*) ---------- 20926 COUNT(*) ---------- 142 COUNT(*) ---------- 0 COUNT(*) ---------- 2 COUNT(*) ---------- 0 COUNT(*) ---------- 10 COUNT(*) ---------- 10
Log in using
C##MYUSER
(created previously) and then enter the following commands:SELECT SUPPLEMENTAL_LOG_DATA_MIN, SUPPLEMENTAL_LOG_DATA_PK, SUPPLEMENTAL_LOG_DATA_ALL FROM V$DATABASE; -- If full supplemental logging is enabled for all tables, the following is returned. SUPPLEME SUP SUP -------- --- ---- YES NO YES -- If full supplemental logging is enabled for specific tables, the following is returned. SUPPLEME SUP SUP -------- --- ---- YES NO NO -- If full supplemental logging is enabled for specific tables, enter the following command. SELECT * FROM ALL_LOG_GROUPS WHERE LOG_GROUP_TYPE='ALL COLUMN LOGGING' and OWNER='C##ANOTHERUSER' and TABLE_NAME='CUSTOMERS'; OWNER LOG_GROUP_NAME TABLE_NAME LOG_GROUP_TYPE ALWAYS GENERATED -------------- ----------------------- -------------------- ----------------------- ----------------- ------------------------- C##ANOTHERUSER SYS_C006989 CUSTOMERS ALL COLUMN LOGGING ALWAYS GENERATED NAME
The following steps are for Oracle Database 19c and 21c.
Log in as
SYSDBA
and enter the following commands:ALTER SESSION SET CONTAINER=CDB$ROOT; -- Use the following SQL statement if privileges granted to a role (``C##CDC_PRIVS``) and the role granted to a user (``C##MYUSER``). SELECT GRANTEE, OWNER, TABLE_NAME FROM DBA_TAB_PRIVS WHERE GRANTEE IN (SELECT granted_role FROM DBA_ROLE_PRIVS WHERE GRANTEE = 'C##MYUSER') AND (TABLE_NAME='DBMS_LOGMNR' OR TABLE_NAME='V_$LOGMNR_CONTENTS'); GRANTEE OWNER TABLE_NAME ------------------------------------------- C##CDC_PRIVS SYS DBMS_LOGMNR C##CDC_PRIVS SYS V_$LOGMNR_CONTENTS -- Use the following SQL statement if privileges granted directly to a user (``C##MYUSER``). SELECT GRANTEE, OWNER, TABLE_NAME FROM DBA_TAB_PRIVS WHERE GRANTEE = 'C##MYUSER' AND (TABLE_NAME='DBMS_LOGMNR' OR TABLE_NAME='V_$LOGMNR_CONTENTS'); GRANTEE OWNER TABLE_NAME ------------------------------------------- C##MYUSER SYS DBMS_LOGMNR C##MYUSER SYS V_$LOGMNR_CONTENTS
Create
check_prerequisites.sql
with the following commands.ALTER SESSION SET CONTAINER=CDB$ROOT; SELECT * FROM SESSION_PRIVS; SELECT LOG_MODE FROM V$DATABASE; SELECT COUNT(*) FROM V$DATABASE; SELECT COUNT(*) FROM V$THREAD; SELECT COUNT(*) FROM V$PARAMETER; SELECT COUNT(*) FROM V$NLS_PARAMETERS; SELECT COUNT(*) FROM V$TIMEZONE_NAMES; SELECT COUNT(*) FROM ALL_INDEXES; SELECT COUNT(*) FROM ALL_OBJECTS; SELECT COUNT(*) FROM ALL_USERS; SELECT COUNT(*) FROM ALL_CATALOG; SELECT COUNT(*) FROM ALL_CONSTRAINTS; SELECT COUNT(*) FROM ALL_CONS_COLUMNS; SELECT COUNT(*) FROM ALL_TAB_COLS; SELECT COUNT(*) FROM ALL_IND_COLUMNS; SELECT COUNT(*) FROM ALL_ENCRYPTED_COLUMNS; SELECT COUNT(*) FROM ALL_LOG_GROUPS; SELECT COUNT(*) FROM ALL_TAB_PARTITIONS; SELECT COUNT(*) FROM DBA_PDBS; SELECT COUNT(*) FROM CDB_TABLES; SELECT COUNT(*) FROM CDB_TAB_PARTITIONS; ALTER SESSION SET CONTAINER=<pdb-name>; SELECT COUNT(*) FROM C##ANOTHERUSER.CUSTOMERS; -- Flashback query privilege SELECT COUNT(*) FROM C##ANOTHERUSER.CUSTOMERS AS OF TIMESTAMP SYSDATE; -- Added for 19c and 21c SELECT count(*) FROM V$ARCHIVED_LOG; SELECT count(*) FROM V$LOG; SELECT count(*) FROM V$LOGFILE; SELECT count(*) FROM V$INSTANCE; SELECT SEQUENCE# FROM V$LOG WHERE STATUS = 'CURRENT'; -- Uncomment this if Using Full Supplemental Logging on Specific Tables. -- SELECT count(*) FROM DBA_SUPPLEMENTAL_LOGGING;
Log in using
C##MYUSER
(created previously) and then enter the following:SQL> @check_prerequisites.sql SQL> @check_prerequisites.sql Session altered. PRIVILEGE ---------------------------------------- CREATE SESSION LOGMINING SET CONTAINER LOG_MODE ------------ ARCHIVELOG COUNT(*) ---------- 1 COUNT(*) ---------- 1 COUNT(*) ---------- 344 COUNT(*) ---------- 19 COUNT(*) ---------- 2164 COUNT(*) ---------- 88 COUNT(*) ---------- 7261 COUNT(*) ---------- 14 COUNT(*) ---------- 5656 COUNT(*) ---------- 197 COUNT(*) ---------- 266 COUNT(*) ---------- 20926 COUNT(*) ---------- 142 COUNT(*) ---------- 0 COUNT(*) ---------- 2 COUNT(*) ---------- 0 COUNT(*) ---------- 1 COUNT(*) ---------- 4213 COUNT(*) ---------- 14390 Session altered. COUNT(*) ---------- 15 COUNT(*) ---------- 15 COUNT(*) ---------- 0 COUNT(*) ---------- 3 COUNT(*) ---------- 3 COUNT(*) ---------- 1 SEQUENCE# ---------- 20
Log in using
C##MYUSER
(created previously) and then enter the following commands:SELECT SUPPLEMENTAL_LOG_DATA_MIN, SUPPLEMENTAL_LOG_DATA_PK, SUPPLEMENTAL_LOG_DATA_ALL FROM V$DATABASE; -- If full supplemental logging is enabled for all tables, the following is returned. SUPPLEME SUP SUP -------- --- ---- YES NO YES -- If full supplemental logging is enabled for specific tables, the following is returned. SUPPLEME SUP SUP -------- --- ---- YES NO NO -- If full supplemental logging is enabled for specific tables, enter the following command. ALTER SESSION SET CONTAINER=ORCLPDB1; SELECT * FROM ALL_LOG_GROUPS WHERE LOG_GROUP_TYPE='ALL COLUMN LOGGING' and OWNER='C##ANOTHERUSER' and TABLE_NAME='CUSTOMERS'; OWNER LOG_GROUP_NAME TABLE_NAME LOG_GROUP_TYPE ALWAYS GENERATED -------------- ----------------------- -------------------- ----------------------- ----------------- ------------------------- C##ANOTHERUSER SYS_C007542 CUSTOMERS ALL COLUMN LOGGING ALWAYS GENERATED NAME
The following are steps are for an Oracle 19c instance.
Log in as
ADMIN
and enter the following:-- Use the following SQL statement if privileges granted directly to a user (``DB_USER``). SELECT GRANTEE, OWNER, TABLE_NAME FROM DBA_TAB_PRIVS WHERE GRANTEE = 'DB_USER' AND (TABLE_NAME='DBMS_LOGMNR' OR TABLE_NAME='V_$LOGMNR_CONTENTS'); GRANTEE OWNER TABLE_NAME ------------------------------------------- DB_USER SYS DBMS_LOGMNR DB_USER SYS V_$LOGMNR_CONTENTS
Create
check_prerequisites.sql
with the following commands:SELECT COUNT(*) FROM DBA_TABLESPACES; SELECT * FROM SESSION_PRIVS; SELECT LOG_MODE FROM V$DATABASE; SELECT COUNT(*) FROM ALL_VIEWS; SELECT COUNT(*) FROM ALL_TAB_PARTITIONS; SELECT COUNT(*) FROM ALL_INDEXES; SELECT COUNT(*) FROM ALL_OBJECTS; SELECT COUNT(*) FROM ALL_TABLES; SELECT COUNT(*) FROM ALL_USERS; SELECT COUNT(*) FROM ALL_CATALOG; SELECT COUNT(*) FROM ALL_CONSTRAINTS; SELECT COUNT(*) FROM ALL_CONS_COLUMNS; SELECT COUNT(*) FROM ALL_TAB_COLS; SELECT COUNT(*) FROM ALL_IND_COLUMNS; SELECT COUNT(*) FROM ALL_LOG_GROUPS; SELECT COUNT(*) FROM V$ARCHIVED_LOG; SELECT COUNT(*) FROM V$LOG; SELECT COUNT(*) FROM V$LOGFILE; SELECT COUNT(*) FROM V$DATABASE; SELECT COUNT(*) FROM V$THREAD; SELECT COUNT(*) FROM V$PARAMETER; SELECT COUNT(*) FROM V$NLS_PARAMETERS; SELECT COUNT(*) FROM V$TIMEZONE_NAMES; SELECT COUNT(*) FROM V$TRANSACTION; SELECT COUNT(*) FROM ALL_ENCRYPTED_COLUMNS; SELECT COUNT(*) FROM V$LOGMNR_LOGS; SELECT COUNT(*) FROM ADMIN.CUSTOMERS; -- Flashback query privilege SELECT COUNT(*) FROM ADMIN.CUSTOMERS AS OF TIMESTAMP SYSDATE; SELECT count(*) FROM V$INSTANCE; SELECT SEQUENCE# FROM V$LOG WHERE STATUS = 'CURRENT';
Log in using
DB_USER
(created previously) and then enter the following:SQL> @check_prerequisites.sql COUNT(*) ---------- 6 PRIVILEGE ---------------------------------------- LOGMINING CREATE SESSION LOG_MODE ------------ ARCHIVELOG COUNT(*) ---------- 1765 COUNT(*) ---------- 0 COUNT(*) ---------- 57 COUNT(*) ---------- 9368 COUNT(*) ---------- 53 COUNT(*) ---------- 25 COUNT(*) ---------- 7700 COUNT(*) ---------- 80 COUNT(*) ---------- 73 COUNT(*) ---------- 22606 COUNT(*) ---------- 101 COUNT(*) ---------- 1 COUNT(*) ---------- 57 COUNT(*) ---------- 4 COUNT(*) ---------- 4 COUNT(*) ---------- 1 COUNT(*) ---------- 1 COUNT(*) ---------- 420 COUNT(*) ---------- 19 COUNT(*) ---------- 2408 COUNT(*) ---------- 0 COUNT(*) ---------- 4 COUNT(*) ---------- 0 COUNT(*) ---------- 8 COUNT(*) ---------- 8 COUNT(*) ---------- 1 SEQUENCE# ---------- 20
Log in using
DB_USER
(created previously) and then enter the following commands:SELECT SUPPLEMENTAL_LOG_DATA_MIN, SUPPLEMENTAL_LOG_DATA_PK, SUPPLEMENTAL_LOG_DATA_ALL FROM V$DATABASE; -- If full supplemental logging is enabled for all tables, the following is returned. SUPPLEME SUP SUP -------- --- ---- YES NO YES -- If full supplemental logging is enabled for specific tables, the following is returned. SUPPLEME SUP SUP -------- --- ---- YES NO NO -- If full supplemental logging is enabled for specific tables, enter the following command. SELECT * FROM ALL_LOG_GROUPS WHERE LOG_GROUP_TYPE='ALL COLUMN LOGGING' and OWNER='ADMIN' and TABLE_NAME='CUSTOMERS'; OWNER LOG_GROUP_NAME TABLE_NAME LOG_GROUP_TYPE ALWAYS GENERATED -------------- ----------------------- -------------------- ----------------------- ----------------- ------------------------- ADMIN SYS_C006989 CUSTOMERS ALL COLUMN LOGGING ALWAYS GENERATED NAME