이 페이지의 이전 버전을 보고 있습니다. 현재 버전 보기.

현재와 비교 페이지 이력 보기

« 이전 버전 3 다음 »

1. Standby DB Instance 기동

A) nomount 모드로 DB 시작

Standby 인스턴스 기동
STARTUP NOMOUNT PFILE='~oracle/[standby 글로벌 DB명].ora'
[ORCLDB@busan:~] $ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 4 14:28:58 2024
Version 19.22.0.0.0

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

Connected to an idle instance.

SQL> startup nomount pfile='/home/oracle/ORCLDB_STBY.ora';
ORACLE instance started.

Total System Global Area  343930632 bytes
Fixed Size                  8939272 bytes
Variable Size             260046848 bytes
Database Buffers           67108864 bytes
Redo Buffers                7835648 bytes
SQL>


2. RMAN을 이용한 DB 복제

A) RMAN 접속

RMAN 으로 Primary와 Standby 동시 접속
rman TARGET sys/[sys 계정 암호]@[primary 네트워크 서비스명] AUXILIARY sys/[sys 계정 암호]@[standby 네트워크 서비스명]
[ORCLDB1@seoul1:~] $ export NLS_DATE_FORMAT="yyyy/mm/dd hh24:mi:ss"

[ORCLDB1@seoul1:~] $ rman TARGET sys/oracle@SEOUL_SYN auxiliary sys/oracle@BUSAN_SYN

Recovery Manager: Release 19.0.0.0.0 - Production on Thu Apr 4 15:08:47 2024
Version 19.22.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCLDB (DBID=2948583395)
connected to auxiliary database: ORCLDB (not mounted)

RMAN>


B) Duplicate 명령으로 DB 복제

운영 중인 DB를 RMAN으로 standby 서버에 복제
DUPLICATE TARGET DATABASE
   FOR STANDBY
   FROM ACTIVE DATABASE                          -- 운영 primary로부터 복제
--   BACKUP LOCATION '[백업 저장 경로 (디스크)]'  -- 백업으로부터 복제 (디스크 저장)
--     FROM FILE '[백업 메타 정보 XML 파일]'      -- 백업으로부터 복제 (테이프 장치)
   DORECOVER
   PASSWORD FILE
   SPFILE
     SET cluster_database='FALSE'
     SET db_unique_name='[standby 글로벌 DB명]' COMMENT 'Is standby'
     SET FAL_SERVER='[primary 글로벌 DB명]' COMMENT 'Is primary'
   NOFILENAMECHECK;
RMAN> DUPLICATE TARGET DATABASE
2>    FOR STANDBY
3>    FROM ACTIVE DATABASE
4>    DORECOVER
5>    PASSWORD FILE
6>    SPFILE
7>      SET cluster_database='FALSE'
8>      SET db_unique_name='orcl_stby' COMMENT 'Is standby'
9>      SET FAL_SERVER='orcl' COMMENT 'Is primary'
10>    NOFILENAMECHECK;

Starting Duplicate Db at 2024/04/04 15:11:24
PASSWORD clause is not needed when duplicating for standby database from active database
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=433 device type=DISK
current log archived

contents of Memory Script:
{
   backup as copy reuse
   passwordfile auxiliary format  '/u01/app/oracle/db/19c/dbs/orapwORCLDB'   ;
   restore clone from service  'SEOUL_SYN' spfile to
 '/u01/app/oracle/db/19c/dbs/spfileORCLDB.ora';
   sql clone "alter system set spfile= ''/u01/app/oracle/db/19c/dbs/spfileORCLDB.ora''";
}
executing Memory Script

Starting backup at 2024/04/04 15:11:26
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=394 instance=ORCLDB2 device type=DISK
Finished backup at 2024/04/04 15:11:29

Starting restore at 2024/04/04 15:11:29
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: restoring SPFILE
output file name=/u01/app/oracle/db/19c/dbs/spfileORCLDB.ora
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 2024/04/04 15:11:33

sql statement: alter system set spfile= ''/u01/app/oracle/db/19c/dbs/spfileORCLDB.ora''

contents of Memory Script:
{
   sql clone "alter system set  cluster_database =
 FALSE comment=
 '''' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''ORCLDB_STBY'' comment=
 ''Is standby'' scope=spfile";
   sql clone "alter system set  FAL_SERVER =
 ''ORCLDB'' comment=
 ''Is primary'' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  cluster_database =  FALSE comment= '''' scope=spfile

sql statement: alter system set  db_unique_name =  ''ORCLDB_STBY'' comment= ''Is standby'' scope=spfile

sql statement: alter system set  FAL_SERVER =  ''ORCLDB'' comment= ''Is primary'' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    3758092920 bytes

Fixed Size                     8946296 bytes
Variable Size                721420288 bytes
Database Buffers            3019898880 bytes
Redo Buffers                   7827456 bytes
duplicating Online logs to Oracle Managed File (OMF) location
duplicating Datafiles to Oracle Managed File (OMF) location

contents of Memory Script:
{
   sql clone "alter system set  control_files =
  ''+DATA/ORCLDB_STBY/CONTROLFILE/current.257.1165417921'', ''+FRA/ORCLDB_STBY/CONTROLFILE/current.256.1165417921'' comment=
 ''Set by RMAN'' scope=spfile";
   restore clone from service  'SEOUL_SYN' standby controlfile;
}
executing Memory Script

sql statement: alter system set  control_files =   ''+DATA/ORCLDB_STBY/CONTROLFILE/current.257.1165417921'', ''+FRA/ORCLDB_STBY/CONTROLFILE/current.256.1165417921'' comment= ''Set by RMAN'' scope=spfile

Starting restore at 2024/04/04 15:12:01
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=197 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DATA/ORCLDB_STBY/CONTROLFILE/current.259.1165417925
output file name=+FRA/ORCLDB_STBY/CONTROLFILE/current.258.1165417925
Finished restore at 2024/04/04 15:12:05

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   switch clone tempfile all;
   set newname for clone datafile  1 to new;
   set newname for clone datafile  3 to new;
   set newname for clone datafile  4 to new;
   set newname for clone datafile  5 to new;
   set newname for clone datafile  7 to new;
   restore
   from  nonsparse   from service
 'SEOUL_SYN'   clone database
   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to +DATA in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 2024/04/04 15:12:09
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to +DATA
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 2024/04/04 15:12:15

sql statement: alter system archive log current
current log archived

contents of Memory Script:
{
   restore clone force from service  'SEOUL_SYN'
           archivelog from scn  2595025;
   switch clone datafile all;
}
executing Memory Script

Starting restore at 2024/04/04 15:12:20
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=16
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=17
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=18
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=2 sequence=8
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service SEOUL_SYN
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=2 sequence=9
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 2024/04/04 15:12:25

datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=1165417945 file name=+DATA/ORCLDB_STBY/DATAFILE/system.260.1165417931
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=1165417945 file name=+DATA/ORCLDB_STBY/DATAFILE/sysaux.261.1165417931
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=1165417946 file name=+DATA/ORCLDB_STBY/DATAFILE/undotbs1.262.1165417933
datafile 5 switched to datafile copy
input datafile copy RECID=9 STAMP=1165417946 file name=+DATA/ORCLDB_STBY/DATAFILE/undotbs2.263.1165417933
datafile 7 switched to datafile copy
input datafile copy RECID=10 STAMP=1165417946 file name=+DATA/ORCLDB_STBY/DATAFILE/users.264.1165417935

contents of Memory Script:
{
   set until scn  2595679;
   recover
   standby
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 2024/04/04 15:12:26
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 17 is already on disk as file +FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_1_seq_17.260.1165417941
archived log for thread 1 with sequence 18 is already on disk as file +FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_1_seq_18.261.1165417943
archived log for thread 2 with sequence 8 is already on disk as file +FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_2_seq_8.262.1165417943
archived log for thread 2 with sequence 9 is already on disk as file +FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_2_seq_9.263.1165417945
archived log file name=+FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_1_seq_17.260.1165417941 thread=1 sequence=17
archived log file name=+FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_2_seq_8.262.1165417943 thread=2 sequence=8
archived log file name=+FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_1_seq_18.261.1165417943 thread=1 sequence=18
archived log file name=+FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_2_seq_9.263.1165417945 thread=2 sequence=9
media recovery complete, elapsed time: 00:00:01
Finished recover at 2024/04/04 15:12:27

contents of Memory Script:
{
   delete clone force archivelog all;
}
executing Memory Script

released channel: ORA_DISK_1
released channel: ORA_AUX_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=394 instance=ORCLDB2 device type=DISK
deleted archived log
archived log file name=+FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_1_seq_16.259.1165417941 RECID=1 STAMP=1165417940
deleted archived log
archived log file name=+FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_1_seq_17.260.1165417941 RECID=2 STAMP=1165417941
deleted archived log
archived log file name=+FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_1_seq_18.261.1165417943 RECID=3 STAMP=1165417942
deleted archived log
archived log file name=+FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_2_seq_8.262.1165417943 RECID=4 STAMP=1165417943
deleted archived log
archived log file name=+FRA/ORCLDB_STBY/ARCHIVELOG/2024_04_04/thread_2_seq_9.263.1165417945 RECID=5 STAMP=1165417944
Deleted 5 objects

Finished Duplicate Db at 2024/04/04 15:12:29
[ORCLDB@busan:~] $ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 4 15:13:10 2024
Version 19.22.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.22.0.0.0

SQL> select status from v$instance;

STATUS
------------------------------------
MOUNTED


3. Standby 리소스 추가

A) Restart 리스너 추가

데이터베이스 복제용 임시 리스너 중지
lsnrctl stop LISTENER_TEMP
[ORCLDB@busan:~] $ lsnrctl stop LISTENER_TEMP

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 04-APR-2024 15:13:33

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=busan-dg)(PORT=1625)))
The command completed successfully


Standby 쪽에 vi $GI_HOME/network/admin/listener.ora 로 글로벌 DB 접속 정보 추가
LISTENER_DG =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = [standby DG 전용 호스트명 또는 IP])(PORT = [리스너 포트]))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC[리스너 포트]))
    )
  )

SID_LIST_LISTENER_DG =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = [standby 글로벌 DB명])
      (ORACLE_HOME = [DB 홈 경로])
      (SID_NAME = [standby 인스턴스명])
    )
  )
LISTENER_DG =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = busan-dg)(PORT = 1625))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1625))
    )
  )

SID_LIST_LISTENER_DG =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = ORCLDB_STBY)
      (ORACLE_HOME = /u01/app/oracle/db/19c)
      (SID_NAME = ORCLDB)
    )
  )


Restart에 리스너 추가
srvctl add listener -listener LISTENER_DG -endpoints "IPC:EXTPROC[리스너 포트]" -oraclehome $GI_HOME
srvctl start listener -listener LISTENER_DG
[ORCLDB@busan:~] $ srvctl add listener -listener LISTENER_DG -endpoints "IPC:EXTPROC1625" -oraclehome $GI_HOME

[ORCLDB@busan:~] $ srvctl start listener -listener LISTENER_DG

[ORCLDB@busan:~] $ srvctl config listener -l LISTENER_DG
이름: LISTENER_DG
유형: Database Listener
홈: /u01/app/oracle/gi/19c
끝점: IPC:EXTPROC1625
리스너가 사용으로 설정되었습니다.


B) Restart에 데이터베이스 추가

Restart에 데이터베이스 추가
srvctl add database -db "[standby 글로벌 DB명]" -dbname "[DB명]" -instance "[standby 인스턴스명]" -oraclehome [DB 홈 경로] -role PHYSICAL_STANDBY -startoption "READ ONLY" -stopoption IMMEDIATE -policy AUTOMATIC -diskgroup [ASM 디스크 그룹1],[ASM 디스크 그룹2],... -spfile [sp파일 경로 및 이름] -pwfile [패스워드 파일 경로 및 이름]
[ORCLDB@busan:~] $ srvctl add database -db "ORCLDB_STBY" -dbname "ORCLDB" -instance "ORCLDB" -oraclehome /u01/app/oracle/db/19c -role PHYSICAL_STANDBY -startoption "READ ONLY" -stopoption IMMEDIATE -policy AUTOMATIC -diskgroup FRA,DATA -spfile /u01/app/oracle/db/19c/dbs/spfileORCLDB.ora -pwfile /u01/app/oracle/db/19c/dbs/orapwORCLDB

[ORCLDB@busan:~] $ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       busan                    STABLE
ora.FRA.dg
               ONLINE  ONLINE       busan                    STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       busan                    STABLE
ora.LISTENER_DG.lsnr
               ONLINE  ONLINE       busan                    STABLE
ora.asm
               ONLINE  ONLINE       busan                    Started,STABLE
ora.ons
               OFFLINE OFFLINE      busan                    STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       busan                    STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       busan                    STABLE
ora.orcldb_stby.db
      1        OFFLINE OFFLINE                               STABLE
--------------------------------------------------------------------------------


  • 레이블 없음