By Mouhamadou Diaw

Up to Oracle 19c, there was no automatic way to backup the configuration of the broker. One solution was to manually copy all executed instructions in a file.
With Oracle 19c, there is now the possibility to export and to import the configuration of the broker. Indeed the new EXPORT CONFIGURATION command will enable to save the metadata contained in the broker configuration file to a text file. This can be very useful if I have to recreate my configuration.
In this blog I have tested this command with following configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
DGMGRL> show configuration
Configuration - db19c
  Protection Mode: MaxAvailability
  Members:
  DB19C_SITE1 - Primary database
    DB19C_SITE2 - Physical standby database
    DB19C_SITE3 - Physical standby database
Fast-Start Failover:  Disabled
Configuration Status:
SUCCESS   (status updated 47 seconds ago)
DGMGRL>

We can see the syntax of the EXPORT command with the help command

1
2
3
4
5
6
7
8
9
DGMGRL> help export
Export Data Guard Broker configuration to a file.
Syntax:
  EXPORT CONFIGURATION [TO ];
DGMGRL>

Now let’s export the configuration

1
2
3
DGMGRL> EXPORT CONFIGURATION TO db19c_config.txt
Succeeded.
DGMGRL>

The file is generated in the trace files directory.

1
2
3
4
5
[oracle@primaserver trace]$ pwd
/u01/app/oracle/diag/rdbms/db19c_site1/DB19C/trace
[oracle@primaserver trace]$ ls -l db19c_config.txt
-rw-r--r--. 1 oracle oinstall 8469 May  4 12:25 db19c_config.txt
[oracle@primaserver trace]$

Let’s remove the configuration

1
2
3
4
5
6
7
8
9
10
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXPERFORMANCE;
Succeeded.
DGMGRL> remove configuration;
Removed configuration
DGMGRL> show configuration
ORA-16532: Oracle Data Guard broker configuration does not exist
Configuration details cannot be determined by DGMGRL
DGMGRL>

Now let’s use the IMPORT command to rebuild the configuration

1
2
3
DGMGRL> IMPORT CONFIGURATION FROM db19c_config.txt
Succeeded. Run ENABLE CONFIGURATION to enable the imported configuration.
DGMGRL>

As we can see the configuration is disabled after the import

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
DGMGRL> show configuration
Configuration - db19c
  Protection Mode: MaxAvailability
  Members:
  DB19C_SITE1 - Primary database
    DB19C_SITE2 - Physical standby database
    DB19C_SITE3 - Physical standby database
Fast-Start Failover:  Disabled
Configuration Status:
DISABLED
DGMGRL>

So let’s enable it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
DGMGRL> ENABLE CONFIGURATION
Enabled.
DGMGRL> show configuration
Configuration - db19c
  Protection Mode: MaxAvailability
  Members:
  DB19C_SITE1 - Primary database
    Warning: ORA-16629: database reports a different protection level from the protection mode
    DB19C_SITE2 - Physical standby database
    DB19C_SITE3 - Physical standby database
Fast-Start Failover:  Disabled
Configuration Status:
WARNING   (status updated 6 seconds ago)
DGMGRL>

The warning is due to the fact that the protection mode was set to MaxPerformance to be able to drop the configuration.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY ;
Succeeded.
DGMGRL> show configuration
Configuration - db19c
  Protection Mode: MaxAvailability
  Members:
  DB19C_SITE1 - Primary database
    DB19C_SITE2 - Physical standby database
    DB19C_SITE3 - Physical standby database
Fast-Start Failover:  Disabled
Configuration Status:
SUCCESS   (status updated 37 seconds ago)
DGMGRL>

Now let’s run the EXPORT command without specifying a file name

1
2
3
DGMGRL> EXPORT CONFIGURATION
Succeeded.
DGMGRL>

We can see in the trace directory that a default name is generated for the file

1
DB19C_dmon_5912_brkmeta_1.trc

If we run again the export command

1
2
3
DGMGRL> EXPORT CONFIGURATION
Succeeded.
DGMGRL>

A second default file is created

1
DB19C_dmon_5912_brkmeta_2.trc