- 最后登录
- 2013-2-16
- 在线时间
- 19 小时
- 威望
- 29
- 金钱
- 268
- 注册时间
- 2012-3-13
- 阅读权限
- 10
- 帖子
- 32
- 精华
- 0
- 积分
- 29
- UID
- 292
|
1#
发表于 2012-5-18 23:24:43
|
查看: 6348 |
回复: 3
refer: http://www.itpub.net/thread-1568414-1-1.html
参考MOS的How To Configure Server Side Transparent Application Failover [ID 460982.1] ,弄了N次都不成功,求教育!
[oracle@rac2 ~]$ cat $TNS_ADMIN/listener.ora
LISTENER_RAC2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.yang.com)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.42)(PORT = 1521)(IP = FIRST))
)
)
SID_LIST_LISTENER_RAC2 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
[oracle@rac2 ~]$ cat $TNS_ADMIN/tnsnames.ora
LISTENER_RAC2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.yang.com)(PORT = 1521))
)
)
LISTENER_RAC1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
)
)
LISTENERS_RAC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.yang.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
)
)
RAC2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.yang.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rac.yang.com)
(INSTANCE_NAME = rac2)
)
)
RAC1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rac.yang.com)
(INSTANCE_NAME = rac1)
)
)
[oracle@rac2 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Fri May 18 20:55:39 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
SQL> conn /as sysdba
Connected.
SQL> select name from dba_services;
NAME
--------------------------------------------------------------------------------
SYS$BACKGROUND
SYS$USERS
seeddataXDB
seeddata
racXDB
rac.yang.com
6 rows selected.
SQL> alter system set local_listener=LISTENER_RAC2 sid='rac2';
System altered.
SQL> alter system set local_listener=LISTENER_RAC1 sid='rac1';
System altered.
SQL> alter system set remote_listener=LISTENERS_RAC;
System altered.
[oracle@rac2 ~]$ srvctl add service -d rac -s taf -r rac1,rac2 -P basic
[oracle@rac2 ~]$ srvctl config service -d rac -s taf
taf PREF: rac1 rac2 AVAIL:
[oracle@rac2 ~]$ srvctl start service -d rac -s taf
[oracle@rac2 ~]$ srvctl status service -d rac -s taf
Service taf is running on instance(s) rac1, rac2
[oracle@rac2 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Fri May 18 21:11:35 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
SQL> conn /as sysdba
Connected.
SQL> show parameter service;
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
service_names string
taf, rac.yang.com
1 begin
2 dbms_service.modify_service(service_name => 'taf',
3 goal => DBMS_SERVICE.goal_throughput,
4 aq_ha_notifications => TRUE,
5 failover_method => DBMS_SERVICE.failover_method_basic,
6 failover_type => DBMS_SERVICE.failover_type_select,
7 failover_retries => 180,
8 failover_delay => 5,
9 clb_goal => DBMS_SERVICE.clb_goal_long);
10* end;
SQL> /
PL/SQL procedure successfully completed.
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,service_id from dba_services where name='taf';
NAME SERVICE_ID
--------------- ----------
taf 7
SQL> select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications from dba_services where service_id = 7;
NAME METHOD TYPE RETRIES GOAL CLB_GOAL AQNOT
--------------- ----------- ---------- -------- ---------- -------- -----
taf BASIC SELECT 180 THROUGHPUT LONG YES
[oracle@rhel6 admin]$ tail -12 tnsnames.ora
TAF =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.141)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.142)(PORT = 1521))
)
(LOAD_BALANCE=YES)
(CONNECT_DATA =
(SERVICE_NAME = taf.yang.com)
)
)
[oracle@rhel6 admin]$ sqlplus sys/123456@taf as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 18 23:19:08 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select sid from v$mystat where rownum=1;
SID
----------
129
SQL> col machine for a20
SQL> SELECT MACHINE, FAILOVER_TYPE, FAILOVER_METHOD, FAILED_OVER FROM V$SESSION WHERE SID=129;
MACHINE TYPE METHOD FAI
-------------------- ---------- ----------- ---
rhel6.yang.com NONE NONE NO
|
|