Toad World® Forums

How switch from CDB to different PDB's?

Hallo,

isn't there a way to only connect to the CDB, and from there switch to the pdb's from this cdb?

Didn't find the function. Thanks, Greeting Michael

PDBs are a right PITB. (Same as 'PITA' but more polite!)

If you are logged into the container (CDB) and need to use a pluggable
(PDB) then:

alter session set container = pdb_name;

You are now in the DB and every command you enter will either work or
barf with the error "not allowed in a pluggable database". There is a
way around that, but it involves altering the session to set an
underscore parameter, the sqls will then work fine in the PDB. I got the
command from Oracle Support but I'm not allowed to give it out. :frowning:

The next problem you will have is that any SELECTs that include a "data
type WITH TIMEZONE" will barf with an "ORA-03115 unsupported network
datatype or representation". That's not quite true, the error is caused
by a mismatch between the version of time zone data in the CDB and that
in the PDB.

How is this possible I hear you think?

When you create the CDB, you use the time zone data from $ORACLE_HOME.
Currently this is version 31.

When you create the pluggable databases, they are created from a seed
database which is running the version current when the seed was created

  • in my case, version 18.

Document 1509653.1 shows how this can be fixed.

Good luck!

Thanks, but what i search, is a pulldown like in CloudControl to change from the CDB to the different PDB's inside.
Especially want to use the Schema Browser in the pdb, and don't connect in every pdb manually.

What we have done at work is to create two tns alias names, one for the
CDB and one for the PDB, then login directly. That way you avoid the
problems I mentioned in my previous reply.

HTH

This is really the best technique. In addition to the problems Norm mentioned about certain things not working after "alter session set container", depending on how Toad is configured, Toad may create more than one session to your database in order to do some background processing. Background sessions, plus "alter session set container" would make it easy to accidentally have the main session in one container and the background sessions in another.

Sorry folks, there's too many '1's in that document id, it should be
Document 1509653.1.

1 Like

I edited the doc number in your first post.