Site icon ExaGridDba

Data Guard broker 19c configuration export

By Brian Fitzgerald

Introduction

Oracle Database 19c Data Guard broker has a new export/import feature. You can use export to backup your Data Guard configuration and you can use import to recreate your configuration.

Export

Issue a command such as:

DGMGRL> export configuration to 'dg.xml';
Succeeded.

Find your configuration file in diagnostic_dest

/u01/app/oracle/diag/rdbms/prim/PRIM/trace/dg.xml

You cannot specify a directory or a relative path.

DGMGRL> export configuration to '/home/oracle/dg.xml';
ORA-16540: invalid argument
ORA-06512: at "SYS.DBMS_DRS", line 1947
ORA-06512: at line 1

DGMGRL> export configuration to '../trace/dg.xml';
ORA-16540: invalid argument
ORA-06512: at "SYS.DBMS_DRS", line 1947
ORA-06512: at line 1

dgmgrl will not overwrite an existing file

DGMGRL> export configuration to 'dg.xml';
ORA-16571: Oracle Data Guard configuration file creation failure

You may export at the standby. The export file appears in the standby trace directory.

/u01/app/oracle/diag/rdbms/stby/STBY/trace/dg.xml

Contents

Refer, for example, to this link dg.xml. The export file contains:

Some parameters that are at the default value and have never been modified are not exported.

Only the error number is exported. The error text depends on localization.

[oracle@ip-172-31-88-93 ~]$ export NLS_LANG=French
[oracle@ip-172-31-88-93 ~]$ dgmgrl sys/Zystm.22@PRIM
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Ven. Oct. 18 18:49:58 2019
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Bienvenue dans DGMGRL, tapez "help" pour obtenir des informations.
Connecté à "PRIM"
Connecté en tant que SYSDBA.
DGMGRL> show configuration

Configuration - ORCL_CONFIG

  Mode de protection : MaxPerformance
  Membres :
  PRIM - Base de données principale
    Erreur : ORA-16778: erreur du Redo Transport Service pour des membres

    STBY - Base de données de secours physique
      Erreur : ORA-12543: TNS : hôte de destination impossible à atteindre

Fonction Fast-Start Failover :  Disabled

Statut de configuration :
ERROR   (statut mis à jour il y a 34 secondes)

Import

Here is how to use import.

If there is a configuration, disable and remove it. All members must be accessible.

DGMGRL> disable configuration
Disabled.
DGMGRL> remove configuration
Removed configuration

Import and enable the configuration

DGMGRL> import configuration from 'dg.xml';
Succeeded. Run ENABLE CONFIGURATION to enable the imported configuration.
DGMGRL> enable configuration
Enabled.

Data Guard broker will not import over an existing configuration

DGMGRL> import configuration from 'dg.xml';
ORA-16504: The Oracle Data Guard broker configuration already exists.

Result:

DGMGRL> show configuration

Configuration - ORCL_CONFIG

  Protection Mode: MaxPerformance
  Members:
  PRIM - Primary database
    STBY - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 4 seconds ago)

You can change the export file before reimporting.

Before:

DGMGRL> show database verbose PRIM NetTimeout
  NetTimeout = '30'

File:

Result:

DGMGRL> remove configuration
Removed configuration
DGMGRL> import configuration from 'dg.xml';
Succeeded. Run ENABLE CONFIGURATION to enable the imported configuration.
DGMGRL> show database verbose PRIM NetTimeout
  NetTimeout = '10'

You cannot split the Data Guard xml file into pieces and import them separately.

DGMGRL> import configuration from 'prim.xml';
Succeeded. Run ENABLE CONFIGURATION to enable the imported configuration.
DGMGRL> import configuration from 'stby.xml';
ORA-16504: The Oracle Data Guard broker configuration already exists.
DGMGRL> 

You must import to the primary. If you attempt to import to the standby, this message will appear:

DGMGRL> import configuration from 'dg.xml';
ORA-16501: The Oracle Data Guard broker operation failed.

The trace file offers no clue about what could be the problem.

2019-10-18T11:19:37.866+00:00
IMPORT METADATA FROM /u01/app/oracle/diag/rdbms/stby/STBY/trace/dg.xml
ORA-16501: The Data Guard broker failed to import metadata from /u01/app/oracle/diag/rdbms/stby/STBY/trace/dg.xml.
IMPORT METADATA FROM /u01/app/oracle/diag/rdbms/stby/STBY/trace/dg.xml completed with error ORA-16501

Management of an unreachable member

If you remove a Data Guard configuration while a member is down, you will have an issue later if you try to import. The following administrative sequence that could lead up to the trouble:

DGMGRL> export configuration to 'dg.xml';
Succeeded.

Now, suppose the standby is down

DGMGRL> validate database STBY
Error: ORA-1034: ORACLE not available
Error: ORA-16625: cannot reach member "STBY"
DGMGRL> disable configuration
Disabled.
DGMGRL> remove configuration 
Warning: ORA-16620: one or more members could not be reached for a remove operation Removed configuration
DGMGRL> import configuration from 'dg.xml';
Succeeded. Run ENABLE CONFIGURATION to enable the imported configuration.

Now, if you enable even while the standby is up:

DGMGRL> enable configuration
Enabled.

Error appears

DGMGRL> show configuration

Configuration - ORCL_CONFIG

  Protection Mode: MaxPerformance
  Members:
  PRIM - Primary database
    STBY - Physical standby database (disabled)
      ORA-16904: Member may be a primary database or is receiving redo data from another primary database.

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 28 seconds ago)

Solution: On the standby disable the broker, remove the Data Guard Broker configuration files, and reenable the broker.

SQL> alter system set dg_broker_start=false;

System altered.
[grid@ip-172-31-91-148 ~]$ asmcmd rm +DATA01/STBY/dr1orcl.dat
[grid@ip-172-31-91-148 ~]$ asmcmd rm +RECO01/STBY/dr2orcl.dat
SQL> alter system set dg_broker_start=true;

System altered.

Then, on the primary, disable, remove, import, and enable the configuration.

DGMGRL> disable configuration
Disabled.
DGMGRL> remove configuration
Warning: ORA-16620: one or more members could not be reached for a remove operation

Removed configuration
DGMGRL> import configuration from 'dg.xml';
Succeeded. Run ENABLE CONFIGURATION to enable the imported configuration.
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration

Configuration - ORCL_CONFIG

  Protection Mode: MaxPerformance
  Members:
  PRIM - Primary database
    STBY - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 34 seconds ago)

The problem scenario described here is not unique to import. The issue can occur any time a configuration is deleted while members are down.

Conclusion

dgmgrl export and import are useful for backing up and restoring the Data Guard configuration.

Exit mobile version