I. Data Guard 환경 구성
1. 파라미터 설정
A) db name 파라미터 조회
DB name 파라미터 값 조회
show parameter db_name show parameter db_unique_name
SQL> show parameter db_name NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_name string orcl SQL> show parameter db_unique_name NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_unique_name string ORCL
db_unique_name 변경
ALTER SYSTEM SET db_unique_name = ORCL scope=spfile;
2. 아카이브 환경 설정
A) 아카이브 로그 파라미터 설정
sys 유저로 primary에서 수행
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORCL,ORCL_STB)'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=ORCL_STB NOAFFIRM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ORCL_STB'; ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE; -- ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' SCOPE=SPFILE;
SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORCL,ORCL_STB)'; System altered. SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=ORCL_STB NOAFFIRM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ORCL_STB'; System altered. SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE; System altered.
B) 아카이브 로그 모드 활성화
sys 유저로 primary에서 수행
SELECT log_mode FROM v$database;
SQL> SELECT log_mode FROM v$database; LOG_MODE ------------ ARCHIVELOG
Noarchive에서 Archive 모드로 변경
SHUTDOWN IMMEDIATE; STARTUP MOUNT; ALTER DATABASE ARCHIVELOG; ALTER DATABASE OPEN;
C) 강제 로그 적용 모드 활성화
sys 유저로 primary에서 수행
ALTER DATABASE FORCE LOGGING; ALTER SYSTEM SWITCH LOGFILE;
SQL> ALTER DATABASE FORCE LOGGING; Database altered. SQL> ALTER SYSTEM SWITCH LOGFILE; System altered.
3. Data Guard 환경 설정
A) Data Guard 관련 파라미터 설정
sys 유저로 primary에서 수행
ALTER SYSTEM SET FAL_CLIENT=ORCL; ALTER SYSTEM SET FAL_SERVER=ORCL_STB; ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;
SQL> ALTER SYSTEM SET FAL_CLIENT=ORCL; System altered. SQL> ALTER SYSTEM SET FAL_SERVER=ORCL_STB; System altered. SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO; System altered.
B) Standby Log File 생성
sys 유저로 primary에서 수행
ALTER DATABASE ADD STANDBY LOGFILE ('/u01/app/oracle/oradata/orcl/standby_redo01.log') SIZE 200M; ALTER DATABASE ADD STANDBY LOGFILE ('/u01/app/oracle/oradata/orcl/standby_redo02.log') SIZE 200M; ALTER DATABASE ADD STANDBY LOGFILE ('/u01/app/oracle/oradata/orcl/standby_redo03.log') SIZE 200M;
SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/u01/app/oracle/oradata/orcl/standby_redo01.log') SIZE 200M; Database altered. SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/u01/app/oracle/oradata/orcl/standby_redo02.log') SIZE 200M; Database altered. SQL> ALTER DATABASE ADD STANDBY LOGFILE ('/u01/app/oracle/oradata/orcl/standby_redo03.log') SIZE 200M; Database altered. SQL> SELECT group#, member, type FROM v$logfile; GROUP# MEMBER TYPE ---------- -------------------------------------------------- ------- 3 /u01/app/oracle/oradata/orcl/redo03.log ONLINE 2 /u01/app/oracle/oradata/orcl/redo02.log ONLINE 1 /u01/app/oracle/oradata/orcl/redo01.log ONLINE 4 /u01/app/oracle/oradata/orcl/standby_redo01.log STANDBY 5 /u01/app/oracle/oradata/orcl/standby_redo02.log STANDBY 6 /u01/app/oracle/oradata/orcl/standby_redo03.log STANDBY 6 rows selected.
C) 플래시백 활성화 (옵션)
sys 유저로 primary에서 수행
ALTER DATABASE FLASHBACK ON;
SQL> SELECT flashback_on FROM v$database; FLASHBACK_ON ------------------ NO SQL> ALTER DATABASE FLASHBACK ON; Database altered. SQL> SELECT flashback_on FROM v$database; FLASHBACK_ON ------------------ YES
4. Standby 서버 환경 설정
A) 디렉토리 생성
oracle 유저로 standby 서버에서 수행
mkdir -p /u01/app/oracle/oradata/orcl/orclpdb mkdir -p /u01/app/oracle/oradata/orcl/pdbseed mkdir -p /u01/app/oracle/fast_recovery_area/orcl mkdir -p /u01/app/oracle/admin/orcl/adump
[oracle@orcl ~]$ mkdir -p /u01/app/oracle/oradata/orcl/orclpdb [oracle@orcl ~]$ mkdir -p /u01/app/oracle/oradata/orcl/pdbseed [oracle@orcl ~]$ mkdir -p /u01/app/oracle/fast_recovery_area/orcl [oracle@orcl ~]$ mkdir -p /u01/app/oracle/admin/orcl/adump
B) 패스워드 파일 생성
oracle 유저로 standby 서버에서 수행
orapwd file=$ORACLE_HOME/dbs/orapworcl password=oracle entries=10 format=12
C) 임시 파라미터 파일 생성
vi /home/oracle/orcl_stb.ora
*.db_name='orcl'
[oracle@orcl ~]$ cat orcl_stb.ora *.db_name='orcl'