본문 바로가기

Database/Oracle Database

오라클 멀티테넌트 데이터베이스에서 PDB용 로컬 리스너 생성 방법

다음과 같은 순서로 진행하시면 됩니다.

 

[oracle@onprem ~]$ lsnrctl stop
...

[oracle@onprem ~]$ sqlplus "/as sysdba"
...
SQL> alter session set container=orclpdb1;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
ORCLPDB1

SQL> alter system set local_listener='(address=(protocol=tcp)(host=onprem)(port=1521))' scope=spfile;

System altered.

SQL> alter system register;

System altered.

SQL> alter pluggable database orclpdb1 close immediate;

Pluggable database altered.

SQL> alter pluggable database orclpdb1 open;

Pluggable database altered.

SQL> show parameter local_listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      (address=(protocol=tcp)(host=o
                                                 nprem)(port=1521))
SQL> exit
...
[oracle@onprem ~]$ lsnrctl start
...
[oracle@onprem ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 03-JUN-2022 15:42:10

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=onprem)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                03-JUN-2022 15:41:51
Uptime                    0 days 0 hr. 0 min. 19 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/onprem/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=onprem)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "ORCLCDB" has 1 instance(s).
  Instance "ORCLCDB", status UNKNOWN, has 1 handler(s) for this service...
Service "e084229d2c223f1ee0530f02000abd83" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 2 handler(s) for this service...
Service "orclpdb1" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 2 handler(s) for this service...
The command completed successfully

[oracle@onprem ~]$ sqlplus system/Welcome123@orclpdb1;
...
SQL> show con_name

CON_NAME
------------------------------
ORCLPDB1