配置Server Side TAF
实验环境:Oracle 11.2.0.4 RAC
参考MOS文档:
How To Configure Server Side Transparent Application Failover (文档 ID 460982.1)
- 1.为设置TAF在RAC集群上新建服务
- 2.启动server_taf服务
- 3.检查确认服务正在运行
- 4.找到刚创建服务的service_id
- 5.根据service_id审查服务的信息
- 6.给服务添加server side failover参数
- 7.再次审查服务可以看到Method, Type和Retries值
- 8.检查已注册的服务的监听信息
- 9.创建网络服务名
- 10.测试TAF功能
1.为设置TAF在RAC集群上新建服务
eg: srvctl add service -d rac -s server_taf -r "rac1,rac2" -P BASIC
使用oracle用户在RAC集群上新建服务server_taf:
[oracle@jyrac1 ~]$ srvctl add service -d jyzhao -s server_taf -r "jyzhao1,jyzhao2" -P BASIC
[oracle@jyrac1 ~]$
注意不能使用grid用户操作,如果使用grid 用户执行的话,会报错:
[grid@jyrac1 ~]$ 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服务
[oracle@jyrac1 ~]$ srvctl start service -d jyzhao -s server_taf
3.检查确认服务正在运行
eg: srvctl config service -d rac
检查确认服务正在运行:
[oracle@jyrac1 ~]$ 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/oracle@192.168.56.160/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/oracle@192.168.56.160/server_taf
[grid@jyrac1 ~]$ sqlplus system/oracle@192.168.56.160/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/oracle@192.168.56.150/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)
)
)
再次测试:
[oracle@jyrac2 admin]$ sqlplus system/oracle@taf
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/oracle@192.168.56.151/server_taf
[grid@jyrac1 ~]$ sqlplus system/oracle@192.168.56.151/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/oracle@tafvip连接。
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)
)
)
再次测试:
[oracle@jyrac2 admin]$ sqlplus system/oracle@tafvip
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列表,可以实现。
配置Server Side TAF的更多相关文章
- IIS负载均衡-Application Request Route详解第二篇:创建与配置Server Farm(转载)
IIS负载均衡-Application Request Route详解第二篇:创建与配置Server Farm 自从本系列发布之后,收到了很多的朋友的回复!非常感谢,同时很多朋友问到了一些问题,有些问 ...
- Eclipse如何新建TOMCAT并配置Server Locations和Publishing属性
Eclipse如何新建TOMCAT并配置Server Locations和Publishing属性 2018年05月08日 23:10:33 ACGkaka_ 阅读数:1269 一.建立TOMCA ...
- springboot配置server相关配置&整合模板引擎Freemarker、thymeleaf&thymeleaf基本用法&thymeleaf 获取项目路径 contextPath 与取session中信息
1.Springboot配置server相关配置(包括默认tomcat的相关配置) 下面的配置也都是模板,需要的时候在application.properties配置即可 ############## ...
- zabbix配置server,proxy,agent架构
author: headsen chen date:2018-10-30 19:49:50 环境: centos 6.8_x86_64 zabbix-server: 192.168.1.130 z ...
- SpringBoot 之配置server 信息
一.修改端口号 spring-boot 默认的端口号是8080,如需修改. 1.新建一个src/main/resources 文件夹 2.在这个文件夹下新建一个application.properti ...
- 基于乐观锁的配置server与XServer的交互
XServer与配置server,配置server保存有XServer的配置文件里的信息. 怎样在项目启动时.让XServer从配置server中获取到自己的配置信息,并达到通信资源的节省与控制. 通 ...
- 在eclipse中配置server和database
配置server,以tomcat为例 点击下图的tag 如果没有,就去这里找: 然后右键:new->server,根据你安装的server选择版本,然后finish就行了 然后你右键那个serv ...
- 部署zabbix,自动发现lnmp环境,监控主机状态,实现 邮件及微信报警(配置server端)
二.配置server端监控 1.监控apache 首先在本机下载模板:https://github.com/rdvn/zabbix-templates/archive/master.zip 该 zi ...
- JBoss 7/WildFly Domain 模式怎样配置 Server 启动的 JVM 參数
本文演示JBoss 7/WildFly Domain 模式怎样配置 Server 启动的 JVM 參数: 例如以下编辑Domain 模式配置文件 domain/configuration/domain ...
随机推荐
- js原生设计模式——2面向对象编程之继承—new类式继承
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8&qu ...
- jquery.cookie实战用法详细解析
Cookie是由服务器端生成,发送给User-Agent(一般是浏览器),浏览器会将Cookie的key/value保存到某个目录下的文本文件内,下次请求同一网站时就发送该Cookie给服务器(前提是 ...
- 处理div 在IE6 IE7 IE8 下不居中的问题
具体处理方式如下:1 .html 顶部加入:DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "h ...
- Android事件处理概述
不管是桌面应用还是手机应用程序,面对最多的就是用户,经常需要处理的就是用户的动作——也就是需要为用户动作提供响应,这种为用户动作提供响应的机制就是事件处理. Android提供了强大的事件处理机制,包 ...
- 我用Cocos2d-x模拟《Love Live!学院偶像祭》的Live场景(四)
[前言和思路整理] 千呼万唤Shǐ出来!最近莫名被基友忽悠着进舰坑了,加上要肝LL活动,又碰上公司项目紧张经常加班,这一章发得比以往时候来得更晚一些,抱歉啊. 上一章我们实现了BeatObjectMa ...
- 介绍一个开源的在线管理SQLServer的小工具--SQLEntMan
近来有许多人问起SQL在线管理的问题,遂将以前用过的一个开源SQL 在线管理工具修改了一下,并分享. 看下效果图: 原项目的地址:http://sourceforge.net/projects/asp ...
- oracle 查询哪些表分区
如果查询当前用户下得分区表:select * from user_tables where partitioned='YES'如果要查询整个数据库中的分区表:select * from dba_tab ...
- Java高级特性之反射
老规矩我们还是先提出几个问题,一门技术必然要能解决一定的问题,才有去学习掌握它的价值 一. 什么是反射? 二.反射能做什么? 一. 什么是反射? 用在Java身上指的是我们可以于运行时加载.探知.使用 ...
- C# winform DatagridView 的简单操作
数据显示操作: dgBill.Columns[0].DataPropertyName = "key1"; dgBill.Columns[1].DataPropertyName = ...
- pureMVC介绍及学习
1 简介 Pure MVC是在基于模型.视图和控制器MVC模式建立的一个轻量级的应用框架,这种开源框架是免费的,它最初是执行的ActionScript 3语言使用的Adobe Flex.Flash ...