Oracle Multitenant
Oracle has announced that, from 19c onward, you can have 3 user-defined PDBs, without having to license the multitenant option.
The non-CDB architecture will be desupported from Oracle 21c on.
Check
Current Container
SHOW CON_NAME
SELECT SYS_CONTEXT('USERENV','CON_NAME') AS CON_NAME FROM dual;
SHOW CON_ID
SELECT SYS_CONTEXT('USERENV','CON_ID') AS CON_ID FROM dual;
Services
Each pluggable database should automatically register a service with the listener...
lsnrctl service
CON_ID NAME OPEN_MODE RESTRICT OPEN_TIME------- ------------------------------ ---------- -------- ----------------------------------- 2 PDB$SEED READ ONLY NO 13-JAN-24 11.27.55.799 PM +00:00 3 MYDB_PDB1 READ WRITE NO 15-JAN-24 02.27.54.843 PM +00:00
Plug-In Violations
SELECT name,
cause,
type,
message,
status
FROM pdb_plug_in_violations
WHERE type = 'ERROR'
AND status !='RESOLVED';
PDB1 Sync Failure ERROR "Sync PDB failed with ORA-65177 during 'alter user "xxx" ...' " PENDING
- Delete a common user
- Having two set of local user ,one in CDB and other in PDB
- Create / duplicate a PDB
COLUMN name FORMAT A30
COLUMN sqlstmt FORMAT A100
SELECT ctime,
sqlstmt,
name,
flags,
opcode,
replay#
FROM pdb_sync$;
To fix...
ALTER SESSION SET CONTAINER=CDB$ROOT;CREATE TABLE bkppdb_sync$ AS SELECT * FROM pdb_sync$;DELETE FROM pdb_sync$ WHERE sqlstmt LIKE ('%alter user "xxx"%');COMMIT;ALTER SESSION SET CONTAINER=PDB;CREATE TABLE bkppdb_sync$ AS SELECT * FROM pdb_sync$;DELETE FROM pdb_sync$ WHERE sqlstmt LIKE ('%alter user "xxx"%');COMMIT;ALTER SESSION SET CONTAINER=CDB$ROOT;ALTER PLUGGABLE database PDB CLOSE IMMEDIATE;ALTER PLUGGABLE database PDB OPEN;Switching
When logged into the CDB you can switch between PDBs/CDB like this...
ALTER SESSION SET CONTAINER=mypdb;
ALTER SESSION SET CONTAINER=cdb$root;
sqlplus / as sysdba
If ORACLE_SID is set and you connect / as sysdba, you will connect to the CDB
If ORACLE_SID and ORACLE_PDB_SID is set and you connect / as sysdba you will connect to the PDB (owned by the CDB identified bu ORACLE_SID)
See Also
These pages also include Multi-Tenant specific content...
Bibliography & References
https://oracle-base.com/blog/2019/09/18/multitenant-massive-changes-in-19c-and-20c/
https://miroconsulting.com/blog/oracle-pluggable-databases-aka-multitenant/https://svenweller.wordpress.com/2020/07/02/7-secret-oracle-db-features-you-might-not-know/
https://mikedietrichde.com/2020/05/07/can-you-connect-as-sysdba-without-password-into-a-pdb-directly/https://mikedietrichde.com/2019/09/17/3-pdbs-included-with-oracle-19c-and-desupport-of-non-cdbs-with-20c/https://www.slideshare.net/JitendraSingh432/migration-to-oracle-multitenant
Plug-In Violationshttps://www.alex-sanz.com/2021/08/11/how-to-fix-pdb-in-restricted/https://support.oracle.com(1) OCI PDB ORA-01035: ORACLE only available to users with RESTRICTED SESSION due to Sync Failure ERROR "Sync PDB failed with ORA-65177 during 'alter user' in pdb_plug_in_violations (Doc ID 2503982.1)ORA-65177 Cloned PDB Sync Fails (Doc ID 2327177.1)