Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize seamless switching of physical DataGuard client

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to achieve physical DataGuard client seamless switching", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "how to achieve physical DataGuard client seamless switching"!

Project customers have always wanted to automate the master / slave switching of DataGuard, that is, automatically switch to the standby database after the failure of the master database, and this process should be aware of the application. After consulting DG broker, considering its usability, ease of use, and license problems, broker was abandoned. However, switching from the physical backup library to the main library can still be transparent to the application. Before I had a crooked article, through the IP drift setting of the linux system, to achieve the transparency of the active / standby switch to the application. For dataguard switchover of oracle 11g, automatic switching can be achieved by creating triggers. Here are the main steps:

The main library executes:

1. Create service

Begin

DBMS_SERVICE.CREATE_SERVICE (service_name = > 'dg_taf_pri'

Network_name = > 'dg_taf_pri'

Aq_ha_notifications = > TRUE

Failover_method = > 'BASIC'

Failover_type = > 'SELECT'

Failover_retries = > 30

Failover_delay = > 5)

End

/

two。 Create a stored procedure, and the main library starts service snooping

Create or replace procedure dg_taf_proc is

V_role VARCHAR (30)

Begin

Select DATABASE_ROLE into v_role from V$DATABASE

If v_role = 'PRIMARY' then

DBMS_SERVICE.START_SERVICE ('dg_taf_pri')

Else

DBMS_SERVICE.STOP_SERVICE ('dg_taf_pri')

End if

End

/

Select owner,object_name, procedure_name from dba_procedures where procedure_name='dg_taf_proc';-- procedure_name lists procedure and function in package

Select owner,object_name, procedure_name from dba_procedures where object_name='DG_TAF_PROC'

Select distinct name,owner from dba_source where name like 'DG_TAF_PROC%'

3. Create a trigger, which is triggered when the master / slave is switched

Create or replace TRIGGER dg_taf_trg_startup

After startup or db_role_change on database

Begin

Dg_taf_proc

End

/

Select trigger_name, trigger_name

From dba_triggers where trigger_name = 'DG_TAF_TRG_STARTUP'

4. Client configuration:

Dg_taf =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = tcp) (HOST = 12.12.12.123) (PORT = 1521))

(ADDRESS = (PROTOCOL = tcp) (HOST = 12.12.12.125) (PORT = 1521))

(LOAD_BALANCE = yes)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = dg_taf_pri)

(FAILOVER_MODE =

(TYPE = session)

(METHOD = basic)

(RETRIES = 180)

(DELAY = 5)

)

)

)

Thank you for reading, the above is the content of "how to achieve seamless switching of physical DataGuard client". After the study of this article, I believe you have a deeper understanding of how to achieve seamless switching of physical DataGuard client, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report