一、描述
Oracle 12c
RHEL 7.3
二、配置DataGuard Broker
1.源端
sqlplus / as sysdba
alter system set dg_broker_config_file1='/oracle/oradata/orcl/dr1.dat';
alter system set dg_broker_config_file2='/oracle/oradata/orcl/dr2.dat';
alter system set dg_broker_start=true;
2.目的端
sqlplus / as sysdba
alter system set dg_broker_config_file1='/oracle/oradata/orcl/dr1.dat';
alter system set dg_broker_config_file2='/oracle/oradata/orcl/dr2.dat';
alter system set dg_broker_start=true;
3.查看dmon进程
<roidb01:orcl:/oracle/oradata/orcl>$ps -ef|grep dmon
oracle 5768 1 0 20:28 ? 00:00:00 ora_dmon_orcl
oracle 5773 4404 0 20:28 pts/1 00:00:00 grep --color=auto dmon
4.配置DG
源端使用oracle用户执行
<roidb01:orcl:/home/oracle>$dgmgrl /
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production
Copyright (c) 2000, 2013, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected as SYSDG.
DGMGRL> create configuration 'dg_config' as primary database is 'orcl' connect identifier is orcl;
Error: ORA-16698: LOG_ARCHIVE_DEST_n parameter set for object to be added
Failed.
DGMGRL>
5.查看报错
<roidb01:orcl:/home/oracle>$oerr ora 16698
16698, 0000, "LOG_ARCHIVE_DEST_n parameter set for object to be added"
// *Cause: One or more LOG_ARCHIVE_DEST_n initialization parameters that
// contain a SERVICE attribute but not the NOREGISTER attribute were
// set when attempting to create a configuration or add a standby or
// far sync instance to the configuration.
// *Action: If creating a configuration, clear all LOG_ARCHIVE_DEST_n
// initialization parameters that contain a SERVICE attribute but not
// the NOREGISTER attribute. If adding a standby database or far sync
// instance, clear the LOG_ARCHIVE_DEST_n initialization parameter
// that specifies the database or far sync instance to be added.
<roidb01:orcl:/home/oracle>$
6.报错处理
主库备库都需要执行!!!
这个错误可以通过在Primary 和 Standby上取消log_archive_dest_n参数来解决,
实际这一块的参数应当是交给DG broker 来管理了,不再需要人为介入设置。
SQL> alter system reset log_archive_dest_2;
System altered.
SQL> alter system reset log_archive_dest_1;
System altered.
SQL> startup force;
ORACLE instance started.
Total System Global Area 1560281088 bytes
Fixed Size 2924784 bytes
Variable Size 1006636816 bytes
Database Buffers 536870912 bytes
Redo Buffers 13848576 bytes
Database mounted.
Database opened.
SQL>
7.配置、启用、查看DG
<roidb01:orcl:/home/oracle>$dgmgrl /
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production
Copyright (c) 2000, 2013, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected as SYSDG.
DGMGRL>
DGMGRL> create configuration 'dg_config' as primary database is 'orcl' connect identifier is orcl;
Configuration "dg_config" created with primary database "orcl"
DGMGRL> add database 'orcldg' as connect identifier is orcldg;
Database "orcldg" added
DGMGRL>
DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration;
Configuration - dg_config
Protection Mode: MaxPerformance
Members:
orcl - Primary database
orcldg - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 6 seconds ago)
DGMGRL>
三、小结
本来测试环境DG没有使用broker,不过客户的环境都是broker来管理,
只好把自己的环境修改为broker的管理方式。