본문 바로가기

Database/Oracle

55 - [Oracle 19C] The default listener - exercise

리스너 파일(listener.ora)이 어떤 역할을 하는지 몇가지 테스트를 통해서 확인해 봅시다

 

  • listener.ora 내용

 

[oracle@test admin]$ ll
합계 16
-rw-r----- 1 oracle oinstall  328 11월 11 00:59 listener.ora
drwxr-xr-x 2 oracle oinstall   64  4월 17  2019 samples
-rw-r--r-- 1 oracle oinstall 1536  2월 14  2018 shrept.lst
-rw-r----- 1 oracle oinstall  187 11월 11 00:59 sqlnet.ora
-rw-r----- 1 oracle oinstall 1015 11월 28 15:54 tnsnames.ora


[oracle@test admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/19/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = test.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )


[oracle@test admin]$ mv listener.ora xlistener.ora
[oracle@test admin]$ ll
합계 16
drwxr-xr-x 2 oracle oinstall   64  4월 17  2019 samples
-rw-r--r-- 1 oracle oinstall 1536  2월 14  2018 shrept.lst
-rw-r----- 1 oracle oinstall  187 11월 11 00:59 sqlnet.ora
-rw-r----- 1 oracle oinstall 1015 11월 28 15:54 tnsnames.ora
-rw-r----- 1 oracle oinstall  328 11월 11 00:59 xlistener.ora

 

 

리스너 파일 이름을 변경해도 리스너의 기능은 유지된다.

 

 

[oracle@test admin]$ lsnrctl stop

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-NOV-2023 14:20:51

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully



[oracle@test admin]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-NOV-2023 14:21:03

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

Starting /u01/app/oracle/product/19/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/test/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.com)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                29-NOV-2023 14:21:03
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/test/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.com)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@test admin]$




[oracle@test admin]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-NOV-2023 14:23:32

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                29-NOV-2023 14:21:03
Uptime                    0 days 0 hr. 2 min. 28 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/test/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=test.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "09d7302c9140311ce0639802a8c09c66.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "0ae8ae6e8e43ba20e063e102a8c0700c.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "0b23a05d4693eaa3e063e102a8c05ada.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "0b3984de57cf2d5be063e102a8c0a685.com" has 1 instance(s).
  Instance "ORS", status READY, has 1 handler(s) for this service...
Service "86b637b62fdf7a65e053f706e80a27ca.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "ORS.com" has 1 instance(s).
  Instance "ORS", status READY, has 1 handler(s) for this service...
Service "ORSXDB.com" has 1 instance(s).
  Instance "ORS", status READY, has 1 handler(s) for this service...
Service "orcl.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclpdb.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orspdb.com" has 1 instance(s).
  Instance "ORS", status READY, has 1 handler(s) for this service...
Service "pdb1.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "pdbtest1.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

 

 

원격 컴퓨터에서도 접속하는데 문제가 없이 잘 동작한다.

 

 

 

파라미터에는 아직도 리스너 정보가 저장되어 있다. 그리고 해당 값은 tnsnames.ora 파일에 있는 내용과 동일하다.

 

SQL> show parameter local

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
local_listener			     string	 LISTENER_ORCL
parallel_force_local		     boolean	 FALSE
SQL>

 

 

"LISTENER_ORCL" 값은 tnsnames.ora 파일에서 확인할 수 있다.

아래 그림에서는 인스턴스가 2개인 경우라서 리스너 정보가 2개가 보인다.

 

 

 

 

SQL> show parameter local

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
local_listener			     string	 LISTENER_ORCL
parallel_force_local		     boolean	 FALSE



SQL> alter system set local_listener='';
System altered.



SQL> show parameter local

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
local_listener			     string
parallel_force_local		     boolean	 FALSE

 


local_listener 값이 없으면 어떤 영향이 생기는지 확인해 봅시다.

[oracle@test ~]$ lsnrctl stop

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-NOV-2023 14:58:42

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully



[oracle@test ~]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-NOV-2023 14:58:54

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

Starting /u01/app/oracle/product/19/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/test/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.com)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                29-NOV-2023 14:58:54
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/test/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.com)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@test ~]$



[oracle@test ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-NOV-2023 14:59:14

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                29-NOV-2023 14:58:54
Uptime                    0 days 0 hr. 0 min. 20 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/test/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.com)(PORT=1521)))
The listener supports no services
The command completed successfully



[oracle@test ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-NOV-2023 15:00:24

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                29-NOV-2023 14:58:54
Uptime                    0 days 0 hr. 1 min. 29 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/test/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=test.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "09d7302c9140311ce0639802a8c09c66.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "0ae8ae6e8e43ba20e063e102a8c0700c.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "0b23a05d4693eaa3e063e102a8c05ada.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "0b3984de57cf2d5be063e102a8c0a685.com" has 1 instance(s).
  Instance "ORS", status READY, has 1 handler(s) for this service...
Service "86b637b62fdf7a65e053f706e80a27ca.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "ORS.com" has 1 instance(s).
  Instance "ORS", status READY, has 1 handler(s) for this service...
Service "ORSXDB.com" has 1 instance(s).
  Instance "ORS", status READY, has 1 handler(s) for this service...
Service "orcl.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclpdb.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orspdb.com" has 1 instance(s).
  Instance "ORS", status READY, has 1 handler(s) for this service...
Service "pdb1.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "pdbtest1.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@test ~]$

 

 

 

기본 리스너 정보를 사용할 경우에는 리스너 파일이 없어도(local_listener 값이 없어도) 리스너를 기동시키는데 문제 없고, 원격에서 접속도 잘 된다.

 

the services is up and running.

So this mean if you need to use the default port and the default TCP IP, no need for the listener and also no need for the local listener.