Database failover/failback history I am a SQL DBA newbie, and I am trying to get the failover/failback history for one of our mirrored servers. I am able to get the the failover history from event viewer but do not know how to the get the failback history. Your help is greatly appreciated!
The following is a script I wrote for displaying the failover and failback history:

SELECT d.name, t3.time, (1 - t3.role) as status
FROM (
    SELECT t1.database_id, t1.time, t1.role 
    FROM 
        (
            SELECT RANK() OVER (ORDER BY database_id, time) AS rec, database_id, role, time 
            FROM msdb.dbo.dbm_monitor_data dbmd 
        ) as t1
        INNER JOIN 
        (
            SELECT RANK() OVER (ORDER BY database_id, time) AS rec, database_id, role, time 
            FROM msdb.dbo.dbm_monitor_data dbmd 
        ) t2 ON T1.database_id = T2.database_id and t1.rec = (t2.rec - 1) AND t1.role &lt;&gt; t2.role
    ) t3
    INNER JOIN sys.databases d ON t3.database_id = d.database_id
ORDER BY d.name, t3.time


I believe Role = 0 is PRIMARY.