0

I use pre-built Oracle 12c r2

when I tried to sign up as sqlplus / as sysdba

I got a ORA-01017 which I solved with unset TWO_TASK

Since then, I can not sign in to the user I created Because I'm in the root container of the CDB

How to connect on PDB?

SQL> SELECT NAME, CON_ID, DBID, CON_UID, GUID FROM V$CONTAINERS ORDER BY CON_ID;
NAME
--------------------------------------------------------------------------------
 CON_ID DBID CON_UID GUID
---------- ---------- ---------- --------------------------------
CDB$ROOT
 1 776972821 1 4700A987085A3DFAE05387E5E50A8C7B
PDB$SEED
 2 1737080764 1737080764 51C985B6B6D35149E0530100007FC08B
ORCL
 3 4079644691 4079644691 51C99766D7E2568DE0530100007F4FAE
asked Nov 23, 2018 at 14:51
2
  • Use sqlplus username/password@ORCL. Commented Nov 23, 2018 at 18:34
  • Thanks, I tried it, but I made a mistake with the syntax :D Commented Nov 23, 2018 at 19:22

1 Answer 1

1

In the root container you can switch the current session to a specific PDB with

ALTER SESSION SET container=orcl;

If you want to actually connect to a specific container (because the user only exists in that container or you have an application which should not know about containers) then you have to connect to the actual net service for the specific PDB. You can use lsnrctl service or check the default tnsnames.ora. There is a good article about this.

This requires some preparation, so check out the Oracle documentation for the concepts as well, but in essence you would have to use a TNS alias or connection description specifying SERVICE_NAME=PDB1 (in your case probably orcl, although that’s a uncommon name for a PDB) instead of a SID or the CDB net service name.

answered Nov 24, 2018 at 20:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.