Client Failover configuration for Oracle 10g R2 Master/Slave automatic Failover

Source: Internet
Author: User

1. master database check and settings

Assume that the new service is named ORCL_TAF.LK.

SQL> exec dbms_service.create_service (service_name => 'orcl _ TAF. LK ', network_name => 'orcl _ TAF. LK ');
SQL> exec dbms_service.start_service (service_name => 'orcl _ TAF. LK ');
SQL> CREATE OR REPLACE TRIGGER trg_oci_service
After startup on database
DECLARE
Role VARCHAR (30 );
BEGIN
SELECT DATABASE_ROLE INTO role from v $ DATABASE;
IF role = 'primary' THEN
DBMS_SERVICE.START_SERVICE ('orcl _ TAF. LK ');
End if;
END;
/
SQL> show parameter service_names
NAME TYPE VALUE
---------------------------------------------------------------------------------
Service_names string ORCL_TAF.LK

If the standby database is not applied in real time, manual archiving ensures that the trigger is uploaded to the standby database:
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

Confirm that the new service is displayed:
$ Lsnrctl status
...
Service "ORCL_TAF.LK" has 1 instance (s ).
Instance "ORCL", status READY, has 1 handler (s) for this service...

2. Configure the OCI client (including pure OCI/OCCI client and JDBC-OCI client)

To ensure that the instance is down but the listener is not down, all the listeners need to be dynamically registered and the service names configured statically are not allowed. because of Dynamic Registration, when the instance goes down, its service name will disappear from the listener, and then the application will try the second IP address. if static configuration is available, the listener will not try the second IP address because it can accept client requests, but will report an Oracle not available error.

$ Vi $ ORACLE_HOME/network/admin/tnsnames. ora
--------------------------------------------------------------------------------
DB_ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = primary_host) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = standby_host) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL_TAF.LK)
)
)
--------------------------------------------------------------------------------
Note: ADDRESS_LIST contains the master-slave database server and port information. SERVICE_NAME indicates the new service name ORCL_TAF.LK.

The JDBC-OCI client configuration method is "jdbc: oracle: oci8: @ DB_ORCL ".

-- End --

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.