oracle 10g failover,oracle 10g rac failover(service-side TAF)

1,Server-Side TAF具有TAF的所有特点

2,Client-Side TAF 是在客户端修改tnsnames.ora 文件来配置的,如果有很多客户端使用这个数据库,那么每次微调整都需要把所有的客户端修改一遍,既低效又容易出错。而Service-Side TAF 通过结合Service,在数据库里保存FAIL_MODE的配置,把所有的TAF配置保存在数据字典中,从而省去了客户端的配置工作,客户端的配置则不需要进行任何改动

从配置参数而言,Service-Side TAF和TAF 相比多了一个Instance Role(实例角色)的概念。 所谓的实例角色,就是当有多个Instance 参与一个Service时,可以配置优先使用哪一个Instance为用户提供服务。用户共有两种可选角色。

PREFERRED:首选实例,会优先选择拥有这个角色的实例提供服务。

AVAILABLE: 后备实例,用户连接会优先连接PREFFERRED的Instance,当PREFERRED的Instance不可用时,才会被转到AVAILBALE的Instance上。

要使用Server-Side TAF必须配置Service。 Service 可以在创建数据库时创建,也可以在创建数据库之后修改,既可以使用dbca 配置向导,也可以用命令行的方式配置。

具体配置步骤

1,首先增加一个service,可以使用dbca或者使用命令行

使用命令行方式

srvctl add service -d hnzz -s STAF -r hnzz1 -a hnzz2 -P basic  为dbname为hnzz的数据库创建一个名称为SerTAF的service,hnzz1为首选实例,hnzz2为后备实例,TAF Policy为basic

srvctl start service -d hnzz -s STAF 启动刚创建的service

2,可以使用下面的命令查看创建的结果

$ srvctl config service -d hnzz -s STAF

SerTAF PREF: hnzz1 AVAIL: hnzz2

3,用service TAF 修改配置,需要用dbms_service.modify_service包。

begin

dbms_service.modify_service(

service_name=>'STAF',

failover_method =>dbms_service.failover_method_basic,

failover_type =>dbms_service.failover_type_select,

failover_retries =>180,

failover_delay=>5);

end;

/

4,确认修改已经生效

select NAME,FAILOVER_METHOD,FAILOVER_TYPE,FAILOVER_DELAY from dba_services where NAME='STAF';

5,数据库启动时,会自动启动所有的Service。有时为了为了维护需要,需要禁用这个特性,在维护完成后再启动这个特性。

srvctl enable service -d hnzz -s STAF

查看监听状态

[oracle@node1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 17-FEB-2014 09:53:35

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

STATUS of the LISTENER

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

Alias                     LISTENER_NODE1

Version                   TNSLSNR for Linux: Version 10.2.0.5.0 - Production

Start Date                17-FEB-2014 08:35:03

Uptime                    0 days 1 hr. 18 min. 32 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /oracle/app/product/10.2.0/db_1/network/admin/listener.ora

Listener Log File         /oracle/app/product/10.2.0/db_1/network/log/listener_node1.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.114.151)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.114.131)(PORT=1521)))

Services Summary...

Service "+ASM" has 1 instance(s).

Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...

Service "+ASM_XPT" has 1 instance(s).

Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service...

Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "STAF" has 1 instance(s).

Instance "hnzz2", status READY, has 1 handler(s) for this service...

Service "hnzz" has 1 instance(s).

Instance "hnzz2", status READY, has 1 handler(s) for this service...

Service "hnzzXDB" has 1 instance(s).

Instance "hnzz2", status READY, has 1 handler(s) for this service...

Service "hnzz_XPT" has 1 instance(s).

Instance "hnzz2", status READY, has 1 handler(s) for this service...

The command completed successfully

查看数据库中的service

SQL> show parameter service;

NAME                                 TYPE        VALUE

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

service_names                        string      STAF

客户端的tnsnames.ora的配置如下

HNZZ =

(DESCRIPTION =

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

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

(LOAD_BALANCE = yes)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = STAF)

)

)

oracle 10g failover,oracle 10g rac failover(service-side TAF)_第1张图片

图中的两个是我在关闭实例1之前和之后的链接状态

二,删除service

1,首先停止service

srvctl stop service -d hnzz -s STAF

禁用开机启动

srvctl disable service -d hnzz -s STAF

2,删除服务

srvctl remove service -d hnzz -s STAF

$ srvctl remove service -d hnzz -s STAF

STAF PREF: hnzz1 AVAIL: hnzz2

Service STAF is disabled.

Remove service STAF from the database hnzz? (y/[n]) Y

3,查看数据字典中的信息

select name,failover_method,failover_type,goal,clb_goal from dba_services;

4,从数据字典中删除service

begin

dbms_service.delete_service(service_name=>'STAF');

end;

/

删除名称为SerTAF的服务

阅读(1161) | 评论(0) | 转发(0) |

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