??????4?????????????????
????????????????sqlplus???????????2?????
????SQL*Plus: Release 11.1.0.7.0 - Production on Sun Sep 12 21:24:55 2010
????Copyright (c) 1982?? 2008?? 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> show parameter instance_name
????NAME         TYPE        VALUE
????--------------------- --------------- -------------------
????instance_name   string      racdb1
????????????????sqlplus???????????2?????
????SQL*Plus: Release 11.1.0.7.0 - Production on Sun Sep 12 21:31:53 2010
????Copyright (c) 1982?? 2008?? 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> show parameter instance_name
????NAME         TYPE        VALUE
????-------------------- --------------  ------------------
????instance_name  string      racdb2
?????????????????????????sqlplus???????????????????????????????racdb1??racdb2???仯???????????RAC????????????????
????2. ???????????????
???????????????????????????????????????????????????????????????????????RAC???????и???????????????????????????????????????????μ?????????????????RAC???????????????????????????????????Oracle 10g?????????????????????????RAC?и???????????????????????μ????????????и???????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????PMON????????????μ??PMON?????3?????????????????????????????д??service_register?У??????????????仯?????????????????????????????????????????μ????????????????????????????????RAC??????????????????????
????????????????????????????????????????tnsnames.ora???????????????????????????м?????????????????????????????remote_listener???ɡ?
??????1?????????????tnsnames.ora
??????????????????????
????LISTENERS_RACDB =
????(ADDRESS_LIST =
????(ADDRESS = (PROTOCOL = TCP)(HOST = node-vip2)(PORT = 1521))
????(ADDRESS = (PROTOCOL = TCP)(HOST = node-vip1)(PORT = 1521))
????)
??????2????????remote_listener
??????RAC?????????remote_listener??
????SQL> show parameter remote_listener
????NAME           TYPE      VALUE
????---------------       -----------   -----------
????remote_listener   string   LISTENERS_RACDB
?????????????remote_listener????????“LISTENERS_RACDB”???
???????remote_listener?????????????????????????????????remote_listener??????
????SQL> alter system set remote_listener='LISTENERS_RACDB' sid='node-rac1';
????SQL> alter system set remote_listener='LISTENERS_RACDB' sid='node-rac2';
???????????????????????????????????
???????? ??????????л?????
??????????????л???Transparent Application Failover??TAF????????????????????TAF?????????????????л??????????????????????????????????????????????????????????????????????ó???????????????????????????????????????????????????????ó????????????
????????TAF????????????????tnsnames.ora????е????ü??????????????????????????????????????????TAF????????????????£?
RACDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node-vip2)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node-vip1)(PORT = 1521))
(LOAD_BALANCE = yes)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
(FAILOVER_MODE =
(TYPE=SELECT)
(MODE=BASIC)
(RETRY=3)
(DEALY=5)
)
)
)
???????е????????????????£?
????TYPE?????????FAILOVER_MODE?????????3???????????????SESSION??SELECT??NONE??
????SESSION????????????????????????????????????????????????л?????????????????????ó?????????η?????????????????????????????е?SQL?????????С?
????SELECT???????????????????????????????????α???????????????SELECT?????????????????????????С?
????NONE???????????????????????SQL???????
????MODE?????????????????????????????BASIC??PRECONNECT??
????BASIC??????????????????????????????????????????????????????????y??
????PRECONNECT?????????????????????????????y??
????RETRY???????????????????л??????????????y????????
????DELAY????????γ????????????????
??????????????????????????????????????????????
????SQL*Plus: Release 11.1.0.7.0 - Production on Sun Sep 12 23:23:15 2010
????Copyright (c) 1982?? 2008?? 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> COLUMN instance_name FORMAT a10
????SQL> COLUMN host_name FORMAT a10
????SQL> COLUMN failover_method FORMAT a15
????SQL> COLUMN failed_over FORMAT a10
????SQL> SELECT instance_name?? host_name?? NULL AS failover_type?? NULL AS failover_method?? NULL AS failed_over FROM v$instance UNION SELECT NULL?? NULL?? failover_type ?? failover_method?? failed_over FROM v$session WHERE username = 'SYSTEM';
????INSTANCE_ NAME  HOST_NAME   FAILOVER_TYPE   FAILOVER_METHOD   FAILED_OVER
????-------------         ------------------    -------------       ---------------           -------------
????racdb2            node-rac2       SELECT           BASIC                NO
??????????????????????????RAC????????????????????????????
????[oracle@node-rac2 ~]$ srvctl stop instance -d racdb -i racdb2
???????node-rac2????racdb2????????????????????SQL??????????????????£?
????INSTANCE_ NAME  HOST_NAME   FAILOVER_TYPE   FAILOVER_METHOD   FAILED_OVER
????-------------         ------------------    -------------       ---------------           -------------
????racdb1            node-rac1       SELECT           BASIC                YES
???????????????????????SQL??????л?????node-rac1?????racdb1??????????????????л??????
?????????????RAC????????????????????????