hosts 파일 편집

[primary IP] [primary 호스트명]
[standby IP] [standby 호스트명]
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.0.1.71   seoul
10.0.5.71   seoul_dg
10.0.1.72   busan
10.0.5.72   busan_dg


실제 운영 환경에서는 업무에 부담을 줄이기 위해 별도의 DG 전용 망을 사용하는 것을 권장합니다.

Primary  네트워크 설정

listener.ora 파일 작성

SID_LIST_[리스너명] =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = [primary 글로벌 DB명])
      (ORACLE_HOME = [ORACLE_HOME 경로])
      (SID_NAME = [인스턴스명])
    )
    (SID_DESC =
      (GLOBAL_DBNAME = [primary 글로벌 DB명]_DGB)
      (ORACLE_HOME = [ORACLE_HOME 경로])
      (SID_NAME = [인스턴스명])
    )
    (SID_DESC =
      (GLOBAL_DBNAME = [primary 글로벌 DB명]_DGMGRL)
      (ORACLE_HOME = [ORACLE_HOME 경로])
      (SID_NAME = [인스턴스명])
    )
  )
 
[리스너명] =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = [primary 호스트명 또는 IP])(PORT = [리스너 포트 번호]))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC[리스너 포트 번호]))
    )
  )
 
ADR_BASE_[리스너명] = [리스너 로그 경로]
# listener.ora Network Configuration File: /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

ADR_BASE_LISTENER_DG = /u01/app/oracle
ADR_BASE_LISTENER_ORCL = /u01/app/oracle

LISTENER_DG =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = seoul_dg)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

SID_LIST_LISTENER_DG =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = /u01/app/oracle/product/19c/db_1)
      (SID_NAME = orcl)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = orcl_DGB)
      (ORACLE_HOME = /u01/app/oracle/product/19c/db_1)
      (SID_NAME = orcl)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = orcl_DGMGRL)
      (ORACLE_HOME = /u01/app/oracle/product/19c/db_1)
      (SID_NAME = orcl)
    )
  )

LISTENER_ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = seoul)(PORT = 1525))
  )

SID_LIST_LISTENER_ORCL =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = /u01/app/oracle/product/19c/db_1)
      (SID_NAME = orcl)
    )
  )


Primary 노드에 Static 리스너 설정을 추가합니다.

tnsnames.ora 파일 작성

[primary 네트워크 서비스명] =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = [primary 호스트명 또는 IP])(PORT = [리스너 포트 번호]))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = [primary 서비스명]))
    )
  )

[standby 네트워크 서비스명] =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = [standby 호스트명 또는 IP])(PORT = [리스너 포트 번호]))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = [standby 서비스명])
    )
  )
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/19c/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

SEOUL_SYN =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = seoul_dg)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

BUSAN_SYN =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = busan_dg)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl_stby)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = seoul)(PORT = 1525))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )


DB 접속을 위한 TNS 정보를 추가합니다.

Primary 리스너 기동 및 체크

lsnrctl start [리스너명]
tnsping [primary 네트워크 서비스명]
[oracle@orcl ~]$ lsnrctl start LISTENER_DG

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 13-FEB-2024 14:10:59

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

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

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/seoul/listener_dg/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=seoul_dg)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=seoul_dg)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_DG
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                13-FEB-2024 14:10:59
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/seoul/listener_dg/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=seoul_dg)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_DGB" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_DGMGRL" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

[oracle@orcl ~]$ lsnrctl start LISTENER_ORCL

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 13-FEB-2024 14:11:16

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

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

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/seoul/listener_orcl/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=seoul)(PORT=1525)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=seoul)(PORT=1525)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_ORCL
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                13-FEB-2024 14:11:16
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/seoul/listener_orcl/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=seoul)(PORT=1525)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


[oracle@orcl ~]$ ps -ef | grep tns
root          27       2  0 14:06 ?        00:00:00 [netns]
oracle      1306       1  0 14:10 ?        00:00:00 /u01/app/oracle/product/19c/db_1/bin/tnslsnr LISTENER_DG -inherit
oracle      1311       1  0 14:11 ?        00:00:00 /u01/app/oracle/product/19c/db_1/bin/tnslsnr LISTENER_ORCL -inherit
oracle      1314    1273  0 14:11 pts/0    00:00:00 grep --color=auto tns

[oracle@orcl ~]$ tnsping SEOUL_SYN

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 13-FEB-2024 14:12:52

Copyright (c) 1997, 2021, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = seoul_dg)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (0 msec)



Standby 네트워크 설정

listener.ora 파일 작성

SID_LIST_[리스너명] =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = [standby 글로벌 DB명])
      (ORACLE_HOME = [ORACLE_HOME 경로])
      (SID_NAME = [인스턴스명])
    )
    (SID_DESC =
      (GLOBAL_DBNAME = [standby 글로벌 DB명]_DGB)
      (ORACLE_HOME = [ORACLE_HOME 경로])
      (SID_NAME = [인스턴스명])
    )
    (SID_DESC =
      (GLOBAL_DBNAME = [standby 글로벌 DB명]_DGMGRL)
      (ORACLE_HOME = [ORACLE_HOME 경로])
      (SID_NAME = [인스턴스명])
    )
  )
 
[리스너명] =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = [standby 호스트명 또는 IP])(PORT = [리스너 포트 번호]))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC[리스너 포트 번호]))
    )
  )
 
ADR_BASE_[리스너명] = [리스너 로그 경로]
# listener.ora Network Configuration File: /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

ADR_BASE_LISTENER_DG = /u01/app/oracle
ADR_BASE_LISTENER_ORCL = /u01/app/oracle

LISTENER_DG =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = busan_dg)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

SID_LIST_LISTENER_DG =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl_stby)
      (ORACLE_HOME = /u01/app/oracle/product/19c/db_1)
      (SID_NAME = orcl)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = orcl_stby_DGB)
      (ORACLE_HOME = /u01/app/oracle/product/19c/db_1)
      (SID_NAME = orcl)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = orcl_stby_DGMGRL)
      (ORACLE_HOME = /u01/app/oracle/product/19c/db_1)
      (SID_NAME = orcl)
    )
  )

LISTENER_ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = busan)(PORT = 1525))
  )

SID_LIST_LISTENER_ORCL =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl_stby)
      (ORACLE_HOME = /u01/app/oracle/product/19c/db_1)
      (SID_NAME = orcl)
    )
  )



tnsnames.ora 파일 작성

[standby 네트워크 서비스명] =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = [standby 호스트명 또는 IP])(PORT = [리스너 포트 번호]))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = [standby 서비스명])
    )
  )

[primary 네트워크 서비스명] =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = [primary 호스트명 또는 IP])(PORT = [리스너 포트 번호]))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = [primary 서비스명]))
    )
  )
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/19c/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

BUSAN_SYN =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = busan_dg)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl_stby)
    )
  )

SEOUL_SYN =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = seoul_dg)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

ORCL_STBY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = busan)(PORT = 1525))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl_stby)
    )
  )



Standby 리스너 기동 및 체크

lsnrctl start [리스너명]
tnsping [primary 네트워크 서비스명]
[oracle@orcl ~]$ lsnrctl start LISTENER_DG

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 13-FEB-2024 14:12:19

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

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

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/busan/listener_dg/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=busan_dg)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=busan_dg)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_DG
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                13-FEB-2024 14:12:19
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/busan/listener_dg/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=busan_dg)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl_stby" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_stby_DGB" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_stby_DGMGRL" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

[oracle@orcl ~]$ lsnrctl start LISTENER_ORCL

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 13-FEB-2024 14:12:25

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

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

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/busan/listener_orcl/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=busan)(PORT=1525)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=busan)(PORT=1525)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_ORCL
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                13-FEB-2024 14:12:25
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/busan/listener_orcl/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=busan)(PORT=1525)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


[oracle@orcl ~]$ ps -ef | grep tns
root          27       2  0 14:07 ?        00:00:00 [netns]
oracle      1309       1  0 14:12 ?        00:00:00 /u01/app/oracle/product/19c/db_1/bin/tnslsnr LISTENER_DG -inherit
oracle      1313       1  0 14:12 ?        00:00:00 /u01/app/oracle/product/19c/db_1/bin/tnslsnr LISTENER_ORCL -inherit
oracle      1316    1276  0 14:12 pts/0    00:00:00 grep --color=auto tns

[oracle@orcl ~]$ tnsping SEOUL_SYN

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 13-FEB-2024 14:12:58

Copyright (c) 1997, 2021, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = seoul_dg)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (10 msec)