본문 바로가기
DB_이야기/# Oracle

[Oracle] Oracle Listener(리스너) 설정 (Silent Mode)

by gwon_s 2024. 11. 21.

 

netca 설정 및 Listener 생성

 

 - netca.rsp 파일 설정

    'SHOW_GUI' 를 false로 변경 

[oracle@localhost ~]$ vi netca.rsp

.
.
.

#-------------------------------------------------------------------------------
# Name       : SHOW_GUI
# Datatype   : Boolean
# Description: This variable controls appearance/suppression of the NetCA GUI,
# Pre-req    : N/A
# Default    : TRUE
# Note:
# This must be set to false in order to run NetCA in silent mode.
# This is a substitute of "/silent" flag in the NetCA command line.
# The command line flag has precedence over the one in this response file.
# This feature is present since 10.1.0.3.
#-------------------------------------------------------------------------------
SHOW_GUI=false

 

 

 - netca.rsp 실행시켜 Listener 생성 실행

[oracle@localhost ~]$ cd $ORACLE_HOME/bin
[oracle@localhost bin]$ ./netca /silent /responsefile ~/netca.rsp

Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /home/oracle/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
    Running Listener Control: 
      /u01/app/oracle/product/12.2.0/dbhome_1/bin/lsnrctl start LISTENER
    Listener Control complete.
    Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0

 

 

 

Listener 설정

 - 정적 Listener와 동적 Listener의 차이

특징 정적 Listener 동적 Listener
설정 방식 listener.ora 파일에 수동으로 데이터베이스 정보를 입력 데이터베이스가 Listener에 자동으로 정보를 등록 (PMON 프로세스 활용)
사용 시기 데이터베이스가 수동 등록이 필요할 때 대부분의 표준 Oracle 환경에서 기본적으로 사용
장점 특정 환경에서 필요한 세부 설정 가능 자동 등록으로 설정 간소화
단점 설정이 번거롭고 유지 관리 필요 일부 제한적인 환경에서 예상치 못한 동작 가능

 

 

 

 - Listener.ora 설정

[oracle@localhost admin]$ vi $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = orcl)
      (ORACLE_HOME = /u01/app/oracle/product/12.2.0/dbhome_1)
      (GLOBAL_DBNAME = orcl)
    )
  )

 

 - tnsnames.ora 설정

[oracle@localhost bin]$ cd /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/samples
[oracle@localhost samples]$ cp tnsnames.ora ../
[oracle@localhost samples]$ vi /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/tnsnames.ora
ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.@@.@@@)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )

 

 - 연결 테스트

# 클라이언트PC에서 telnet으로 1521 포트 연결 확인
C:\Users\user> telnet 192.168.@@.@@@ 1521
[oracle@centos ~]$ sqlplus system/{PASSWORD}@orcl

SQL*Plus: Release 12.2.0.1.0 Production on Fri Nov 22 11:50:03 2024

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Last Successful login time: Fri Nov 22 2024 11:49:04 +09:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>

 

 

 

 

연결이 안될 시
# 1. 방화벽에서 1521 포트 열기

# 1-1. firewalld에 포트 1521 열기
firewall-cmd --zone=public --add-port=1521/tcp --permanent
firewall-cmd --reload

# 1-2. 또는 방화벽 OFF
systemctl stop firewalld

# 1-3. firewalld 상태 확인
firewall-cmd --list-ports
# seliunx를 disabled로 수정
[oracle@centos ~]$ vi /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of three values:

SELINUX=disabled				# 수정

#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted