DGMGRL Optional Parameters

You can supply optional parameters on the command line to indicate how you want the Data Guard command-line interface to display output.

Output includes items such as command prompts, banners, and messages.

Additionally, a single command mode is available. In this mode, DGMGRL executes one command and exits upon the completion of the command. The exit code is the result of the command. If the exit code is 0, the command completed successfully. Otherwise, there was an error.

The command line of DGMGRL appears as follows:

% dgmgrl [<options>] [<logon> [<command>] ]

Specify any of the following keywords when you invoke the DGMGRL command-line interface:

  • <options> can be one of the following choices:

    • -echo

      Displays command input and output to the default display device. If you do not use this parameter, only the output from the command is displayed.

    • -logfile <file-spec> "<dgmgrl-command>"

      Specifies a file into which you can capture the actions of the DGMGRL command-line interface.

      Note:

      The DGMGRL -logfile option is deprecated as of Oracle Database 12c Release 2 (12.2.0.1). It is supported for backward compatibility only. Instead, the log file should now be specified using the LOGFILE IS clause on the START OBSERVER command.
    • -silent

      Suppresses the display of the DGMGRL (DGMGRL>) command prompt on your default display device. This option is useful if you are directing the command output to a file or to another display tool.

    • -json
      This option allows DGMGRL to convert command output to JSON format. JSON-formatted output enables easy integration with automation tools and scripting environments. The following example shows the -json option used on the command line:
      $ dgmgrl -json <connect_auth> "show configuration tracelevel";
      {
        "Version" : "26.1.0.24.00",
        "ShowProperty" :
        {
          "Configuration" : "abc",
          "Name" : "TraceLevel",
          "Value" : "USER",
          "Type" : "Configurable"
        }
      }
      The following example shows the -json option used interactively:
      $ dgmgrl <connect_auth>
                DGMGRL> set json on;
                DGMGRL> show configuration tracelevel;
                {  
                   "Version": "26.1.0.24.00",  
                   "ShowProperty":  
                    {    
                      "Configuration": "abc",    
                      "Name": "TraceLevel",    
                      "Value": "USER",    
                      "Type": "Configurable"  
                    }
                }
      DGMGRL> set json off;
  • <logon> is:

    • username [@connect-identifier]

      To connect to the database, enter a username and optionally, a connect-identifier. You will then be prompted for a password. The connect-identifier is a fully specified connect descriptor, a name to be resolved by an Oracle naming method (for example, TNS) including Easy Connect.

      If a fully specified connect descriptor is used, it needs to include quotation marks; otherwise the connections will fail with an invalid option error. The following is an example of connecting using quotation marks:
      dgmgrl sys@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=sales-server)(PORT=1521)))
      (CONNECT_DATA=(SERVICE_NAME=sales.us.example.com)))'
      Enter password: password

      Whether the connect identifier is specified using a fully specified connect descriptor or using the Easy Connect naming method, any of the following syntax is valid (you will be prompted for a password):

      • dgmgrl username@'connect_identifier'

      • dgmgrl username@"connect_identifier"

      • dgmgrl username@"'connect_identifier'"

      WARNING:

      Including a password on the command line when invoking DGMGRL is a security risk. This risk can be avoided either by omitting the password when invoking DGMGRL and entering it when prompted, or by using an external authentication method.

    • You can connect as '/' when using operating-system authentication (remote database restarts will not work), Secure Sockets Layer (SSL) protocol, or database credentials stored in a wallet.

  • <command> is a single command.

    For example:

    dgmgrl sys "show database 'North_Sales'"

    Password: password

The following subsections specify the command format that you enter at the DGMGRL> command prompt.