In Oracle 19c / 23ai, it is possible to use OS authentication to login directly to your PDB. Similar to ORACLE_SID variable to login to root container, ORACLE_PDB_SID is used to set the target PDB name for OS authentication. (See below)
[oracle@localhost ~]$ echo $ORACLE_HOME
/opt/oracle/product/26ai/dbhomeFree
[oracle@localhost ~]$ echo $ORACLE_SID
FREE
[oracle@localhost ~]$ echo $ORACLE_PDB_SID
FREEPDB1
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 23.26.0.0.0 - Production on Thu Dec 4 15:54:59 2025
Version 23.26.0.0.0
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Connected to:
Oracle AI Database 26ai Free Release 23.26.0.0.0 - Develop, Learn, and Run for Free
Version 23.26.0.0.0
SQL> show user
USER is "SYS"
SQL> show con_name
CON_NAME
------------------------------
FREEPDB1
SQL>
This method uses both ORACLE_SID and ORALE_PDB_SID variable to make a connection directly to the PDB. So, make sure that both the variables are set correctly. Oracle uses ORACLE_SID variable to connect to the correct CDB with OS authentication and then using an internal system level trigger, ‘ALTER SESSION SET CONTAINER’ command is executed to connect to the specific PDB as defined by the OS variable ORACLE_PDB_SID.
Watch the below video for a detailed tutorial & demo on this topic.
=======================================================================
** Email to info@shreyantech.com to get the Tip of the Day in your mailbox.
** Connect with the author / trainer: https://suchitdba.blogspot.com/p/connect-with-author-database-trainer.html
No comments:
Post a Comment