[20140422]使用dgmgrl管理dataguard(11).txt
参考链接:
http://blog.itpub.net/267265/viewspace-1142649/
http://blog.itpub.net/267265/viewspace-1143027/
http://blog.itpub.net/267265/viewspace-1143058/
http://blog.itpub.net/267265/viewspace-1143126/
http://blog.itpub.net/267265/viewspace-1143480/
http://blog.itpub.net/267265/viewspace-1144742/
http://blog.itpub.net/267265/viewspace-1145573/
http://blog.itpub.net/267265/viewspace-1145697/
http://blog.itpub.net/267265/viewspace-1145727/
http://blog.itpub.net/267265/viewspace-1146558/
-- 我的测试环境:primary的tnsnames别名test,standby主机的tnsnames别名testdg。数据库版本:
-- 前面的测试要设置在MaxAvailability模式,LogXptMode='SYNC',按照文档的介绍在MaxPerformance也可以,再做一个测试看看.
DGMGRL> show configuration
Configuration - study
Protection Mode: MaxAvailability
Databases:
test - Primary database
testdg - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
DGMGRL> disable FAST_START FAILOVER
Disabled.
DGMGRL> edit configuration SET PROTECTION MODE AS MaxPerformance;
Succeeded.
--修改为MaxPerformance mode.
DGMGRL> enable fast_start failover
Error: ORA-16651: requirements not met for enabling fast-start failover
Failed.
$ oerr ora 16651
16651, 0000, "requirements not met for enabling fast-start failover"
// *Cause: The attempt to enable fast-start failover could not be completed
// because one or more requirements were not met:
// - The Data Guard configuration must be in either MaxAvailability
// or MaxPerformance protection mode.
// - The LogXptMode property for both the primary database and
// the fast-start failover target standby database must be
// set to SYNC if the configuration protection mode is set to
// MaxAvailability mode.
// - The LogXptMode property for both the primary database and
// the fast-start failover target standby database must be
// set to ASYNC if the configuration protection mode is set to
// MaxPerformance mode.
// - The primary database and the fast-start failover target standby
// database must both have flashback enabled.
// - No valid target standby database was specified in the primary
// database FastStartFailoverTarget property prior to the attempt
// to enable fast-start failover, and more than one standby
// database exists in the Data Guard configuration.
// *Action: Retry the command after correcting the issue:
// - Set the Data Guard configuration to either MaxAvailability
// or MaxPerformance protection mode.
// - Ensure that the LogXptMode property for both the primary
// database and the fast-start failover target standby database
// are set to SYNC if the configuration protection mode is set to
// MaxAvailability.
// - Ensure that the LogXptMode property for both the primary
// database and the fast-start failover target standby database
// are set to ASYNC if the configuration protection mode is set to
// MaxPerformance.
// - Ensure that both the primary database and the fast-start failover
// target standby database have flashback enabled.
// - Set the primary database FastStartFailoverTarget property to
// the DB_UNIQUE_NAME value of the desired target standby database
// and the desired target standby database FastStartFailoverTarget
// property to the DB_UNIQUE_NAME value of the primary database.
--MaxPerformance mode下,设置LogXptMode必须是ASYNC,why? 搞不懂为什么要这样?
DGMGRL> show database test LogXptMode
LogXptMode = 'SYNC'
DGMGRL> show database testdg LogXptMode
LogXptMode = 'SYNC'
DGMGRL> edit database test set PROPERTY LogXptMode='ASYNC';
Property "logxptmode" updated
DGMGRL> edit database testdg set PROPERTY LogXptMode='ASYNC';
Property "logxptmode" updated
DGMGRL> show database verbose test FastStartFailoverTarget ;
FastStartFailoverTarget = 'testdg'
DGMGRL> show database verbose testdg FastStartFailoverTarget ;
FastStartFailoverTarget = 'test'
DGMGRL> enable fast_start failover
Enabled.
DGMGRL> show configuration
Configuration - study
Protection Mode: MaxPerformance
Databases:
test - Primary database
testdg - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
--OK,FSFO配置成功.
查看Observer的信息.
09:10:37.19 Tuesday, April 22, 2014
Initiating Fast-Start Failover to database "testdg"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "testdg"
09:10:47.89 Tuesday, April 22, 2014
SYS@testdg> select database_role,open_mode,protection_mode,force_logging,FLASHBACK_ON from v$database;
DATABASE_ROLE OPEN_MODE PROTECTION_MODE FOR FLASHBACK_ON
---------------- -------------------- -------------------- --- ------------------
PRIMARY READ WRITE MAXIMUM PERFORMANCE YES YES
SYS@testdg> select * from scott.dept1 where deptno=60;
DEPTNO DNAME LOC
---------- -------------- -------------
60 MMMM DDDDDD
DGMGRL> show configuration
Configuration - study
Protection Mode: MaxPerformance
Databases:
testdg - Primary database
Warning: ORA-16829: fast-start failover configuration is lagging
test - (*) Physical standby database (disabled)
ORA-16661: the standby database needs to be reinstated
--重新启动reinstated后,一切正常.
Fast-Start Failover: ENABLED
Configuration Status:
WARNING
DGMGRL> show configuration
Configuration - study
Protection Mode: MaxPerformance
Databases:
testdg - Primary database
test - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
DGMGRL> switchover to test;
Performing switchover NOW, please wait...
New primary database "test" is opening...
Operation requires shutdown of instance "testdg" on database "testdg"
Shutting down instance "testdg"...
ORACLE instance shut down.
Operation requires startup of instance "testdg" on database "testdg"
Starting instance "testdg"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "test"
DGMGRL> show configuration
Configuration - study
Protection Mode: MaxPerformance
Databases:
test - Primary database
testdg - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
总结:
不知道为什么MaxPerformance mode下,设置LogXptMode必须是ASYNC,才能使用FSFO.