DGMGRL (dataguard broker command line interface

From Robs_Wiki
Jump to: navigation, search

Create a Dataguard Broker configuration

In order to create a Dataguard broker configuration, make sure parameter database parameter dg_broker_start =true.

[oracle@exa-dm1dbadm01 trace]$ dgmgrl
DGMGRL> connect sys2/oracle
Connected as SYSDG.

DGMGRL> create configuration dg_sprod01 as primary database is 'sprod01' connect identifier is 'sprod01';
Configuration "dg_sprod01" created with primary database "sprod01"

DGMGRL> add database 'rprod01' as connect identifier is 'rprod01' maintained as physical;
Database "rprod01" added

DGMGRL> edit database "sprod01" set property PreferredApplyInstance='sprod011';
Property "preferredapplyinstance" updated

DGMGRL> edit database "sprod01" set property PreferredApplyInstance='sprod011';
Property "preferredapplyinstance" updated 

DGMGRL> enable configuration;

Monitor a Dataguard Broker configuration

Monitor current configuration

DGMGRL> show configuration;
Configuration - dg_sprod01
  Protection Mode: MaxPerformance
  Members:
  sprod01 - Primary database
    rprod01 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS   (status updated 44 seconds ago)

DGMGRL> show [verbose] database sprod01
Database - sprod01
  Role:               PRIMARY
  Intended State:     TRANSPORT-ON
  Instance(s):
    sprod011
    sprod012
Database Status:
SUCCESS

DGMGRL> show [verbose] database rprod01
Database - rprod01
  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 0 seconds ago)
  Apply Lag:          0 seconds (computed 0 seconds ago)
  Average Apply Rate: 53.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    rprod011
Database Status:
SUCCESS 

Monitor configuration for switchover

DGMGRL> validate database sprod01
  Database Role:    Primary database
  Ready for Switchover:  Yes

DGMGRL> validate database rprod01
  Database Role:     Physical standby database
  Primary Database:  sprod01
  Ready for Switchover:  Yes
  Ready for Failover:    Yes (Primary Running)
  Capacity Information:
    Database  Instances        Threads
    sprod01    2                2
    rprod01    1                2
    Warning: the target standby has fewer instances than the
    primary database, this may impact application performance
  Current Log File Groups Configuration:
    Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
              (sprod01)                (rprod01)
    0         110                     0                       Insufficient SRLs
    Warning: standby redo logs not configured for thread 0 on rprod01
  Future Log File Groups Configuration:
    Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
              (rprod01)                (sprod01)
    0         110                     0                       Insufficient SRLs
    Warning: standby redo logs not configured for thread 0 on sprod01

Note: the Warning about the standby redo logs is a bug and can be ignored. The bug will be resolved in 12.2.

See Oracle Note "Bug 20582405 - dgmgrl "validate database" shows warning "standby redo logs not configured for thread 0" (Doc ID 20582405.8)"

Update the Dataguard Broker Configuration

Remove configuration components

DGMGRL> remove instance rprod012;
Removed instance "rprod012" from database "rprod01" 

Update configuration properties

REM Enable/Disable Log Apply:
DGMGRL> edit database 'rprod01' set state='APPLY-OFF';
Succeeded.

DGMGRL> edit database 'rprod01' set state='APPLY-ON';
Succeeded.

REM Enable/Disable Log Transport:
DGMGRL> edit database 'rprod01' set state='LOG-TRANSPORT-OFF';
Succeeded.

DGMGRL> edit database 'rprod01' set state='LOG-TRANSPORT-ON';
Succeeded.

REM If apply lag > 15 seconds, a warning is generated:
DGMGRL>edit  database 'rprodo01' set property applylagthreshold=15;

REM Logs are applied only after intended delay:
DGMGRL> edit DATABASE sDB01 set property delaymins=60;

Perform a Switchover and a Failover

DGMGRL> switchover to rprod01;
Performing switchover NOW, please wait...
New primary database "rprod01" is opening...
Oracle Clusterware is restarting database "sprod01" ...
Switchover succeeded, new primary is "rprod01"

DGMGRL> failover to rprod01;
Performing failover NOW, please wait...
Failover succeeded, new primary is "rprod01"