How does one connect to a schema within a PDB (other than schema SYS)?
-
01-03-2021 - |
Pregunta
Using Oracle 18c on RedHat Linux 8
Connecting to CDB as 'SYS', I cannot figure out how to connect to a schema within the PDB other than as 'SYS'. Maybe I don't understand the CDB/PDB architecture well enough.
Here is what I have tried after logging into the Oracle 18c CDB as 'SYS' (using sqlplus sys as sysdba
):
ALTER SESSION SET CONTAINER= PDB;
conn myschema/mypasswd
and I also tried (right from the CDB)
conn myschema/mypasswd@PDB;
Both approaches fail to get me connected to the schema myschema
in the PDB. That is, I am still 'SYS' in the PDB.
Are there any suggestions/explanations on how to resolve this?
Do I have to setup some kind of access from the CDB-to-PDB for the schema myschema
?
Solución
Turns out there was a typo error in the tnsnames.ora
file - the HOST
ip address field was invalid for the system in question.
Example below (values have been anonymized for security reasons)
PDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.1.11)(PORT = 1555))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PDB)
)
)
The file was probably copied from another server (as a template) and the HOST
ip never updated.
Given the above, the correct way to connect would be:
conn myschema/mypasswd@PDB;