Oracle RAC connects to a specified instance. In some specific cases, you sometimes need to connect to the specified instance in RAC from the client, instead of dynamically selecting the client Load_balance or forwarding it based on the load situation through the server listener. In this case, you can add the instance_name subitem to the network service name specified in tnsnames. ora, or create a network service Name Pointing to the desired instance separately, which is described below. 1. Test Environment [SQL] --> Oracle version SQL> select * from v $ version where rownum <2; www.2cto.com BANNER implements Oracle Database 10g Release 10.2.0.3.0-64bit Production --> OS SQL> ho cat/etc/issue Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) -Kernel \ r (\ l ). --> RAC related information SQL> ho/users/oracle/crs_stat.sh Resource name Target State -------- ------ ----- Ora. GOBO4.GOBO4A. inst ONLINE on bo2dbp ora. GOBO4.GOBO4B. inst ONLINE on bo2dbs ora. GOBO4.db ONLINE on bo2dbp ora. bo2dbp. ASM1.asm ONLINE on bo2dbp ora. bo2dbp. LISTENER_BO2DBP.lsnr ONLINE on bo2dbp ora. bo2dbp. gsd ONLINE on bo2dbp ora. bo2dbp. ons ONLINE on bo2dbp ora. bo2dbp. vip ONLINE on bo2dbp ora. bo2dbs. ASM2.asm ONLINE On bo2dbs ora. bo2dbs. LISTENER_BO2DBS.lsnr ONLINE on bo2dbs ora. bo2dbs. gsd ONLINE on bo2dbs ora. bo2dbs. ons ONLINE on bo2dbs ora. bo2dbs. vip ONLINE on bo2dbs --> listener parameter SQL on instance GOBO4A> show parameter instance_name name type value parameter ------------- ---------------------------- instance_name string GOBO4A SQL> show parameter listener NAME T Ype value parameter ----------- specified local_listener string remote_listener string parameter --> listener parameter SQL on instance GOBO4B> show parameter instance_name name type value parameter ----------- specified instance_name string GOBO4B SQL> show parameter listener NAME TYPE VALUE ------- ----------------------------- -------------------------------------- Local_listener string remote_listener string remote_lsnr_gobo4 --> server tnsnames. ora SQL> ho more $ ORACLE_HOME/network/admin/tnsnames. ora # tnsnames. ora Network Configuration File:/u01/oracle/db/network/admin/tnsnames. ora # Generated by Oracle configuration tools. remote_lsnr_gobo4 = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.61) (PORT = 1521) (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.62) (PORT = 1521) --> client tnsnames. ora (the client is suse 10) oracle @ SZDB: ~> Tail-10 $ ORACLE_HOME/network/admin/tnsnames. ora GOBO4 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.61) (PORT = 1521) (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.62) (PORT = 1521) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = GOBO4 ))) www.2cto.com 2. Test logon to the specified instance [python] 1. When using multiple ip addresses to log on to the network service, add the instance_name item -- add the instance_name item for the GOBO4 network service name, the modified condition is as follows: GOBO4 = (D EIP = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.61) (PORT = 1521) (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.62) (PORT = 1521 )) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = GOBO4) (INSTANCE_NAME = GOBO4B) # This item is a new item) oracle @ SZDB: ~> More./silent_login.sh #! /Bin/bash sqlplus-S system/oracle @ $ {1} <EOF select instance_name from v \ $ instance; EOF exit oracle @ SZDB: ~> ./Silent_login.sh GOBO4 INSTANCE_NAME -------------- GOBO4B oracle @ SZDB: ~> !! ./Silent_login.sh GOBO4 INSTANCE_NAME -------------- GOBO4B oracle @ SZDB: ~> !!. /Silent_login.sh GOBO4 INSTANCE_NAME -------------- GOBO4B www.2cto.com 2. Create a separate network connection service name for each instance-as follows: add the following network service name to the tnsnames of the client. oracle @ SZDB in ora: ~> Echo "> GOBO4A => (DESCRIPTION => (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.61) (PORT = 1521)> (CONNECT_DATA => (SERVER = DEDICATED)> (SERVICE_NAME = GOBO4)> (INSTANCE_NAME = GOBO4A)>) "> $ ORACLE_HOME/network/admin/tnsnames. ora oracle @ SZDB: ~> Tnsping GOBO4A www.2cto.com Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.61) (PORT = 1521 )) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = GOBO4) (INSTANCE_NAME = GOBO4A) OK (70 msec) oracle @ SZDB: ~> ./Silent_login.sh GOBO4A INSTANCE_NAME -------------- GOBO4A oracle @ SZDB: ~> !! ./Silent_login.sh GOBO4A INSTANCE_NAME -------------- GOBO4A oracle @ SZDB: ~> !!. /Silent_login.sh GOBO4A INSTANCE_NAME -------------- GOBO4A III. Conclusion 1. In the case of multi-ip service, you can add INSTANCE_NAME to point to a specific instance. 2. You can create a network service name for a specific instance. 3. individuals prefer to use a separate network service name to connect to the specified instance source. http://blog.csdn.net/robinson_0612/article/details/8073620