title: TSQL to know if database mirroring is setup for both PRimary and secondary server
body: <p>I have Database mirroring setup between two SQl 2005 servers (no witness).
  Using Tsql, I want to find if there is a user database on both primary and mirror server.
  I can use the following on mirror:</p>
  
  <pre><code>select * from sys.databases where state &lt;&gt;1 and database_id&gt;4
  </code></pre>
  
  <p>What should i use for Primary server?</p>