DGMGRL
The Data Guard command-line interface (DGMGRL) enables you to manage a Data Guard broker configuration and its various members directly from the command line, or from batch programs or scripts. You can use the Data Guard command-line interface as an alternative to Oracle Enterprise Manager Cloud Control (Cloud Control) for managing a Data Guard configuration.
1)修改dg_broker 为true
查看已经是true 如果不是的话 执行下面语句
alter system set dg_broker_start=true;
SQL> show parameter dg_broker_start
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dg_broker_start boolean TRUE
--主库查看
SQL> show parameter dg
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
dg_broker_config_file1 string /u01/app/oracle/product/12.2.0
/db_1/dbs/dr1pdbcndba_p.dat
dg_broker_config_file2 string /u01/app/oracle/product/12.2.0
/db_1/dbs/dr2pdbcndba_p.dat
dg_broker_start boolean TRUE
inmemory_adg_enabled boolean TRUE
2)dgmgrl 连接到主库
[oracle@www.cndba.cn ~]$ dgmgrl sys/oracle@cndba
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Wed Aug 16 10:59:16 2017
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected to "pdbcndba_p"
Connected as SYSDBA.
3)在 主库创建配置
DGMGRL> create configuration 'dg_cndba' as primary database is 'pdbcndba_p' connect identifier is 'PDBCNDBA_P';
Configuration "dg_cndba" created with primary database "pdbcndba_p"
create configuration '配置名称自定义' as primary database is 'db_unique_name' connect identifier is 'tnsname.ora里连接主库';
--查看配置信息
DGMGRL> SHOW CONFIGURATION
Configuration - dg_cndba
Protection Mode: MaxPerformance
Members:
pdbcndba_p - Primary database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
4)添加备库到配置信息:
DGMGRL> add database 'pdbcndba_s' as connect identifier is 'PDBCNDBA_S' maintained as physical;
Error: ORA-16698: member has a LOG_ARCHIVE_DEST_n parameter with SERVICE attribute set
Failed.
[oracle@www.cndba.cn trace]$ oerr ora 16698
16698, 00000, "member has a LOG_ARCHIVE_DEST_n parameter with SERVICE attribute set"
// *Cause: One or more LOG_ARCHIVE_DEST_n initialization parameters that
// contain a SERVICE attribute for another member in the
// configuration were set on the new member when attempting to add a
// standby database or far sync instance to the configuration.
// *Action: Clear all LOG_ARCHIVE_DEST_n initialization parameters that
// contain a SERVICE attribute for another member in the configuration
// on the new member to be added.
这个错误可以通过在Primary 和 Standby上取消log_archive_dest_n参数来解决,实际这一块的参数应当是交给DG broker 来管理了,不再需要人为介入设置。
--主备库执行以下语句,重置参数log_archive_dest_2
SQL> alter system set log_archive_dest_2='' scope=both;
System altered.
DGMGRL> add database 'pdbcndba_s' as connect identifier is 'PDBCNDBA_S' maintained as physical;
Database "pdbcndba_s" added
add database 'db_unique_name' as connect identifier is 'tnsname.ora连接备库' maintained as physical;
--查看配置信息:
DGMGRL> show configuration
Configuration - dg_cndba
Protection Mode: MaxPerformance
Members:
pdbcndba_p - Primary database
pdbcndba_s - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
DGMGRL>
DGMGRL> enable configuration;
Enabled.
DGMGRL> DGMGRL>
DGMGRL> show configuration
Configuration - dg_cndba
Protection Mode: MaxPerformance
Members:
pdbcndba_p - Primary database
pdbcndba_s - Physical standby database
Error: ORA-16664: unable to receive the result from a member
Fast-Start Failover: DISABLED
Configuration Status:
ERROR (status updated 14 seconds ago)
DGMGRL> enable database pdbcndba_s
Enabled.
DGMGRL> show configuration
Configuration - dg_cndba
Protection Mode: MaxPerformance
Members:
pdbcndba_p - Primary database
pdbcndba_s - Physical standby database
Warning: ORA-16792: configurable property value is inconsistent with member setting
Fast-Start Failover: DISABLED
Configuration Status:
WARNING (status updated 8 seconds ago)
DGMGRL> show database pdbcndba_s statusreport;
STATUS REPORT
INSTANCE_NAME SEVERITY ERROR_TEXT
cndba WARNING ORA-16714: the value of property ArchiveLagTarget is inconsistent with the member setting
cndba WARNING ORA-16714: the value of property LogArchiveMaxProcesses is inconsistent with the member setting
cndba WARNING ORA-16714: the value of property LogArchiveMinSucceedDest is inconsistent with the member setting
cndba WARNING ORA-16714: the value of property DataGuardSyncLatency is inconsistent with the member setting
cndba WARNING ORA-16714: the value of property LogArchiveTrace is inconsistent with the member setting
cndba WARNING ORA-16675: database instance restart required for property value modification to take effect
cndba WARNING ORA-16714: the value of property LogArchiveFormat is inconsistent with the member setting
备库状态报告6个属性值与数据库设置不一致,重新设置
DGMGRL> edit database pdbcndba_s set property LogArchiveFormat='%t_%s_%r.dbf';
Warning: ORA-16675: database instance restart required for property value modification to take effect
Property "logarchiveformat" updated
DGMGRL> edit database pdbcndba_s set property ArchiveLagTarget=0;
Property "archivelagtarget" updated
DGMGRL> edit database pdbcndba_s set property LogArchiveMaxProcesses=1;
Property "logarchivemaxprocesses" updated
DGMGRL> edit database pdbcndba_s set property LogArchiveMinSucceedDest=1;
Property "logarchiveminsucceeddest" updated
DGMGRL> edit database pdbcndba_s set property DataGuardSyncLatency=0;
Property "dataguardsynclatency" updated
DGMGRL> edit database pdbcndba_s set property LogArchiveTrace=0;
Property "logarchivetrace" updated
DGMGRL> show database pdbcndba_s statusreport;
STATUS REPORT
INSTANCE_NAME SEVERITY ERROR_TEXT
DGMGRL> show configuration
Configuration - dg_cndba
Protection Mode: MaxPerformance
Members:
pdbcndba_p - Primary database
pdbcndba_s - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 49 seconds ago)
版权声明:本文为博主原创文章,未经博主允许不得转载。