failover_mode中的backup选项测试

在RAC client端的tnsnames.ora配置中,常常遇到failover的配置,参数failover_mode,其中很多的参数,例如:backup,type,method,retries,delay。这四个参数都可以被叫做TAF的failover policy,后面三个是经常见到的,而backup比较少见,这篇文章主要介绍一下backup这个选项。下面是online doc上关于backup选项的说明解释。

—————————————————————————————————-

BACKUP 

Specify a different net service name for backup connections.

A backup should be specified when using preconnect to pre-establish connections. 

—————————————————————————————————-

也很容易理解,backup一般和preconnect一起使用,下面介绍一个例子,看看具体的切换情况。

client端的tnsnames.ora配置片段如下:

———————————————————————-

RAC1 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.201.149)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = rac.world)

      (INSTANCE_NAME = rac1)

      (FAILOVER_MODE =

        (BACKUP = rac2)

        (TYPE = SELECT)

        (METHOD = PRECONNECT)

      )

    )

  )

 

RAC2 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.201.150)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = rac.world)

      (INSTANCE_NAME = rac2)

      (FAILOVER_MODE =

        (BACKUP = rac1)

        (TYPE = SELECT)

        (METHOD = PRECONNECT)

      )

    )

  )

———————————————————————–

测试场景:

client端通过RAC1这个片段连接到service_name=rac.world的instance rac1上,也就是rac1节点上。

 

 

Continue reading “failover_mode中的backup选项测试”