How to connect to PDB without alter session in oracle 19c??

How to connect to PDB without alter session??

To connect to PDB  we have been using two options:

1. login to cdb , then alter session

2. sqlplus .. userid/pwd@pdbname

now in Oracle 19c .. there is a new option..

we can set a env variable and connect directly as below:

export ORACLE_PDB_SID=mypdb

then we can login with sqlplus sys / as sysdba .. we will will be directly into the pdb ..


[oracle@mydb ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat May 30 02:53:46 2020
Version 19.4.0.0.0
Copyright (c) 1982, 2019, Oracle.  All rights reserved.
Connected to:
Oracle Database 19c EE High Perf Release 19.0.0.0.0 - Production
Version 19.4.0.0.0
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 MYPDB                          READ WRITE NO
SQL> exit
Disconnected from Oracle Database 19c EE High Perf Release 19.0.0.0.0 - Production
Version 19.4.0.0.0

[oracle@mydb ~]$ export ORACLE_PDB_SID=MYPDB
[oracle@mydb ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat May 30 02:54:13 2020
Version 19.4.0.0.0
Copyright (c) 1982, 2019, Oracle.  All rights reserved.
Connected to:
Oracle Database 19c EE High Perf Release 19.0.0.0.0 - Production
Version 19.4.0.0.0
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         3 MYPDB                            READ WRITE NO

Comments

Popular posts from this blog

Oracle Cloud Infrastructure(OCI) - Part2

Script to display the SQL text for a specific SQL_ID

How to Change Your EnterpriseOne Environment Color