Sqlserver查詢alwayson同步情況指令碼(1)

ywxj_001發表於2017-10-25

SELECT  availability_mode_desc ,
        role_desc ,
        replica_server_name ,
        last_redone_time ,
        GETDATE() now ,
        DATEDIFF(ms, last_redone_time, GETDATE()) diffMS
FROM    ( ( sys.availability_groups AS ag
            JOIN sys.availability_replicas AS ar ON ag.group_id = ar.group_id
          )
          JOIN sys.dm_hadr_availability_replica_states AS ar_state ON ar.replica_id = ar_state.replica_id
        )
        JOIN sys.dm_hadr_database_replica_states dr_state ON ag.group_id = dr_state.group_id
                                                             AND dr_state.replica_id = ar_state.replica_id;

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

相關文章