본문 바로가기

Database/Oracle

46 - [Oracle 19C] Connecting to the new PDB

 

 

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT


SQL> col name format a20
SQL> select name, open_mode from v$pdbs;

NAME		     OPEN_MODE
-------------------- ----------
PDB$SEED	     READ ONLY
ORCLPDB 	     READ WRITE
PDB1		     READ WRITE


SQL> show pdbs

    CON_ID CON_NAME			  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
	 2 PDB$SEED			  READ ONLY  NO
	 3 ORCLPDB			  READ WRITE NO
	 4 PDB1 			  READ WRITE NO


SQL> alter session set container=pdb1;

Session altered.


SQL> show con_name

CON_NAME
------------------------------
PDB1


SQL>

 

 

 

SQL> select name from v$services;

NAME
--------------------
pdb1


SQL> show parameter domain

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
db_domain			     string	 com
SQL>

 

 

 

  • connecting to the new PDB
SQL> conn pdb1admin/welcome@test.com:1521/pdb1.com
Connected.


SQL> show con_name

CON_NAME
------------------------------
PDB1


SQL> conn pdb1admin/welcome@test.com/pdb1.com
Connected.

 

 

 

  • tnsnames.ora on the server

 

 

SQL> conn pdb1admin/welcome@pdb1
Connected.
SQL> show con_name

CON_NAME
------------------------------
PDB1

 

 

 

  • sqlDeveloper on the client

 

  • tnsnames.ora on the client
add new information on the tnsnames.ora

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle88)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.com)
    )
  )


ORCLPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle88)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orclpdb.com)
    )
  )

PDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle88)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pdb1.com)
    )
  )