Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connecting to a PDB using ALTER SESSION SET CONTAINER

Steve_74Jun 3 2021

DB version: 12c till 19c
OS : Oracle Linux, RHEL 7.x
I am new to working in multitenant architecture.
As a DBA, when I want to do some admin tasks in a PDB, I connect to the root container as SYS first and then I issue the following command to 'connect' to the PDB.
alter session set container=pdb3;
I have done basic stuff like user management, adding datafile, etc after connecting to the PDB using the above mentioned ALTER SESSION SET CONTAINER method. It seems to be working fine. But, then again, I am new to working in a multi-tenant architecture.
Hence, I would like to know if there are any risks in following the above method, in any special circumstances.

Comments

Luís Gustavo Lira

Hi,
I don't see any problem with this approach of using "alter session" to execute commands in the PDB.
It's just always good to check if it's in the correct PDB, you can for example use a "show con_name" to make sure you are in the right place.

kuljeet singh -

as luis has already mention, check pdb before doing admin task, rest of your approach is fine

1 - 2

Post Details

Added on Jun 3 2021
2 comments
24,198 views