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

Sample code for AGStatus SQL in the database

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

Share

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

Editor to share with you the sample code of AGStatus SQL in the database, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Select n.grouppapername REMOTE' END as is_local,rs.connected_state_desc WHEN rs.is_local = 1 THEN local 'ELSE' REMOTE' END as is_local,rs.connected_state_desc CASE WHEN drs.suspend_reason_desc='SUSPEND_FROM_USER' THEN 'user manually suspended data movement' WHEN drs.suspend_reason_desc='SUSPEND_FROM_REDO' THEN 'error in redo phase' WHEN drs.suspend_reason_desc='SUSPEND_FROM_CAPTURE' THEN 'error while capturing log on master copy' WHEN drs.suspend_reason_desc='SUSPEND_FROM_UNDO' THEN 'error in undo phase (see error log) 'WHEN drs.suspend_reason_desc='SUSPEND_FROM_XRF_UPDATE' THEN' cannot find the public log point (see error log) 'END as is_suspended -- whether the database hangs and causes drs.synchronization_health_desc,ISNULL (drs.redo_queue_size,0) as redo_queue_size,-- the number of log records in the log files of the secondary copy that have not yet been redone (KB) ELSE CAST (ISNULL (drs.log_send_queue_size,0) * 1./ISNULL (drs.log_send_rate,0) AS DECIMAL (18Magne2)) CASE WHEN ISNULL (drs.redo_rate) 0) = 0 THEN 0END as redo_need_time-it takes time for the log record redo in the secondary copy to complete (seconds) join sys.dm_hadr_availability_replica_cluster_states csjoin sys.dm_hadr_availability_replica_states rsjoin sys.dm_hadr_database_replica_states drswhere rs.connected_state_desc'CONNECTED'or drs.is_suspended0or CASE WHEN ISNULL (drs.redo_rate,0) = 0 THEN 0 ELSE CAST (ISNULL (drs.redo_queue_size,0) * 1./ISNULL (drs.redo_rate) 0) AS DECIMAL (18Pol 2)) END > 100

The above is all the contents of the article "sample Code of AGStatus SQL in the Database". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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