oracle auto failover,dg设置auto failover

dg设置auto  failover

auto failover即设置Fast-Start Failover

Enabling fast-start failover does not trigger a failover. Instead, it allows the observer to begin observing the primary and standby databases and initiate a fast-start failover should conditions warrant a failover.

配置步骤:

step 1:if  node >2节点

双节点环境会自动设置FastStartFailoverTarget  使得primary和standby 相互指向对方

If there is more than one standby database in the configuration, you must explicitly set the FastStartFailoverTarget property on the primary database and target standby database to point to each other for the purpose of defining which standby database will be the target of a fast-start failover

在primary显示定义primary和standby相互的依赖关系:

step 2: node>=2 节点

the observer and目标 standby database 均同primary断开连接超出FastStartFailoverThreshold 指定的延时时就启动fast-start failover

设置延时:EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = 45;默认是30秒

step 3:enable fast-start failover

ENABLE FAST_START FAILOVER

ORA-16651: 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 have not been met:

- The Data Guard configuration must be in MaxAvailability protection mode.

***edit configuration set protection mode as MaxAvailability

- The LogXptMode property for both the primary database and the Fast-Start Failover target standby database must be SYNC.

***edit database  orcl set property logxptmode=sync

***ORA-16789: missing standby redo logs

***alter database add standby logfile group 4 '/u01/app/oracle/oradata/orcl/redo04.log' size 50m;

***edit database  norcl set property logxptmode=sync

- The primary database and the Fast-Start Failover target standby database must both have flashback enabled.

***primary   alter database flashback on;

***standby   1、 alter database recover managed standby database 2、alter database flashback on;

- No valid target standby database was specified in the primary database"s FastStartFailoverTarget property prior to the attempt to enable Fast-Start Failover, and more than one standby database exists in the Data Guard configuration.

Step 4:  Start the Observer

DGMGRL> START OBSERVER;

连续的后台进程  dgmgrl中不会返回命令行提示符

ex:

DGMGRL> start observer

Observer started

如果要终止 则需在另一个client或session 中stop observer

step 5:验证

DGMGRL> show configuration

Configuration

Name:                mybroker

Enabled:             YES

Protection Mode:     MaxAvailability

Fast-Start Failover: ENABLED

Databases:

orcl  - Primary database

norcl - Physical standby database

- Fast-Start Failover target

Current status for "mybroker":

Warning: ORA-16607: one or more databases have failed

解决:

standby:recover managed standby database disconnect from session

disable fast_start failover

disable configuration

enable  configuration

enable fast_start failover

DGMGRL> show configuration

Configuration

Name:                mybroker

Enabled:             YES

Protection Mode:     MaxAvailability

Fast-Start Failover: ENABLED

Databases:

orcl  - Primary database

norcl - Physical standby database

- Fast-Start Failover target

Current status for "mybroker":

SUCCESS

DGMGRL>

step 5:测试

注意:observer要在standby主机上启用

disconnect 网卡后

DGMGRL> start observer

Observer started

06:44:52.25  Monday, October 18, 2010

Initiating fast-start failover to database "orcl"...

Performing failover NOW, please wait...

Operation requires shutdown of instance "orcl" on database "orcl"

Shutting down instance "orcl"...

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

Operation requires startup of instance "orcl" on database "orcl"

Starting instance "orcl"...

Unable to connect to database

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Failed.

You are no longer connected to ORACLE

Please connect again.

Unable to start instance "orcl"

You must start instance "orcl" manually

Unable to failover

06:46:16.60  Monday, October 18, 2010

[W000 10/18 06:46:16.61] Failover failed. Quit observer.

Observer stopped

手动启动实例后日志文件输出完成failover

Failover succeeded. Primary database is now orcl.

--failover完了后原primary是no start状态

进入dgmgrl

DGMGRL> connect

Connected.

DGMGRL> show configuration

Configuration

Name:                mybroker

Enabled:             YES

Protection Mode:     MaxAvailability

Fast-Start Failover: ENABLED

Databases:

orcl  - Primary database

norcl - Physical standby database (disabled)

- Fast-Start Failover target

Current status for "mybroker":

Warning: ORA-16607: one or more databases have failed

DGMGRL> disable fast_start failover

Error: ORA-16652: Fast-Start Failover target standby database is disabled

Failed.

DGMGRL> enable database norcl

Error: ORA-16661: the standby database needs to be reinstated

Failed.

DGMGRL> help reinstate

Change a disabled database into a viable standby database

Syntax:

REINSTATE DATABASE ;

DGMGRL> reinstate database norcl

Reinstating database "norcl", please wait...

Error: ORA-16653: failed to reinstate database

Failed.

alert没有能帮助的信息 查看broker自己的日志

../admin/orcl/bdump/drcorcl.log

...

G 2010-10-18-07:04:30        0 2 0 NSV1: Failed to connect to remote database norcl. Error is ORA-01034

DG 2010-10-18-07:04:30        0 2 0 NSV1: Can't send OPEN message to DRCX. Network error is: ORA-01034.

DG 2010-10-18-07:04:30        0 2 0 NSV1: Ending metadata file transmission.

DG 2010-10-18-07:04:30        0 2 0 NSV1: Metadata Resync failed. Status = ORA-01034

DG 2010-10-18-07:04:30  2010000 4 732696705 DMON: Database norcl returned ORA-01034

ORA-01034: ORACLE not available

把这个实例启动到mount

状态仍然是:

SQL> select database_role from v$database;

DATABASE_ROLE

----------------

PRIMARY

运行 reinstate database 来将norcl flashback到failover的scn以将norcl改造成standby database.

DGMGRL> reinstate database norcl

Reinstating database "norcl", please wait...

Operation requires shutdown of instance "orcl" on database "norcl"

Shutting down instance "orcl"...

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

Operation requires startup of instance "orcl" on database "norcl"

Starting instance "orcl"...

Unable to connect to database

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Failed.

You are no longer connected to ORACLE

Please connect again.

Unable to start instance "orcl"

You must start instance "orcl" manually

Reinstatement of database "norcl" failed

日记记录如下:

2697305 DMON: Entered rfm_release_chief_lock for EDIT_RES_PROP

DG 2010-10-18-07:09:19        0 2 0 NSV1: Failed to connect to remote database norcl. Error is ORA-12514

DG 2010-10-18-07:09:19        0 2 0 NSV1: Failed to send message to site norcl. Error code is ORA-12514.

手动启动norcl

DGMGRL>  reinstate database norcl

Reinstating database "norcl", please wait...

Reinstatement of database "norcl" succeeded

ORA-12514的解决

检查每个主机的监听文件 确认实例是否静态监听 且实例名要大写

重新转换一次角色

现在observer 是norcl

DGMGRL> show configuration

Configuration

Name:                mybroker

Enabled:             YES

Protection Mode:     MaxAvailability

Fast-Start Failover: ENABLED

Databases:

orcl  - Primary database

norcl - Physical standby database

- Fast-Start Failover target ---注意。。。

Current status for "mybroker":

.....

注:broker在dgmgrl cli关闭 启动instanc 因此需注意参数local_listener 及监听文件的设置

测试时 手动shutdown instance不会导致broker自动failover 会报:

ORA-16818: Fast-Start Failover suspended Cause: The primary database was intentionally shutdown. As a result, a Fast-Start Failover could not happen automatically.

Action: Start up the primary database. This effectively restores the ability to automatically do a Fast-Start Failover in the event of a failure of the primary database.

做switchover或reinstate后都需手动启动实例?

你可能感兴趣的:(oracle,auto,failover)