RAC資料庫連線配置,tnsnames和client端配置

liuzhen_basis發表於2014-08-28


    檢視rac節點hosts檔案,scan配置實用hosts檔案,沒有使用dns解析

    clip_image001



    tnsnames檔案配置如下,SAP為全域性例項名,SAP1和SAP2為各節點的例項名,安裝RAC的時候自動指定的,

    其他的信基本都是hosts檔案裡的,其中注意的是SAP1和SAP2host名字都是用是vip



    [root@rac01 admin]# cat tnsnames.ora

    # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

    # Generated by Oracle configuration tools.

    SAP =

    (DESCRIPTION =

    (LOAD_BALANCE = OFF)

    (FAILOVER = ON)

    (ADDRESS_LIST =

    (ADDRESS=(PROTOCOL = TCP)(HOST = rac)(PORT = 1521))

    )

    (CONNECT_DATA =

    (SERVICE_NAME = sap)

    (GLOBAL_NAME = sap)

    (FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC))

    )

    )

    SAP1 =

    (DESCRIPTION =

    (LOAD_BALANCE = OFF)

    (FAILOVER = ON)

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP)(HOST = rac01-vip)(PORT = 1521))

    )

    (CONNECT_DATA =

    (SERVICE_NAME = sap1)

    (FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC))

    )

    )

    SAP2 =

    (DESCRIPTION =

    (LOAD_BALANCE = OFF)

    (FAILOVER = ON)

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP)(HOST = rac02-vip)(PORT = 1521))

    )

    (CONNECT_DATA =

    (SERVICE_NAME = sap2)

    (FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC))

    )

    )



    配置client

    本例使用windows上Oracle Database Instant Client測試,可以在官網下載對應版本



    安裝完後,編輯本地tnsnames.ora檔案

    clip_image002



    將裡面新增和伺服器端一樣的配置

    clip_image003



    最後配置本地hosts檔案,新增如下

    clip_image004



    配置完成,測試連線,

    clip_image005



    連線成功。



    強制停掉一個節點rac02測試。

    [root@rac01 admin]# crsctl status resource -t

    --------------------------------------------------------------------------------

    NAME TARGET STATE SERVER STATE_DETAILS

    --------------------------------------------------------------------------------

    Local Resources

    --------------------------------------------------------------------------------

    ora.DATA.dg

    ONLINE ONLINE rac01

    ora.LISTENER.lsnr

    ONLINE ONLINE rac01

    ora.OCR.dg

    ONLINE ONLINE rac01

    ora.asm

    ONLINE ONLINE rac01

    ora.eons

    ONLINE ONLINE rac01

    ora.gsd

    OFFLINE OFFLINE rac01

    ora.net1.network

    ONLINE ONLINE rac01

    ora.ons

    ONLINE ONLINE rac01

    ora.registry.acfs

    ONLINE ONLINE rac01

    --------------------------------------------------------------------------------

    Cluster Resources

    --------------------------------------------------------------------------------

    ora.LISTENER_SCAN1.lsnr

    1 ONLINE ONLINE rac01

    ora.oc4j

    1 ONLINE ONLINE rac01

    ora.rac01.vip

    1 ONLINE ONLINE rac01

    ora.rac02.vip

    1 ONLINE INTERMEDIATE rac01 FAILED OVER

    ora.sap.db

    1 ONLINE ONLINE rac01

    2 ONLINE OFFLINE

    ora.scan1.vip

    1 ONLINE ONLINE rac01



    連線依然正常,這樣就達到高可用的效果了。

    clip_image006

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27771627/viewspace-1259462/,如需轉載,請註明出處,否則將追究法律責任。

相關文章