ORA-65040: operation not allowed from within a pluggable database
When running the switch logfile command in the PDB environment connected, you get the following error:
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
----------- ------------ ----------- -----------
3 PDB2 READ WRITE NO
SQL> alter system switch logfile;
alter system switch logfiel
*
ERROR at line 1:
ORA-65040: operation not allowed from within a pluggable database
Cause: Command runs from the PDB container database.
Solution: Redo log is handled by CDB database, so the command need to run from CDB ROOT. Connect the CDB root database and run the command.
SQL> alter session set container=cdb$root;
session altered.
SQL> show con_name
con_name
-------------------------
CDB$ROOT
SQL> alter system switch logfile;
system altered.