配置Server Side TAF

实验环境:Oracle 11.2.0.4 RAC
参考MOS文档:
How To Configure Server Side Transparent Application Failover (文档 ID 460982.1)

1.为设置TAF在RAC集群上新建服务

eg: srvctl add service -d rac -s server_taf -r "rac1,rac2" -P BASIC

使用oracle用户在RAC集群上新建服务server_taf:

[[email protected] ~]$ srvctl add service -d jyzhao -s server_taf -r "jyzhao1,jyzhao2" -P BASIC
[[email protected] ~]$ 

注意不能使用grid用户操作,如果使用grid 用户执行的话,会报错:

[[email protected] ~]$ srvctl add service -d jyzhao -s server_taf -r "jyzhao1,jyzhao2" -P BASIC
PRCD-1288 : User is not authorized to create service server_taf for database jyzhao
PRKH-1014 : Current user "grid" is not the oracle owner user "oracle" of oracle home "/opt/app/oracle/product/11.2.0/dbhome_1"

2.启动server_taf服务

eg: srvctl start service -d rac -s server_taf

启动server_taf服务

[[email protected] ~]$ srvctl start service -d jyzhao -s server_taf

3.检查确认服务正在运行

eg: srvctl config service -d rac

检查确认服务正在运行:

[[email protected] ~]$ srvctl config service -d jyzhao
Service name: server_taf
Service is enabled
Server pool: jyzhao_server_taf
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: jyzhao1,jyzhao2
Available instances: 

4.找到刚创建服务的service_id

eg: select name,service_id from dba_services where name = ‘server_taf‘;

找到刚创建服务的service_id

SQL> select name,service_id from dba_services where name = ‘server_taf‘; 

NAME                                                             SERVICE_ID
---------------------------------------------------------------- ----------
server_taf                                                                7

5.根据service_id审查服务的信息

col name format a15
col failover_method format a11 heading ‘METHOD‘
col failover_type format a10 heading ‘TYPE‘
col failover_retries format 9999999 heading ‘RETRIES‘
col goal format a10
col clb_goal format a8
col AQ_HA_NOTIFICATIONS format a5 heading ‘AQNOT‘

select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications
from dba_services where service_id = 7;

根据service_id审查服务的信息:

SQL> col name format a15
SQL> col failover_method format a11 heading ‘METHOD‘
SQL> col failover_type format a10 heading ‘TYPE‘
SQL> col failover_retries format 9999999 heading ‘RETRIES‘
SQL> col goal format a10
SQL> col clb_goal format a8
SQL> col AQ_HA_NOTIFICATIONS format a5 heading ‘AQNOT‘
SQL> select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications
  2  from dba_services where service_id = 7
  3  ;

NAME            METHOD      TYPE        RETRIES GOAL       CLB_GOAL AQNOT
--------------- ----------- ---------- -------- ---------- -------- -----
server_taf      NONE        NONE              0 NONE       LONG     NO

SQL> 

6.给服务添加server side failover参数

execute dbms_service.modify_service (service_name => ‘server_taf‘ -
, aq_ha_notifications => true -
, failover_method => dbms_service.failover_method_basic -
, failover_type => dbms_service.failover_type_select -
, failover_retries => 180 -
, failover_delay => 5 -
, clb_goal => dbms_service.clb_goal_long);

11.2版本可以使用srvctl 修改服务的信息:
srvctl modify service -d RAC -s server_taf -m BASIC -e SELECT -q TRUE -j LONG

给服务添加server side failover参数:

SQL> execute dbms_service.modify_service (service_name => ‘server_taf‘ -
> , aq_ha_notifications => true -
> , failover_method => dbms_service.failover_method_basic -
> , failover_type => dbms_service.failover_type_select -
> , failover_retries => 180 -
> , failover_delay => 5 -
> , clb_goal => dbms_service.clb_goal_long); 

PL/SQL procedure successfully completed.

7.再次审查服务可以看到Method, Type和Retries值

select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications
from dba_services where service_id = 7;

再次审查服务可以看到Method, Type和Retries值:

SQL> select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications
  2  from dba_services where service_id = 7;

NAME            METHOD      TYPE        RETRIES GOAL       CLB_GOAL AQNOT
--------------- ----------- ---------- -------- ---------- -------- -----
server_taf      BASIC       SELECT          180 NONE       LONG     YES

8.检查已注册的服务的监听信息

lsnrctl services

Service "server_taf.za.oracle.com" has 2 instance(s).
Instance "rac1", status READY, has 2 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=dell01)(PORT=1521))
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Instance "rac2", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=dell02)(PORT=1521))

我这里版本差异,显示有区别,分别在不同节点显示自己的实例:

--node1:
Service "server_taf" has 1 instance(s).
  Instance "jyzhao1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully

--node2:
Service "server_taf" has 1 instance(s).
  Instance "jyzhao2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully

9.创建网络服务名

SERVERTAF =
(DESCRIPTION =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = dell01)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = dell02)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = server_taf.za.oracle.com)
)
)

服务端RAC所有节点配置tnsnames.ora,添加内容:

SERVERTAF =
  (DESCRIPTION =
    (LOAD_BALANCE = yes)
    (ADDRESS = (PROTOCOL = TCP)(HOST = jyrac1)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = jyrac2)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = server_taf)
    )
  )

sqlplus system/[email protected]/server_taf

10.测试TAF功能

select host_name,instance_name from v$instance;

SQL> select instance_name from V$instance;
INSTANCE_NAME
----------------
rac2

SQL> shutdown abort;
ORACLE instance shut down.

select host_name,instance_name from v$instance;

10.1 模拟客户端使用scanVIP测试能否实现TAF
sqlplus system/[email protected]/server_taf

[[email protected] ~]$ sqlplus system/[email protected]/server_taf

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 10 02:59:53 2017

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select host_name,instance_name from v$instance;

HOST_NAME
----------------------------------------------------------------
INSTANCE_NAME
----------------
jyrac1
jyzhao1

--这里强制关掉jyzhao1实例。

SQL> /

HOST_NAME
----------------------------------------------------------------
INSTANCE_NAME
----------------
jyrac2
jyzhao2

10.1 结论: 可以实现TAF功能,相当于客户端不再需要配置,直接通过SCAN VIP连接。

10.2 模拟客户端使用Public IP测试能否实现TAF
sqlplus system/[email protected]/server_taf

SQL>  select host_name,instance_name from v$instance;

HOST_NAME
----------------------------------------------------------------
INSTANCE_NAME
----------------
jyrac1
jyzhao1

--这里强制关掉jyzhao1实例。
SQL> /
 select host_name,instance_name from v$instance
*
ERROR at line 1:
ORA-12153: TNS:not connected
Process ID: 20116
Session ID: 24 Serial number: 7

如果客户端配置tnsnames.ora,将publicIP配置

TAF =
  (DESCRIPTION =
    (LOAD_BALANCE = yes)
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.150)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.152)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = server_taf)
    )
  )

再次测试:

[[email protected] admin]$ sqlplus system/[email protected]

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 10 05:11:30 2017

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select host_name,instance_name from v$instance;

HOST_NAME
----------------------------------------------------------------
INSTANCE_NAME
----------------
jyrac2
jyzhao2

--这里强制关掉jyzhao2实例。
SQL> /

HOST_NAME
----------------------------------------------------------------
INSTANCE_NAME
----------------
jyrac1
jyzhao1

10.2 结论: 直接连接Public IP无法实现TAF功能。但客户端配置Public IP列表,可以实现。

10.3 模拟客户端使用VIP测试能否实现TAF
sqlplus system/[email protected]/server_taf

[[email protected] ~]$ sqlplus system/[email protected]/server_taf

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 10 04:32:20 2017

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select host_name,instance_name from v$instance;

HOST_NAME
----------------------------------------------------------------
INSTANCE_NAME
----------------
jyrac1
jyzhao1

SQL> /
select host_name,instance_name from v$instance
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 32459
Session ID: 159 Serial number: 3

如果客户端配置tnsnames.ora,可以通过sqlplus system/[email protected]连接

TAFVIP =
  (DESCRIPTION =
    (LOAD_BALANCE = yes)
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.151)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.153)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = server_taf)
    )
  )

再次测试:

[[email protected] admin]$ sqlplus system/[email protected]

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 10 05:15:32 2017

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select host_name,instance_name from v$instance;

HOST_NAME
----------------------------------------------------------------
INSTANCE_NAME
----------------
jyrac2
jyzhao2

--这里强制关掉jyzhao2实例。
SQL> /

HOST_NAME
----------------------------------------------------------------
INSTANCE_NAME
----------------
jyrac1
jyzhao1

10.3 结论: 直接连接VIP无法实现TAF功能。但客户端配置VIP列表,可以实现。

时间: 2024-08-27 05:35:23

配置Server Side TAF的相关文章

在eclipse中配置server和database

http://www.cnblogs.com/qrlozte/p/3175170.html ******************************************* 配置server,以tomcat为例 点击下图的tag 如果没有,就去这里找: 然后右键:new->server,根据你安装的server选择版本,然后finish就行了 然后你右键那个server可以选择start/stop,跟tomcat本身的startup.bat和shutdown.bat效果是一样的 //===

eclipse配置server没有Apache tomcat 7.0

eclipse配置server没有Apache tomcat 7.0 原因:eclipse中WTP版本太低了 解决方案: 换成高版本就有行了 eclipse配置server没有Apache tomcat 7.0,布布扣,bubuko.com

JBoss 7/WildFly Domain 模式如何配置 Server 启动的 JVM 参数

本文演示JBoss 7/WildFly Domain 模式如何配置 Server 启动的 JVM 参数: 如下编辑Domain 模式配置文件 domain/configuration/domain.xml,在 <server-groups> 部分添加如下配置项: <server-groups> <server-group name="main-server-group" profile="full"> <jvm name=&

配置server禁止全部非法域名 訪问自己的server

1.Apache2.4.1曾经: 第一种 直接拒绝訪问 打开 httpd.conf  文件,将一下配置追加到文件最后. #直接拒绝全部非法域名 <VirtualHost *:80> ServerName * ServerAlias * <Location /> Order Allow,Deny Deny from all </Location> ErrorLog "/alidata/log/httpd/error.log" CustomLog &qu

01.配置server.xml 使用虚拟主机可以将项目部署成顶级域名

1 使用虚拟主机可以将项目部署成顶级域名 2 3 1.在server.xml文件 4 1.端口修改为80 5 2. 配置主机 6 <Host name="www.customer.com" appBase="D:\java1110\workspace\day19_2" 7 unpackWARs="true" autoDeploy="true"> 8 9 10 <Valve className="or

问题:eclipse配置server以后启动正常,但localhost:8080访问失败

现像:eclipse-->services tab-->添加server,启动正常,但是http://localhost:8080访问失败,返回值为404 解决:双击server,进入配置页面,如下图, 选中红框内的radio,重启server,问题解决.

AcoustID音频指纹环境配置--Server

配置AcoustID开源项目的Server端,包括两部分内容:acoustid-server和acoustid-index. 分别参考https://bitbucket.org/acoustid/acoustid-server https://bitbucket.org/acoustid/acoustid-index ###acoustid-server配置### #下载源代码,安装依赖包 git clone https://bitbucket.org/acoustid/acoustid-ser

Nginx 笔记与总结(4)配置 server 访问日志

打开 nginx.conf: [[email protected] ~]# cd /usr/local/nginx/conf [[email protected] conf]# vim nginx.conf 在默认的 server 段中包含以下内容: #access_log logs/access.log main; 表示该 server 的访问日志文件是 logs/access.log Nginx 允许针对不同的 server 做不同的 log main 表示日志使用的格式是 'main' 格

配置server.xml后,启动tomcat 失败(Unable to start cluster)及解决方法

在配置负载均衡环境过程中修改server.xml  后重启tomcat报错,报错信息如下 [[email protected] bin]# ./catalina.sh runUsing CATALINA_BASE: /usr/local/TC6_AUsing CATALINA_HOME: /usr/local/TC6_AUsing CATALINA_TMPDIR: /usr/local/TC6_A/tempUsing JRE_HOME: /usr/java/jdk1.6.0_45Using CL