Summary of DGMGRL Commands with Example

Posted By Sagar Patil


Command Effect
ADD DATABASE Adds a new standby database profile to the existing broker configuration 

DGMGRL> ADD DATABASE ‘secondary’ AS CONNECT IDENTIFIER IS secondary MAINTAINED AS PHYSICAL;

CONNECT Connects to the specified database using the specified username. 

DGMGRL> connect sys/manager@primary
Connected.

CREATE CONFIGURATION Creates a broker configuration and creates and adds a primary database profile to the configuration. 

DGMGRL> CREATE CONFIGURATION ‘sample’ AS PRIMARY DATABASE IS ‘primary’ CONNECT IDENTIFIER IS primary;
Configuration “sample” created with primary database “primary”

DISABLE CONFIGURATION Disables broker management of a configuration so that the configuration and all of its databases are no longer managed by the broker. 

DGMGRL> disable configuration;
Disabled.

DISABLE DATABASE Disables broker management of the named standby database. 

DGMGRL> disable database secondary;
Disabled.

EDIT CONFIGURATION (Protection Mode) Changes the current protection mode setting for the broker configuration 

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS  MAXPerformance;
Succeeded.

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS  MAXPROTECTION;
Operation requires shutdown of instance “primary” on database “primary”
Shutting down instance “primary”…
Database closed.
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance “primary” on database “primary”
Starting instance “primary”…

EDIT DATABASE (Property) Changes the value of a property for the named database 

DGMGRL> EDIT DATABASE ‘primary’ SET PROPERTY ‘ArchiveLagTarget’=200;
Property “ArchiveLagTarget” updated

DGMGRL> EDIT DATABASE ‘primary’ SET PROPERTY ‘StandbyArchiveLocation’=’C:\app\pa
tilsa\product\11.2.0\dbhome_1\oradata’;
Property “StandbyArchiveLocation” updated

EDIT DATABASE (Rename) Changes the name used by the broker to refer to the specified database. This command can only be done when broker management of the database that you are renaming is disabled. 

DGMGRL> EDIT DATABASE ‘secondary’ RENAME TO ‘standby’;
Error: ORA-16602: database must be disabled to perform this operation
Failed.

DGMGRL> disable database secondary;
Disabled.
DGMGRL> EDIT DATABASE ‘secondary’ RENAME TO ‘standby’;
Succeeded.

EDIT DATABASE (State) Changes the state of the specified database.The state in which you want the database to be running. The possible states are:
ONLINE
LOG-TRANSPORT-OFF (primary database only)
LOG-APPLY-OFF (standby database only)
READ-ONLY (physical standby database only)
OFFLINE 

DGMGRL> EDIT DATABASE ‘secondary’ SET STATE=‘READ-ONLY’;
Succeeded.
DGMGRL> EDIT DATABASE ‘secondary’ SET STATE=‘OFFLINE’;
Operation requires shutdown of instance “secondary” on database “secondary”
Shutting down instance “secondary”…
Database closed.
Database dismounted.
ORACLE instance shut down.
DGMGRL> EDIT DATABASE ‘secondary’ SET STATE=’ONLINE’;
Error: ORA-16525: the Data Guard broker is not yet available
— Make sure Standby Database is started and mounted.
DGMGRL> EDIT DATABASE ‘secondary’ SET STATE=’ONLINE’;
Succeeded.

EDIT INSTANCE (AUTO PFILE) Sets the name of the initialization parameter file for the specified instance. 

DGMGRL> EDIT INSTANCE ‘secondary’ ON DATABASE ‘secondary’ SET AUTO PFILE=’initse
condary.ora’;
Instance “secondary” updated

EDIT INSTANCE (Property) Changes the value of a property for the specified instance. 

DGMGRL> EDIT instance ‘primary’ on DATABASE ‘primary’ SET PROPERTY ‘StandbyArchi
veLocation’=’C:\app\patilsa\product\11.2.0\dbhome_1\oradata’;
Property “StandbyArchiveLocation” updated

ENABLE CONFIGURATION Enables broker management of the broker configuration and all of its databases.DGMGRL> enable configuration;
Enabled.
ENABLE DATABASE Enables broker management of the specified database. 

DGMGRL> enable database ‘secondary’;
Enabled.

EXIT Exits the Data Guard command-line interface.
FAILOVER Performs a database failover operation in which the standby database, to which the CLI is currently connected, fails over to the role of primary database.
HELP Displays online help for the Data Guard command-line interface. 

add            Adds a standby database to the broker configuration
connect        Connects to an Oracle database instance
convert        Converts a database from one type to another
create         Creates a broker configuration
disable        Disables a configuration, a database, or fast-start failover
edit           Edits a configuration, database, or instance
enable         Enables a configuration, a database, or fast-start failover
exit           Exits the program
failover       Changes a standby database to be the primary database
help           Displays description and syntax for a command
quit           Exits the program
reinstate      Changes a database marked for reinstatement into a viable standby
rem            Comment to be ignored by DGMGRL
remove         Removes a configuration, database, or instance
show           Displays information about a configuration, database, or instance
shutdown       Shuts down a currently running Oracle database instance
start          Starts the fast-start failover observer
startup        Starts an Oracle database instance
stop           Stops the fast-start failover observer
switchover     Switches roles between a primary and standby database
Use "help <command>" to see syntax for individual commands
QUIT Quits the Data Guard command-line interface.
REMOVE CONFIGURATION Removes the broker configuration including all of its database profiles from the broker configuration file.
REMOVE DATABASE Removes the specified standby database profile from the broker configuration. 

DGMGRL> remove database secondary;
Removed database “secondary” from the configuration

REMOVE INSTANCE Removes knowledge of an instance from an existing database profile in the broker configuration.
SHOW CONFIGURATION Displays information about the broker configuration. 

DGMGRL> SHOW CONFIGURATION
Configuration – sample
Protection Mode: MaxPerformance
Databases:
primary   – Primary database
Warning: ORA-16789: standby redo logs not configured
secondary – Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
WARNING

SHOW DATABASE Displays information about the specified database. 

DGMGRL> show database secondary;
Database – secondary
Role:            PRIMARY
Intended State:  TRANSPORT-ON
Instance(s):
secondary
Database Status:
SUCCESS

SHOW INSTANCE Displays information about the specified instance. 

DGMGRL> show instance primary;
Instance ‘primary’ of database ‘primary’
Host Name: sagar-pc
Instance Status:
SUCCESS

DGMGRL> show instance secondary;
Instance ‘secondary’ of database ‘secondary’
Host Name: sagar-pc
Instance Status:
SUCCESS

SHUTDOWN Shuts down a currently running Oracle database. 

DGMGRL> connect sys/manager@primary
Connected.
DGMGRL> shutdown abort;
ORACLE instance shut down.

STARTUP Starts an Oracle instance with the same options as SQL*Plus, including mounting and opening a database. 

DGMGRL> connect sys/manager@primary
Connected.
DGMGRL> startup;
ORACLE instance started.
Database mounted.
Database opened.

SWITCHOVER Performs a switchover operation in which the current primary database becomes a standby database, and the specified standby database becomes the primary database. 

DGMGRL> switchover to secondary;
Performing switchover NOW, please wait…
New primary database “secondary” is opening…
Operation requires shutdown of instance “primary” on database “primary”
Shutting down instance “primary”…
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance “primary” on database “primary”
Starting instance “primary”…
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connectdescriptor Failed. (IGNORE TNS error)
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
start up and mount instance “primary” of database “primary”

The following commands are available: 

add            Adds a standby database to the broker configuration
connect        Connects to an Oracle database instance
convert        Converts a database from one type to another
create         Creates a broker configuration
disable        Disables a configuration, a database, or fast-start failover
edit           Edits a configuration, database, or instance
enable         Enables a configuration, a database, or fast-start failover
exit           Exits the program
failover       Changes a standby database to be the primary database
help           Displays description and syntax for a command
quit           Exits the program
reinstate      Changes a database marked for reinstatement into a viable standby

rem            Comment to be ignored by DGMGRL
remove         Removes a configuration, database, or instance
show           Displays information about a configuration, database, or instance

shutdown       Shuts down a currently running Oracle database instance
start          Starts the fast-start failover observer
startup        Starts an Oracle database instance
stop           Stops the fast-start failover observer
switchover     Switches roles between a primary and standby database

Use “help <command>” to see syntax for individual commands

Leave a Reply

You must be logged in to post a comment.

Top of Page

Top menu