ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ORACLE 10g R2 RAC TAF配置与测试

ORACLE 10g R2 RAC TAF配置与测试

原创 Linux操作系统 作者:jifei0611 时间:2009-04-20 13:42:42 0 删除 编辑

ORACLE 10g R2 RAC TAF配置与测试

ORACLE 10g RAC TAF可以在客户端配置,通过配置tnsnames.ora实现,也可以在服务器端配置,通过DBMS_SERVICE包实现,服务器端的会复写客户端的配置.

通过配置客户端tnsnames.ora实现TAF

在客户端的tnsname.ora文件中加入下面的内容

RAC_TAF =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.localdomain)(PORT = 1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.localdomain)(PORT = 1521))

      (LOAD_BALANCE = yes)

    )

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = RAC.WORLD)

      (FAILOVER_MODE =

        (TYPE = SELECT)

        (METHOD = BASIC)

        (RETRIES = 180)

        (DELAY = 5)

      )

    )

  )

测试TAF

D:\>sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on 星期六 4 18 09:55:13 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn system@rac_taf

输入密码:

已连接.

通过下面的语句可能查看当前连接的的是那个实例和failover_type

SQL> col instance_name format a13

SQL> col host_name format a16

SQL> col failover_method format a15

SQL> col failover_type format a13

SQL> col failed_over format a11

SQL> select instance_name ,host_name ,null as failover_type,

    2  null as failover_method ,null as failed_over

    3  from v$instance

    4  union

    5  select null ,null ,failover_type ,failover_method ,failed_over

    6  from v$session

    7  where sid=(select max(sid) from v$mystat)

    8  /

INSTANCE_NAME HOST_NAME        FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER

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

RAC2          rac2.localdomain

                               SELECT        BASIC           NO

通过上面的结果我们可以看到,当前连接实例为:RAC2,没有进行TAF

通过srvctl关闭数据库模拟instance crash

[oracle@rac1 ~]$ srvctl status database -d rac

Instance RAC1 is running on node rac1

Instance RAC2 is running on node rac2

[oracle@rac1 ~]$ srvctl stop instance -d rac -i RAC2 -o abort

[oracle@rac1 ~]$ srvctl status database -d rac

Instance RAC1 is running on node rac1

Instance RAC2 is not running on node rac2

再次运行上面的SQL,如果如下:

SQL> /

INSTANCE_NAME HOST_NAME        FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER

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

RAC1          rac1.localdomain

                               SELECT        BASIC           YES    上面的结果说明了进行了TAF,当前连接实例为RAC1

 

 

通过DBMS_SERVICE包配置TAF

SQL> select name from v$active_services;

NAME

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

RAC.WORLD

SYS$BACKGROUND

SYS$USERS

SQL> begin

2  dbms_service.modify_service

3  (

4  service_name=>'RAC.WORLD',

5  failover_type=>dbms_service.failover_type_select,

6  failover_method=>dbms_service.failover_method_basic,

7  failover_retries=>10,

8  failover_delay=>5

9  );

10  end;

11  /

  重起数据库即可.我在周六做时没有重起,通过发v$session实图看到不能切换,找了一个多小时没有找到问题所在,重起数据库后下班,周一上班时发现可以了.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7419833/viewspace-591006/,如需转载,请注明出处,否则将追究法律责任。

上一篇: RAC ORA_12545错误
下一篇: external table
请登录后发表评论 登录
全部评论

注册时间:2008-01-12

  • 博文量
    143
  • 访问量
    271908