Oracle RAC 连接到指定实例


Oracle RAC 连接到指定实例
在某些特定的情形下,有时候需要从客户端连接到RAC中指定的实例,而不是由客户端Load_balance来动态选择或者是通过服务器端的监听器根据负载情形来转发。对此我们可以通过为tnsnames.ora中特定的网络服务名添加instance_name子项,或者是单独建立一个指向所需实例的网络服务名,下面描述这两种情形。

一、测试环境

-->Oracle 版本 
SQL> select * from v$version where rownum<2;

BANNER
---------------------------------------------------------------- 
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 相关信息 
SQL> ho /users/oracle/crs_stat.sh
Resource name                                Target     State              
--------------                                ------     -----              
ora.GOBO4.GOBO4A.inst                         ONLINE     ONLINE on bo2dbp  
ora.GOBO4.GOBO4B.inst                         ONLINE     ONLINE on bo2dbs  
ora.GOBO4.db                                  ONLINE     ONLINE on bo2dbp  
ora.bo2dbp.ASM1.asm                           ONLINE     ONLINE on bo2dbp  
ora.bo2dbp.LISTENER_BO2DBP.lsnr               ONLINE     ONLINE on bo2dbp  
ora.bo2dbp.gsd                                ONLINE     ONLINE on bo2dbp  
ora.bo2dbp.ons                                ONLINE     ONLINE on bo2dbp  
ora.bo2dbp.vip                                ONLINE     ONLINE on bo2dbp  
ora.bo2dbs.ASM2.asm                           ONLINE     ONLINE on bo2dbs  
ora.bo2dbs.LISTENER_BO2DBS.lsnr               ONLINE     ONLINE on bo2dbs  
ora.bo2dbs.gsd                                ONLINE     ONLINE on bo2dbs  
ora.bo2dbs.ons                                ONLINE     ONLINE on bo2dbs  
ora.bo2dbs.vip                                ONLINE     ONLINE on bo2dbs  

-->实例GOBO4A上的listener参数 
SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------ 
instance_name                        string      GOBO4A

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------ 
local_listener                       string
remote_listener                      string      remote_lsnr_gobo4

-->实例GOBO4B上的listener参数 
SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------ 
instance_name                        string      GOBO4B

SQL> show parameter listener  

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------ 
local_listener                       string
remote_listener                      string      remote_lsnr_gobo4

-->服务器端的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))
  )

-->客户端的tnsnames.ora(客户端为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)
    )
  )

你可能感兴趣的:(oracle,OCP,cuug,ocm)