Log Shipping -Mirror -Replication Monitor Queries
SP_LOG_SHIP_STATUS
select ls.primary_server, ls.primary_database, ls.secondary_server, ls.secondary_database,
datediff(minute, ls.last_restored_date, getdate()) + ld.restore_delay as delta,
ld.restore_delay, ls.restore_threshold, ls.last_restored_latency, ls.last_copied_date,
ls.last_copied_file, datediff(minute, ls.last_copied_date, getdate()) as time_since_last_copy,
ls.last_restored_date, ls.last_restored_file, datediff(minute, ls.last_restored_date, getdate()) as time_since_last_restore
from msdb..log_shipping_secondary_databases ld,
msdb..log_shipping_monitor_secondary ls where ld.secondary_id = ls.secondary_id
order by 4