版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/leo__1990/article/details/90179492
概念
This feature enables command scripts to be executed through the Oracle Data Guard broker DGMGRL command-line interface; much like in SQL*Plus. DGMGRL commands, SQL commands using the broker SQL command, and operating system commands using the new HOST (or !) capability can be put into a file and executed on the DGMGRL command line.
该特性使命令脚本可以通过Oracle Data Guard broker DGMGRL命令行界面执行;就像在SQL*Plus。DGMGRL命令、使用代理SQL命令的SQL命令,以及使用新的主机(或!)功能的操作系统命令可以放入文件中,并在DGMGRL命令行上执行。
This feature enables customers who use the standard interface to Oracle Data Guard (DGMGRL) in their broker configurations to use scripts for Oracle Data Guard operations.
该特性使使用标准接口的客户可以在其代理配置中使用Oracle Data Guard(DGMGRL),从而为Oracle数据保护操作使用脚本。
实验
1)@命令允许执行存储在脚本文件中的DGMGRL命令,脚步里的命令是能在DGMGRL命令行执行的脚步: 详细更多可执行命令可参考官方文档:
http://docs.oracle.com/database/122/DGBKR/oracle-data-guard-broker-commands.htm#DGBKR3668
[[email protected] u01]$ dgmgrl sys/oracle@cndba
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Wed Aug 16 14:44:15 2017
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected to "pdbcndba_p"
Connected as SYSDBA.
DGMGRL> @/u01/test.sql
Configuration - dg_cndba
Protection Mode: MaxPerformance
Members:
pdbcndba_p - Primary database
pdbcndba_s - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 51 seconds ago)
2)使用DGMGRL /(slash)命令重复在命令提示符中输入的最后一个命令。 [[email protected] u01]$ dgmgrl sys/oracle@cndba
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Wed Aug 16 15:03:27 2017
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected to "pdbcndba_p"
Connected as SYSDBA.
DGMGRL> SHOW CONFIGURATION;
Configuration - dg_cndba
Protection Mode: MaxPerformance
Members:
pdbcndba_p - Primary database
pdbcndba_s - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 39 seconds ago)
DGMGRL> /
Configuration - dg_cndba
Protection Mode: MaxPerformance
Members:
pdbcndba_p - Primary database
pdbcndba_s - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 40 seconds ago)
3) DGMGRL CONNECT命令将您连接到数据库或far sync instance,该实例是数据保护代理配置的成员。
[[email protected] u01]$ dgmgrl sys/oracle
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Wed Aug 16 15:07:22 2017
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected to "pdbcndba_p"
Connected as SYSDG.
DGMGRL> connect sys/oracle
Connected to "pdbcndba_p"
Connected as SYSDG.
DGMGRL> connect sys/[email protected]
Connected to "pdbcndba_p"
Connected as SYSDBA.
4) 执行 show 和VALIDATE命令
[[email protected] u01]$ dgmgrl sys/oracle
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Wed Aug 16 15:07:22 2017
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected to "pdbcndba_p"
Connected as SYSDG.
DGMGRL> show database pdbcndba_p
Database - pdbcndba_p
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
cndba
Database Status:
SUCCESS
DGMGRL> VALIDATE DATABASE pdbcndba_p
Database Role: Primary database
Ready for Switchover: Yes
Flashback Database Status:
pdbcndba_p: Off
Managed by Clusterware:
pdbcndba_p: NO
Warning: Ensure primary database's StaticConnectIdentifier property
is configured properly so that the primary database can be restarted
by DGMGRL after switchover
参考链接: