Tuesday, 23 May 2017

Oracle: DG(DGMGRL) simple configuration

Already present:
Primary  Database : BLOK
Standby Database : ALOK

Prestep:
1. Set init.ora parameter
dg_broker_start= TRUE (Dynamic/No restart required/both side instances)
2. tns and listnener setup for both primary and standby.
http://aloksk.blogspot.com/2017/05/oracle-dgmgrl-seamless-switch.html

Intent : Configure DGMGRL (no observer)

dgmgrl
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle
Connected.
DGMGRL> SHOW CONFIGURATION;
Error:
ORA-16525: the Data Guard broker is not yet available
Configuration details cannot be determined by DGMGRL

******At this point DGMGRL is not configured.(Ensure tnsnames is configured and listner configured as in http://aloksk.blogspot.com/2017/05/oracle-dgmgrl-seamless-switch.html )

DGMGRL> connect sys/oracle
Connected.
DGMGRL> CREATE CONFIGURATION 'DRSOLUTION' AS PRIMARY DATABASE IS 'BLOK' CONNECT IDENTIFIER IS BLOK;
Configuration "DRSOLUTION" created with primary database "BLOK"
DGMGRL> SHOW CONFIGURATION;

Configuration - DRSOLUTION

  Protection Mode: MaxPerformance
  Databases:
    BLOK - Primary database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

DGMGRL> ADD DATABASE 'ALOK' AS  CONNECT IDENTIFIER IS ALOK;
Database "ALOK" added
DGMGRL> SHOW CONFIGURATION;

Configuration - DRSOLUTION

  Protection Mode: MaxPerformance
  Databases:
    BLOK - Primary database
    ALOK - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

****At this point Primary and standby are added to DG config but not enabled.
DGMGRL> show configuration;

Configuration - DRSOLUTION

  Protection Mode: MaxPerformance
  Databases:
    BLOK - Primary database
    ALOK - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

*****Enable the config
DGMGRL> ENABLE CONFIGURATION;
Enabled.
DGMGRL> show configuration;

Configuration - DRSOLUTION

  Protection Mode: MaxPerformance
  Databases:
    BLOK - Primary database
    ALOK - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

****At this DGMGRL can be used for switchover  and switchback

Log of switchover and switchback:

**Status check:
dgmgrl
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle
Connected.
DGMGRL> SHOW DATABASE 'ALOK';

Database - ALOK

  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    ALOK

Database Status:
SUCCESS

DGMGRL> SHOW DATABASE 'BLOK';

Database - BLOK

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds (computed 0 seconds ago)
  Apply Lag:       0 seconds (computed 0 seconds ago)
  Apply Rate:      76.00 KByte/s
  Real Time Query: OFF
  Instance(s):
    BLOK

Database Status:
SUCCESS

*****Switch (twice just for fun  ) u can run show database to see status at any point.
GMGRL> switchover to 'BLOK';
Performing switchover NOW, please wait...
New primary database "BLOK" is opening...
Operation requires startup of instance "ALOK" on database "ALOK"
Starting instance "ALOK"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "BLOK"
DGMGRL>
DGMGRL> SHOW DATABASE 'BLOK';

Database - BLOK

  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    BLOK

Database Status:
SUCCESS
DGMGRL> SHOW DATABASE 'ALOK';

Database - ALOK

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds (computed 1 second ago)
  Apply Lag:       0 seconds (computed 1 second ago)
  Apply Rate:      0 Byte/s
  Real Time Query: OFF
  Instance(s):
    ALOK

Database Status:
SUCCESS

DGMGRL> switchover to 'ALOK';
Performing switchover NOW, please wait...
Operation requires a connection to instance "ALOK" on database "ALOK"
Connecting to instance "ALOK"...
Connected.
New primary database "ALOK" is opening...
Operation requires startup of instance "BLOK" on database "BLOK"
Starting instance "BLOK"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "ALOK"
DGMGRL>                                       


Error:
ORA-16525 :  dg_boker_start=true (both instance primary/standby)
ORA-16698: Disable log_archive_dest_NN eg: alter system set log_archive_dest_2='' scope=both Sid='*';      Both at primary and standby
ORA-16809: Generally because of stanby logs discrepency. May need to work on it if 30min wait doesnot get rid of error. In my case i did enable configuration again and then show configuaration worked just fine.


No comments:

Post a Comment