ITPub博客

首页 > 数据库 > Oracle > Service-side TAF

Service-side TAF

原创 Oracle 作者:lovehewenyu 时间:2013-07-29 10:29:27 0 删除 编辑

Service-side TAF

一、 检查是否配置Service-side TAF

1、检查是否配置了Service-side TAF

[grid@dou_rac2 ~]$ srvctl config service -d racdb

[grid@dou_rac2 ~]$                       

--无返回结果,说明没有配置service

2、检查监听中是否注册监听了Service-side TAF 服务

[grid@dou_rac2 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-JUL-2013 17:34:42

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

STATUS of the LISTENER

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

Alias                     LISTENER_SCAN1

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                26-JUL-2013 09:55:30

Uptime                    0 days 7 hr. 39 min. 11 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/app/11.2.0/grid/log/diag/tnslsnr/dou_rac2/listener_scan1/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))

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

Services Summary...

Service "racdb" has 2 instance(s).

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

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

Service "racdbXDB" has 1 instance(s).

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

The command completed successfully

--service未注册到监听中

二、添加Service-side TAF --oracle用户执行

[oracle@dou_rac2 ~]$ srvctl add service -d racdb -s racdb_taf -r racdb1,racdb2 -P BASIC -e SELECT -m BASIC -w 10 -z 1000

 

三、检查是否配置成功,未启动则开启服务

[oracle@dou_rac2 ~]$ srvctl config service -d racdb

服务名: racdb_taf

服务已启用

服务器池: racdb_racdb_taf

基数: 2

断开连接:

服务角色: PRIMARY

管理策略: AUTOMATIC

DTP 事务处理:

AQ HA 通知:

故障转移类型: SELECT

故障转移方法: BASIC

TAF 故障转移重试次数: 1000

TAF 故障转移延迟: 10

连接负载平衡目标: LONG

运行时负载平衡目标: NONE

TAF 策略规范: BASIC

首选实例: racdb1,racdb2

可用实例:

 

查看是否开启Service-side TAF服务

[grid@dou_rac2 ~]$ srvctl status service -d racdb

服务 racdb_taf 未运行。

 

检查LISTENER_SCAN1中也是否注册了Service-side TAF服务

[grid@dou_rac2 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-JUL-2013 17:43:01

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

STATUS of the LISTENER

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

Alias                     LISTENER_SCAN1

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                26-JUL-2013 09:55:30

Uptime                    0 days 7 hr. 47 min. 30 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/app/11.2.0/grid/log/diag/tnslsnr/dou_rac2/listener_scan1/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))

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

Services Summary...

Service "racdb" has 2 instance(s).

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

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

Service "racdbXDB" has 1 instance(s).

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

The command completed successfully

--监听中未注册Service-side TAF服务

 

开启Service

[grid@dou_rac2 ~]$ srvctl start service -d racdb

查看Service运行状态

[grid@dou_rac2 ~]$ srvctl status service -d racdb

服务 racdb_taf 正在实例 racdb1 上运行

 

查看LISTENER_SCAN1状态

[grid@dou_rac2 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-JUL-2013 17:49:10

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

STATUS of the LISTENER

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

Alias                     LISTENER_SCAN1

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                26-JUL-2013 09:55:30

Uptime                    0 days 7 hr. 53 min. 39 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/app/11.2.0/grid/log/diag/tnslsnr/dou_rac2/listener_scan1/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))

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

Services Summary...

Service "racdb" has 2 instance(s).

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

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

Service "racdbXDB" has 1 instance(s).

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

Service "racdb_taf" has 1 instance(s).

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

The command completed successfully

-- Service racdb_taf已经注册到LISTENER_SCAN1

 

自动开启service,数据库启动时自动开启所有的service

[oracle@dou_rac2 admin]$ srvctl enable service -d racdb -s racdb_taf -i racdb1

[oracle@dou_rac2 admin]$ srvctl enable service -d racdb -s racdb_taf -i racdb2

--配置一个节点自动启动service即可,当然2个也可以

重启之后的service状态

[grid@dou_rac2 ~]$ srvctl status service -d racdb

服务 racdb_taf 正在实例 racdb1,racdb2 上运行

[grid@dou_rac2 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-JUL-2013 18:44:17

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

STATUS of the LISTENER

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

Alias                     LISTENER_SCAN1

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                26-JUL-2013 18:40:03

Uptime                    0 days 0 hr. 4 min. 14 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/app/11.2.0/grid/log/diag/tnslsnr/dou_rac2/listener_scan1/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))

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

Services Summary...

Service "racdb" has 2 instance(s).

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

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

Service "racdbXDB" has 2 instance(s).

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

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

Service "racdb_taf" has 2 instance(s).

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

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

The command completed successfully

 

四、修改客户端tnsnames.ora 

客户端使用service-side TAF,需要修改一下tnsnames.ora

RACDB =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = dou_rac-scan)(PORT = 1521))

    (CONNECT_DATA =

      (SERVICE = DEDICATED)

      (SERVICE_NAME = racdb_taf)  

    )

  )

  --racdb修改成racdb_taf服务名

Service-side TAF测试

[oracle@dou_rac2 admin]$ sqlplus xiaoyu/oracle@racdb

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 26 17:56:45 2013

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

 

SQL> show parameter service

NAME                                 TYPE        VALUE

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

service_names                        string      racdb_taf

 

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

请登录后发表评论 登录
全部评论
10年老鸟,Oracle,Mysql,EMC 存储,NBU备份

注册时间:2012-02-03

  • 博文量
    268
  • 访问量
    1296431