1. 네트워크 정보 수정
A) hosts 파일 수정
root 계정으로 vi /etc/hosts 수행
[primary 1번 DG 전용 IP] [primary 1번 DG 전용 호스트명] [primary 2번 DG 전용 IP] [primary 2번 DG 전용 호스트명] [primary 1번 DG 전용 VIP] [primary 1번 DG 전용 VIP명] [primary 2번 DG 전용 VIP] [primary 2번 DG 전용 VIP명] [standby DG 전용 IP] [standby DG 전용 호스트명]
### Public 10.0.1.181 seoul1 seoul1.localdomain 10.0.1.182 seoul2 seoul2.localdomain ### Private 10.0.16.181 seoul1-priv seoul1-priv.localdomain 10.0.16.182 seoul2-priv seoul2-priv.localdomain ### Virtual 10.0.1.183 seoul1-vip seoul1-vip.localdomain 10.0.1.184 seoul2-vip seoul2-vip.localdomain ### SCAN 10.0.1.180 seoul-scan seoul-scan.localdomain ### STANDBY 10.0.1.185 busan ### DG 100.10.16.181 seoul1-dg seoul1-dg.localdomain 100.10.16.182 seoul2-dg seoul2-dg.localdomain 100.10.16.185 busan-dg ### DG Virtual 100.10.16.183 seoul1-dgv seoul1-dgv.localdomain 100.10.16.184 seoul2-dgv seoul2-dgv.localdomain
2. 클러스터 리소스 추가
A) RAC(Primary)에 Data Guard 전용 network 객체 추가
클러스터에 Data Guard 전용 네트워크 객체 추가
srvctl add network -k [네트워크 번호] -S [DG 전용 IP C클래스 정보]/255.255.255.0/[DG 전용 NIC명] srvctl config network -netnum [네트워크 번호]
[root@seoul1 ~]# srvctl add network -k 2 -S 100.10.16.0/255.255.255.0/ens38 [root@seoul1 ~]# srvctl config network -netnum 2 2 네트워크가 존재합니다. 서브넷 IPv4: 100.10.16.0/255.255.255.0/ens38, static 서브넷 IPv6: 핑 대상: 네트워크가 사용으로 설정되었습니다. 네트워크가 노드에서 개별적으로 사용으로 설정됨: 네트워크가 노드에서 개별적으로 사용 안함으로 설정됨:
[root@seoul1 ~]# crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.LISTENER.lsnr ONLINE ONLINE seoul1 STABLE ONLINE ONLINE seoul2 STABLE ora.chad ONLINE ONLINE seoul1 STABLE ONLINE ONLINE seoul2 STABLE ora.net1.network ONLINE ONLINE seoul1 STABLE ONLINE ONLINE seoul2 STABLE ora.net2.network OFFLINE OFFLINE seoul1 STABLE OFFLINE OFFLINE seoul2 STABLE ora.ons ONLINE ONLINE seoul1 STABLE ONLINE ONLINE seoul2 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup) 1 ONLINE ONLINE seoul1 STABLE 2 ONLINE ONLINE seoul2 STABLE ora.CRS.dg(ora.asmgroup) 1 ONLINE ONLINE seoul1 STABLE 2 ONLINE ONLINE seoul2 STABLE ora.DATA.dg(ora.asmgroup) 1 ONLINE ONLINE seoul1 STABLE 2 ONLINE ONLINE seoul2 STABLE ora.FRA.dg(ora.asmgroup) 1 ONLINE ONLINE seoul1 STABLE 2 ONLINE ONLINE seoul2 STABLE ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE seoul1 STABLE ora.asm(ora.asmgroup) 1 ONLINE ONLINE seoul1 Started,STABLE 2 ONLINE ONLINE seoul2 Started,STABLE ora.asmnet1.asmnetwork(ora.asmgroup) 1 ONLINE ONLINE seoul1 STABLE 2 ONLINE ONLINE seoul2 STABLE ora.cvu 1 ONLINE ONLINE seoul1 STABLE ora.qosmserver 1 ONLINE ONLINE seoul1 STABLE ora.scan1.vip 1 ONLINE ONLINE seoul1 STABLE ora.seoul1.vip 1 ONLINE ONLINE seoul1 STABLE ora.seoul2.vip 1 ONLINE ONLINE seoul2 STABLE ora.testdb.db 1 ONLINE ONLINE seoul1 Open,HOME=/u01/app/o racle/db/19c,STABLE 2 ONLINE ONLINE seoul2 Open,HOME=/u01/app/o racle/db/19c,STABLE --------------------------------------------------------------------------------
B) RAC(Primary)에 Data Guard 전용 VIP 추가
클러스터에 DG 전용 VIP 추가
srvctl add vip -n [1번 호스트명] -k [네트워크 번호] -A [primary 1번 DG VIP명]/255.255.255.0/[DG 전용 NIC명] srvctl add vip -n [2번 호스트명] -k [네트워크 번호] -A [primary 2번 DG VIP명]/255.255.255.0/[DG 전용 NIC명] srvctl start vip -vip [1번 노드 DG 전용 VIP명] srvctl start vip -vip [2번 노드 DG 전용 VIP명] crsctl stat res -t | grep -E 'net|vip'
[root@seoul1 ~]# srvctl add vip -n seoul1 -k 2 -A seoul1-dgv/255.255.255.0/ens38 [root@seoul1 ~]# srvctl add vip -n seoul2 -k 2 -A seoul2-dgv/255.255.255.0/ens38 [root@seoul1 ~]# srvctl start vip -vip seoul1_2 [root@seoul1 ~]# srvctl start vip -vip seoul2_2 [root@seoul1 ~]# crsctl stat res -t | grep -E 'net|vip' ora.net1.network ora.net2.network ora.asmnet1.asmnetwork(ora.asmgroup) ora.scan1.vip ora.seoul1.vip ora.seoul1_2.vip ora.seoul2.vip ora.seoul2_2.vip
[root@seoul1 ~]# crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.LISTENER.lsnr ONLINE ONLINE seoul1 STABLE ONLINE ONLINE seoul2 STABLE ora.chad ONLINE ONLINE seoul1 STABLE ONLINE ONLINE seoul2 STABLE ora.net1.network ONLINE ONLINE seoul1 STABLE ONLINE ONLINE seoul2 STABLE ora.net2.network ONLINE ONLINE seoul1 STABLE ONLINE ONLINE seoul2 STABLE ora.ons ONLINE ONLINE seoul1 STABLE ONLINE ONLINE seoul2 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup) 1 ONLINE ONLINE seoul1 STABLE 2 ONLINE ONLINE seoul2 STABLE ora.CRS.dg(ora.asmgroup) 1 ONLINE ONLINE seoul1 STABLE 2 ONLINE ONLINE seoul2 STABLE ora.DATA.dg(ora.asmgroup) 1 ONLINE ONLINE seoul1 STABLE 2 ONLINE ONLINE seoul2 STABLE ora.FRA.dg(ora.asmgroup) 1 ONLINE ONLINE seoul1 STABLE 2 ONLINE ONLINE seoul2 STABLE ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE seoul1 STABLE ora.asm(ora.asmgroup) 1 ONLINE ONLINE seoul1 Started,STABLE 2 ONLINE ONLINE seoul2 Started,STABLE ora.asmnet1.asmnetwork(ora.asmgroup) 1 ONLINE ONLINE seoul1 STABLE 2 ONLINE ONLINE seoul2 STABLE ora.cvu 1 ONLINE ONLINE seoul1 STABLE ora.qosmserver 1 ONLINE ONLINE seoul1 STABLE ora.scan1.vip 1 ONLINE ONLINE seoul1 STABLE ora.seoul1.vip 1 ONLINE ONLINE seoul1 STABLE ora.seoul1_2.vip 1 ONLINE ONLINE seoul1 STABLE ora.seoul2.vip 1 ONLINE ONLINE seoul2 STABLE ora.seoul2_2.vip 1 ONLINE ONLINE seoul2 STABLE ora.testdb.db 1 ONLINE ONLINE seoul1 Open,HOME=/u01/app/o racle/db/19c,STABLE 2 ONLINE ONLINE seoul2 Open,HOME=/u01/app/o racle/db/19c,STABLE --------------------------------------------------------------------------------
C) RAC(Primary)에 Data Guard 전용 listener 추가
클러스터에 Data Guard 전용 리스너 추가
srvctl add listener -listener LISTENER_DG -netnum [네트워크 번호] -endpoints "TCP:[DG 전용 리스너 포트 번호]" -oraclehome $GI_HOME srvctl start listener -listener LISTENER_DG lsnrctl stat LISTENER_DG
[+ASM1@seoul1:~]$ srvctl add listener -listener LISTENER_DG -netnum 2 -endpoints "TCP:1625" -oraclehome $GI_HOME [+ASM1@seoul1:~]$ srvctl start listener -listener LISTENER_DG
[+ASM1@seoul1:~]$ lsnrctl stat LISTENER_DG LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 04-APR-2024 13:43:02 Copyright (c) 1991, 2023, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_DG))) STATUS of the LISTENER ------------------------ Alias LISTENER_DG Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 04-APR-2024 13:42:54 Uptime 0 days 0 hr. 0 min. 7 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/gi/19c/network/admin/listener.ora Listener Log File /u01/app/oracle/db/diag/tnslsnr/seoul1/listener_dg/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_DG))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=100.10.16.183)(PORT=1625))) The listener supports no services The command completed successfully
[+ASM2@seoul2:~]$ lsnrctl stat LISTENER_DG LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 04-APR-2024 13:43:45 Copyright (c) 1991, 2023, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_DG))) STATUS of the LISTENER ------------------------ Alias LISTENER_DG Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 04-APR-2024 13:42:54 Uptime 0 days 0 hr. 0 min. 50 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/gi/19c/network/admin/listener.ora Listener Log File /u01/app/oracle/db/diag/tnslsnr/seoul2/listener_dg/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_DG))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=100.10.16.184)(PORT=1625))) The listener supports no services The command completed successfully
D) Local Listener 추가
DG 전용 리스너를 local listener로 추가
alter system set LOCAL_LISTENER="(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=[인스턴스별 기존 VIP명 또는 IP])(PORT=[기존 리스너 포트]))(ADDRESS=(PROTOCOL=TCP)(HOST=[인스턴스별 DG 전용 VIP 명 또는 IP])(PORT=[DG 전용 리스너 포트 번호])))" sid='[인스턴스명]';
SQL> alter system set LOCAL_LISTENER="(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=seoul1-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=seoul1-dgv)(PORT=1625)))" sid='TESTDB1'; System altered. SQL> alter system register; System altered.
SQL> alter system set LOCAL_LISTENER="(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=seoul2-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=seoul2-dgv)(PORT=1625)))" sid='TESTDB2'; System altered. SQL> alter system register; System altered.
3. 복제용 임시 리스너 생성
A) Standby에 임시 listener 생성
$DB_HOME/network/admin/listener.ora 파일 생성
LISTENER_TEMP = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = [standby DG 전용 호스트명 또는 IP])(PORT = [리스너 포트 번호])) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC[리스너 포트 번호])) ) ) SID_LIST_LISTENER_TEMP = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = [standby 글로벌 DB명]) (ORACLE_HOME = [DB 홈 경로]) (SID_NAME = [standby 인스턴스명]) ) )
[TESTDB@busan:~]$ cat >> $DB_HOME/network/admin/listener.ora LISTENER_TEMP = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = busan-dg)(PORT = 1625)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1625)) ) ) SID_LIST_LISTENER_TEMP = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = TESTDB_STBY) (ORACLE_HOME = /u01/app/oracle/db/19c) (SID_NAME = TESTDB) ) ) ^C
B) 임시 listener 기동
DB 복제용 임시 리스너 기동
lsnrctl start LISTENER_TEMP
[TESTDB@busan:~]$ lsnrctl start LISTENER_TEMP LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 04-APR-2024 14:01:53 Copyright (c) 1991, 2023, Oracle. All rights reserved. Starting /u01/app/oracle/db/19c/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 19.0.0.0.0 - Production System parameter file is /u01/app/oracle/db/19c/network/admin/listener.ora Log messages written to /u01/app/oracle/db/diag/tnslsnr/busan/listener_temp/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=100.10.16.185)(PORT=1625))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1625))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=busan-dg)(PORT=1625))) STATUS of the LISTENER ------------------------ Alias LISTENER_TEMP Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 04-APR-2024 14:01:53 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/db/19c/network/admin/listener.ora Listener Log File /u01/app/oracle/db/diag/tnslsnr/busan/listener_temp/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=100.10.16.185)(PORT=1625))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1625))) Services Summary... Service "TESTDB_STBY" has 1 instance(s). Instance "TESTDB", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully
4. 접속 정보 설정
A) Primary와 Standby에 tnsnames.ora 설정
$DB_HOME/network/admin/tnsnames.ora 파일 수정
### primary site ### [primary 호스트명]_SYN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = [primary 1번 DG 전용 VIP명])(PORT = [리스너 포트])) (ADDRESS = (PROTOCOL = TCP)(HOST = [primary 2번 DG 전용 VIP명])(PORT = [리스너 포트])) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = [primary 글로벌 DB명])) ) [primary 1번 인스턴스명]_SYN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = [primary 1번 DG 전용 VIP명])(PORT = [리스너 포트])) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = [primary 글로벌 DB명])(INSTANCE_NAME = [primary 1번 인스턴스명])) ) [primary 2번 인스턴스명]_SYN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = [primary 1번 DG 전용 VIP명])(PORT = [리스너 포트])) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = [primary 글로벌 DB명])(INSTANCE_NAME = [primary 2번 인스턴스명])) ) ### standby site ### [standby 호스트명]_SYN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = [standby DG 전용 호스트명])(PORT = [리스너 포트])) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = [standby 글로벌 DB명])) )
### primary site ### SEOUL_SYN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = seoul1-dgv)(PORT = 1625)) (ADDRESS = (PROTOCOL = TCP)(HOST = seoul2-dgv)(PORT = 1625)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = TESTDB)) ) TESTDB1_SYN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = seoul1-dgv)(PORT = 1625)) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = TESTDB)(INSTANCE_NAME = TESTDB1)) ) TESTDB2_SYN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = seoul2-dgv)(PORT = 1625)) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = TESTDB)(INSTANCE_NAME = TESTDB2)) ) ### standby site ### BUSAN_SYN = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = busan-dg)(PORT = 1625)) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = TESTDB_STBY)) )
{}