一、修改客户端服务器hosts记录
192.168.1.240 rac01
192.168.1.241 rac02
192.168.1.242 rac01-vip
192.168.1.243 rac02-vip
108.88.3.240 rac01-priv
108.88.3.241 rac02-priv
二、新建一条Tnsname 纪录
编辑客户端:tnsnames.ora 文件,增加如下:
RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac02-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac01-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
(FAILOVER_MODE=
(TYPE = session)
(METHOD = basic)
(RETRIES = 180)
(DELAY = 5)
)
)
)
三、测试RAC Failover
1、RAC状态
[oracle@rac01 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE rac01
ora....01.lsnr application ONLINE ONLINE rac01
ora.rac01.gsd application ONLINE ONLINE rac01
ora.rac01.ons application ONLINE ONLINE rac01
ora.rac01.vip application ONLINE ONLINE rac01
ora....SM2.asm application ONLINE ONLINE rac02
ora....02.lsnr application ONLINE ONLINE rac02
ora.rac02.gsd application ONLINE ONLINE rac02
ora.rac02.ons application ONLINE ONLINE rac02
ora.rac02.vip application ONLINE ONLINE rac02
ora.racdb.db application ONLINE ONLINE rac01
ora....b1.inst application ONLINE ONLINE rac01
ora....b2.inst application ONLINE ONLINE rac02
[oracle@rac01 ~]$
2、客户端连接测试
[oracle@rac01 ~]$ sqlplus /nolog
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Jul 16 21:59:20 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL> conn system/oracle@racdb
Connected.
SQL> select instance_name from v$instance;
INSTANCE_NAME
--------------------------------
racdb1
SQL>
3、关闭节点racdb1实例
[oracle@rac01 ~]$ sqlplus '/ as sysdba';
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Jul 16 22:00:17 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> shutdown abort
ORACLE instance shut down.
SQL>
4、在原来客户端的会话上执行连妆测试,
SQL> conn system/oracle@racdb
Connected.
SQL> select instance_name from v$instance;
INSTANCE_NAME
--------------------------------
racdb1
SQL> /
select instance_name from v$instance
*
ERROR at line 1:
ORA-25408: can not safely replay call
SQL> /
INSTANCE_NAME
--------------------------------
racdb2
SQL>
结论:在RAC环境中,同一会话,当前会话连接节点实例故障,可以快速的切替的另一节中运行,对客户端的是完全透明的。
阅读(4623) | 评论(0) | 转发(1) |