Eksample: you have a common user used for auditing, C##AUDITADMIN:
CREATE USER c##auditadmin IDENTIFIED BYYou log in with your user to the root container:CONTAINER=ALL; GRANT AUDIT_ADMIN TO c##auditadmin CONTAINER=ALL; GRANT SELECT ANY TABLE TO c##auditadmin CONTAINER=ALL; GRANT CREATE SESSION TO c##auditadmin CONTAINER=ALL;
sqlplus c##auditadmin@cdb Enter password: Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.16.0.0.0 C##AUDITADMIN@cdb SQL> alter session set container=pdb1; ERROR: ORA-01031: insufficient privilegesTo grant the required privilege, login as sysdba:
sqlplus / as sysdba Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.16.0.0.0Grant the SET CONTAINER privilege:
SYS@cdb SQL> grant set container to c##auditadmin container=all; Grant succeeded.Connect with C##AUDITADMIN again, and switch to the PDB1 container within your session:
sqlplus c##auditadmin@cdb Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.16.0.0.0 C##AUDITADMIN@cdb SQL> show con_name CON_NAME ------------------------------ CDB$ROOT C##AUDITADMIN@cdb SQL> alter session set container=pdb1; Session altered. C##AUDITADMIN@cdb SQL> show con_name CON_NAME ------------------------------ PDB1