Oracle 级联DG部署以及切换测试

**前言:**文档描述搭建一级、二级DG并且模拟多个场景切换测试。DG搭建很简单,级联DG也是生产中比较常见的部署方式,如果一级DG切换为主库,那么就相当于一主两备。

一、 搭建一级备库
环境:11.2.0.4 单机
主库:192.168.100.129 SID:ecms 主机名:nhjcgl-db
一级备库:192.168.100.199 SID:ecms 主机名:dg1
二级备库:192.168.100.200 SID:ecms 主机名:dg2

1.1 主库准备
select FORCE_LOGGING,log_mode from v$database;
alter database force logging;
1.2 开启归档
shu immediate
startup mount
alter database archivelog;
alter database open;

1.3 参数设置
alter system set log_archive_config=‘dg_config=(ecms,ecmsdg1)’;
alter system set log_archive_dest_2=‘service=ecmsdg1 async valid_for=(online_logfile,primary_role) db_unique_name=ecmsdg1’;

1.4 监听配置
#TNS
ECMS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = nhjcgl-db)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ecms)
)
)

ecmsdg1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.199)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ecms)
)
)

##Listener
[oracle@nhjcgl-db admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/11.2.4/db_home1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = nhjcgl-db)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_NAME = ecms)
(ORACLE_HOME =/u01/app/oracle/11.2.4/db_home1)
(SID_NAME= ecms)
)
)

ADR_BASE_LISTENER = /u01/app/oracle

1.5 备库准备
复制密码文件、参数文件、监听文件
修改pfile
[oracle@dg1 ~]$ cat pfile001
ecms.__db_cache_size=281018368
ecms.__java_pool_size=20971520
ecms.__large_pool_size=4194304
ecms.__oracle_base=’/u01/app/oracle’#ORACLE_BASE set from environment
ecms.__pga_aggregate_target=289406976
ecms.__sga_target=545259520
ecms.__shared_io_pool_size=0
ecms.__shared_pool_size=222298112
ecms.__streams_pool_size=8388608
*.audit_file_dest=’/u01/app/oracle/admin/ecms/adump’
*.audit_trail=‘db’
*.compatible=‘11.2.0.4.0’
*.control_files=’/u01/app/oracle/oradata/ecms/control01.ctl’
.db_block_size=8192
#
.db_create_file_dest=’/u01/app/oracle/oradata/ecms/’
*.db_domain=’’
*.db_name=‘ecms’
*.db_recovery_file_dest=’/u01/app/oracle/fast_recovery_area’
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest=’/u01/app/oracle’
*.dispatchers=’(PROTOCOL=TCP) (SERVICE=ecmsXDB)’
*.fal_client=‘ECMSDG1’
*.fal_server=‘ECMS’
*.java_jit_enabled=TRUE
*.java_pool_size=0
*.large_pool_size=4194304
*.log_archive_config=‘dg_config=(ecms,ecmsdg1)’
*.log_archive_dest_2=‘service=ecms async valid_for=(online_logfile,primary_role) db_unique_name=ecms’
*.memory_target=831520768
*.open_cursors=3500
*.processes=150
*.remote_login_passwordfile=‘EXCLUSIVE’
*.service_names=‘ecms,tt’
*.standby_file_management=‘AUTO’
*.undo_tablespace=‘UNDOTBS1’
*.db_unique_name=ECMSDG1

1.6 创建目录
/u01/app/oracle/admin/ecms/adump
/u01/app/oracle/oradata/ecms/
/u01/app/oracle/fast_recovery_area
1.7 启动
SQL> startup nomount pfile=’/home/oracle/pfile001’;
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2257800 bytes
Variable Size 545262712 bytes
Database Buffers 281018368 bytes
Redo Buffers 2392064 bytes
SQL> create spfile from pfile=’/home/oracle/pfile001’;
SQL> shu immediate;startup nomount;

1.8 备库连接到主库
[oracle@dg1 dbs]$ rman target sys/xxxxx@ecms auxiliary sys/xxxxx@ecmsdg1

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jun 6 10:15:18 2019

Copyright © 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: ECMS (DBID=4086521191)
connected to auxiliary database: ECMS (not mounted)

RMAN> duplicate target database for standby from active database dorecover nofilenamecheck;

1.9 添加standby log
alter database add standby logfile ‘/u01/app/oracle/oradata/ecms/standby01.log’ size 50m;

二、 搭建二级备库

2.1 级联备库(与创建一级备库方法步骤一致)
级联主库修改dg1
alter system set log_archive_config=‘dg_config=(ecms,ecmsdg1,ecmsdg2)’;
alter system set log_archive_dest_3=‘service=ecmsdg2 async valid_for=(standby_logfile,standby_role) db_unique_name=ecmsdg2’;

2.2 级联备库修改dg2,复制监听文件,密码文件,参数文件
Pfile修改
[oracle@dg2 ~]$ cat pfile002
ecms.__db_cache_size=281018368
ecms.__java_pool_size=20971520
ecms.__large_pool_size=4194304
ecms.__oracle_base=’/u01/app/oracle’#ORACLE_BASE set from environment
ecms.__pga_aggregate_target=289406976
ecms.__sga_target=545259520
ecms.__shared_io_pool_size=0
ecms.__shared_pool_size=222298112
ecms.__streams_pool_size=8388608
*.audit_file_dest=’/u01/app/oracle/admin/ecms/adump’
*.audit_trail=‘db’
*.compatible=‘11.2.0.4.0’
*.control_files=’/u01/app/oracle/oradata/ecms/control01.ctl’
.db_block_size=8192
#
.db_create_file_dest=’/u01/app/oracle/oradata/ecms/’
*.db_domain=’’
*.db_name=‘ecms’
*.db_recovery_file_dest=’/u01/app/oracle/fast_recovery_area’
*.db_recovery_file_dest_size=4385144832
*.db_unique_name=‘ecmsdg2’
*.diagnostic_dest=’/u01/app/oracle’
*.dispatchers=’(PROTOCOL=TCP) (SERVICE=ecmsXDB)’
*.fal_client=‘ECMSDG2’
*.fal_server=‘ECMSDG1’
*.java_jit_enabled=TRUE
*.java_pool_size=0
*.large_pool_size=4194304
*.log_archive_config=‘dg_config=(ecmsdg1,ecmsdg2)’
*.log_archive_dest_2=‘service=ecmsdg1 async valid_for=(online_logfile,primary_role) db_unique_name=ecmsdg1’
*.memory_target=831520768
*.ope

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值