My Oracle Support Banner

Steps to Execute DGMGRL Commands Stored in Script File (Doc ID 2803050.1)

Last updated on APRIL 17, 2023

Applies to:

Oracle Database - Enterprise Edition - Version 12.2.0.1 and later
Information in this document applies to any platform.

Goal

NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data
from the Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material.
Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner.

For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:

Primary database: orcl12201
Standby database: orcl12201_stby

Starting from Oracle Database 12c Release 2 (12.2.0.1),  it is possible to use dgmgrl with script files.
The @ command allows you to execute DGMGRL commands stored in script files.
Use the "@" sign before the script name to execute the contents of the script.
The commands contained in the script are executed sequentially.

For Example:  See the content of the test_dg.txt script file.

This happens if the commands in the script do not end with a ";" 

 Every command in the script file being run on the DGMGRL prompt has to end with a ";" 

 

NOTE:- 

If there is a START OBSERVER command in the script, then any commands after that are ignored. 

This behavior is because START OBSERVER command turns DGMGRL session into an observer.

Workaround would be to use START OBSERVER IN BACKGROUND