DG-Dgmgrl
2018-06-28Dgmgrl表示Data Guard Manager Command Line Interface,用来管理维护Dataguard,而且该命令系统自带不需要额外安装,命令简单易上手,容易学习,比sqlplus用来更加简单一些.
1 dg_broker_start true
SQL> alter system set dg_broker_start=true scope=both;
2 create configuration pri as primary database is "pri" connect identifier is "crmdb1";
Dgmgrl添加主库
--语句含义:
第一个orcl是配置的名称,这里可以随便填.
PRIMARY DATABASE IS 'orcl' ,这儿的orcl是指database的db_unique_name,
而connect identifier is ‘orcl′这里的orcl是指tnsname.ora连接到主库的net service name.
修改Data Guard
DGMGRL> edit configuration pri set connect identifier is "looyudb1";
如何修改?
REMOVE CONFIGURATION [PRESERVE DESTINATIONS];
3 备库
add database "std" as connect identifier is "crmdb2" maintained as physical;
Database "dg" added
--add database 'dg' ,这里的dg是指database的db_unique_name,而as connect identifier is dg这里的dg是指tnsname.ora连接到standby database的net service name.
4启用配置
enable configuration
enable database orcl
enable database dg;
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration
5--执行下面命令后,如果在最后出现Database Status: SUCCESS表示启动成功
DGMGRL> show database verbose orcl
DGMGRL> show database verbose dg
6.检查配置,最后Database Status状态都必须是SUCCESS
DGMGRL> show database orcl
DGMGRL> show database dg
DGMGRL> show configuration verbose
show instance orcl
show instance verbose orcl
show instance dg
show instance verbose dg
DGMGRL> EDIT DATABASE PROD1 SET PROPERTY LogXptMode=SYNC; ---主库
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MaxAvailability; ---主库
修改Data Guard的保护模式
DGMGRL> edit configuration set protection mode as maxperformance;
7、Warning: ORA-16607: one or more databases have failed
show database pri statusreport
STATUS REPORT
INSTANCE_NAME SEVERITY ERROR_TEXT
dydb ERROR ORA-16737: the redo transport service for standby database "std" has an error