As we know If a node in the RAC environment is crashed or shutdown abnormally.We can adopt to use the DBCA to generate a TAF service to achieve the failover between two or more nodes in the Real application cluster environment. For example i have two nodes rac environment with a created TAF service named "IRMDBTEST' before(RAC1 with preferred mode,RAC2 with available mode). Suppose RAC1 is crashed in some time and another nodes(rac2) will take over the request from client. After RAC1 is turned back, TAF service will not automaticly redirec the preferred instance. So we have to deal with this matter by ousrselves.
But how to do it?
In RAC1
---------
rac1-> crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.irmdb.db application ONLINE ONLINE rac2
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application ONLINE ONLINE rac2
ora....test.cs application ONLINE ONLINE rac1
ora....db1.srv application ONLINE ONLINE rac2
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
rac1-> srvctl start instance -d irmdb -i irmdb1
rac1-> sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 15 21:25:35 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> connsystem/passw0rd@irmdbtest;
Connected.
SQL> select instance_name,instance_number,host_name,status from v$instance;
INSTANCE_NAME INSTANCE_NUMBER
---------------- ---------------
HOST_NAME STATUS
---------------------------------------------------------------- ------------
irmdb2 2
rac2.cn.ibm.com OPEN
SQL> show parameter service_name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string irmdb.cn.ibm.com, irmdbtest
SQL> quit;
rac1-> export ORACLE_SID=irmdb1
rac1-> sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 15 21:27:17 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba;
Connected.
SQL> show parameter service_name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string irmdb.cn.ibm.com
In RAC2:
---------
rac2-> export ORACLE_SID=irmdb2
rac2-> sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 15 21:28:20 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba;
Connected.
SQL> show parameter service_name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string irmdb.cn.ibm.com, irmdbtest
--how to switch to irmdb1?
rac1->srvctl relocate service -d irmdb -s irmdbtest -i irmdb2 -t irmdb1
rac1-> sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 15 21:30:31 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> connsystem/passw0rd@irmdb1
Connected.
SQL> show parameter service;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string irmdb.cn.ibm.com, irmdbtest
SQL> connsystem/passw0rd@irmdb2
Connected.
SQL> show parameter service;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string irmdb.cn.ibm.com