• LOAD_BALANCE=false 主在不会切换备


      方法1:   (LOAD_BALANCE=false)

    How to Setup EUS and TNS for Failover Configuration of Oracle Dataguard with Primary and Standby Hosts (Doc ID 2224611.1)​编辑To Bottom


    In this Document


    APPLIES TO:

    Oracle Unified Directory - Version 11.1.2.3.0 and later
    Advanced Networking Option - Version 11.2.0.3 and later
    Oracle Internet Directory - Version 11.1.1.9.0 and later
    Information in this document applies to any platform.

    GOAL

     To implement EUS in a Data Guard with Primary/Standby database and create TNS aliases for failover

    SOLUTION

    Purpose

    The purpose of this article is to explain how to configure Enterprise User Security (EUS) with a TNS connect string to work correctly with Data Guard with Primary/Standby databases on different physical hosts connecting to a directory server (OUD or OID).

    Scope

    Integration with EUS, 11g and 12c Oracle Databases, and OUD or OID. The features described in this article applies to OUD 11gR2PS3 or OID 11gR1PS7 and onwards.

    Details

    Problem
    -------
    EUS does not include the functionality to create TNS entries for a failover configuration, and there is no other Product Documentation explaining how to setup EUS for such an environment.

    Solution
    --------
    1) Register both primary and standby databases in the Directory (OUD or OID) as individual databases.

    2) Create global schema for both databases.

    2.1) Create schema mapping within an enterprise domain in the (OUD/OID) directory.

    3) Create global roles in both databases and grant privileges to them.

    3.1) Create enterprise roles in (OUD/OID) and assign primary and standby databases to both of them.

    3.2) Grant enterprise roles to LDAP groups in (OUD/OID).

    4) Test EUS, connecting to each of databases using registered service names from primary or secondary databases.

    5) Create an additional TNS entry for failover mechanism as follows -


    TNS entries in tnsnames.ora for primary and standby databases  :

    =

       (DESCRIPTION =

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

          (CONNECT_DATA =

           (SERVER = DEDICATED)

           (SERVICE_NAME = )

       )

    )

    =

       (DESCRIPTION =

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

          (CONNECT_DATA =

          (SERVER = DEDICATED)

          (SERVICE_NAME = )

      )

    )

    Note: This is an example of a configuration and the service name might be different on each server.

    Add the following Failover entry to tnsnames.ora

    DB11G=

        (DESCRIPTION_LIST=

          (FAILOVER=true)

          (LOAD_BALANCE=false)

          (DESCRIPTION=

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

               (CONNECT_DATA=

               (SERVICE_NAME=))

         )

         (DESCRIPTION=

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

              (CONNECT_DATA=

              (SERVICE_NAME=))

         )

    )

    This entry can be  exported to OUD using either "netmgr" or enterprise manager .


     

    Choose the TNS name "DB11g" to be exported to OUD

    In Directory (OUD or OID)  find the corresponding entries as follows:

    dn: cn=,cn=OracleContext,dc=

    orclNetDescString: (DESCRIPTION_LIST=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=)))(CONNECT_DATA=(SERVICE_NAME=)))(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=)))(CONNECT_DATA=(SERVICE_NAME=)))

    )

    objectClass: orclNetService

    objectClass: top

    cn:

    orclNetDescName: 000:cn=DESCRIPTION_LIST_0

    dn: cn=DESCRIPTION_LIST_0,cn=,cn=OracleContext,dc=

    orclNetDescList: 000:cn=DESCRIPTION_0

    orclNetDescList: 001:cn=DESCRIPTION_1

    orclVersion: v0.0

    objectClass: orclNetDescriptionList

    objectClass: top

    orclNetShared: NO

    cn: DESCRIPTION_LIST_0

    dn: cn=DESCRIPTION_0,cn=DESCRIPTION_LIST_0,cn=,cn=OracleContext,dc=

    orclNetServiceName:

    orclVersion: v0.0

    objectClass: orclNetDescriptionAux1

    objectClass: orclNetDescription

    objectClass: top

    orclNetLoadBalance;binary: NO

    orclNetAddrList: 000:cn=ADDRESS_LIST_0

    orclNetShared: NO

    cn: DESCRIPTION_0

    dn: cn=ADDRESS_LIST_0,cn=DESCRIPTION_0,cn=DESCRIPTION_LIST_0,cn=,cn=OracleContext,dc=

    orclNetSourceRoute;binary: NO

    orclNetFailover;binary: YES

    orclVersion: v0.0

    objectClass: orclNetAddressList

    objectClass: top

    orclNetLoadBalance;binary: NO

    orclNetAddrList: 000:cn=ADDRESS_0

    orclNetShared: NO

    cn: ADDRESS_LIST_0

    dn: cn=ADDRESS_0,cn=ADDRESS_LIST_0,cn=DESCRIPTION_0,cn=DESCRIPTION_LIST_0,cn=,cn=OracleContext,dc=

    orclNetProtocol: TCP

    orclVersion: v0.0

    objectClass: orclNetAddress

    objectClass: top

    orclNetShared: NO

    cn: ADDRESS_0

    orclNetAddressString: (ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))

    dn: cn=DESCRIPTION_1,cn=DESCRIPTION_LIST_0,cn=,cn=OracleContext,dc=

    orclNetServiceName:

    orclVersion: v0.0

    objectClass: orclNetDescriptionAux1

    objectClass: orclNetDescription

    objectClass: top

    orclNetLoadBalance;binary: NO

    orclNetAddrList: 000:cn=ADDRESS_LIST_0

    orclNetShared: NO

    cn: DESCRIPTION_1

    dn: cn=ADDRESS_LIST_0,cn=DESCRIPTION_1,cn=DESCRIPTION_LIST_0,cn=,cn=OracleContext,dc=

    orclNetSourceRoute;binary: NO

    orclNetFailover;binary: YES

    orclVersion: v0.0

    objectClass: orclNetAddressList

    objectClass: top

    orclNetLoadBalance;binary: NO

    orclNetAddrList: 000:cn=ADDRESS_0

    orclNetShared: NO

    cn: ADDRESS_LIST_0

    dn: cn=ADDRESS_0,cn=ADDRESS_LIST_0,cn=DESCRIPTION_1,cn=DESCRIPTION_LIST_0,cn=,cn=OracleContext,dc=

    orclNetProtocol: TCP

    orclVersion: v0.0

    objectClass: orclNetAddress

    objectClass: top

    orclNetShared: NO

    cn: ADDRESS_0

    orclNetAddressString: (ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))


     

    6) Test the new TNS entry or log on to database

    # tnsping

    # sqlplus /@

    7) Failover can be tested by stopping the primary server. Current and new sessions will automatically switch to the failover server on (in this example)

    方法2:   (CONNECT_TIMEOUT=10)(RETRY_COUNT=3)

    If you have a Maximum Availability Architecture (MAA) environment implemented, in which you use Oracle RAC for both your primary and standby Databases that are synchronized using Oracle Data Guard, then using the SCAN provides a simplified TNSNAMES configuration that a client can use to connect to the Database, independent of whether the primary or standby Database is the currently active Database.

    To use this simplified configuration, Oracle Database 11g Release 2 introduced the following two SQL*Net parameters that can be used for connection strings of individual clients:

     * The CONNECT_TIMEOUT parameter

      It specifies the timeout duration in seconds for a client to establish an Oracle Net connection to an Oracle Database. This parameter overrides the SQLNET.OUTBOUND_CONNECT_TIMEOUT parameter in the SQLNET.ORA file.

      * The RETRY_COUNT parameter

      It specifies the number of times an ADDRESS_LIST is traversed before the connection attempt is terminated.

    Using these two parameters, both the SCANs, the one on the primary site and the one on the standby site, can be used in the client connection strings. Also, if the randomly selected address points to the site that is not currently active, then the timeout enables the connection request to failover before the client waits for an unreasonably long time. The following example shows a sample TNSNAMES.ORA entry for a MAA environment:

    sales.example.com =(DESCRIPTION= (CONNECT_TIMEOUT=10)(RETRY_COUNT=3)
    (ADDRESS_LIST= (LOAD_BALANCE=on)(FAILOVER=ON)
    (ADDRESS=(PROTOCOL=tcp)(HOST=sales1-scan)(PORT=1521))
    (ADDRESS=(PROTOCOL=tcp)(HOST=sales2-scan)(PORT=1521)))
    (CONNECT_DATA=(SERVICE_NAME= salesservice.example.com)))





    The Net description string in this case is:

    (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=)))(FAILOVER=on)(LOAD_BALANCE=on)(CONNECT_DATA=(SERVICE_NAME=)(SERVER=DEDICATED)))

    So, since there is no CONNECT_TIMEOUT defined, the connection is not redirected to the primary site where the database instance is active. This causes the TNS-12514 error and the client to wait for an unreasonable long time before failing over to the active site.
     

    SOLUTION

    Add CONNECT_TIMEOUT and RETRY_COUNT parameters to the JDBC description string. That is:

    jdbc:oracle:thin:@(DESCRIPTION=(CONNECT_TIMEOUT=10)(RETRY_COUNT=3)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=)))(FAILOVER=on)(LOAD_BALANCE=on)(CONNECT_DATA=(SERVICE_NAME=)(SERVER=DEDICATED)))

  • 相关阅读:
    TensorFlow2:概述
    网络安全——CVE-2015-1635-HTTP远程代码执行
    Linux TCP 通信并发
    OpenCV1-VS2022+OpenCV环境配置
    站群服务器对于网站优化有哪些好处?
    干货 | 读懂这篇文,玩游戏还会卡顿?
    【异常】com.alicp.jetcache.CacheException: refresh error
    【Canvas】js用canvas绘制一个钟表时钟动画效果
    【CSPNet】《CSPNet:A New Backbone that can Enhance Learning Capability of CNN》
    【mq】从零开始实现 mq-01-生产者、消费者启动
  • 原文地址:https://blog.csdn.net/jnrjian/article/details/133361905