title: Database Mirroring canot be removed error SQL
body: <p>Ive a database which was mirrored before and now its showing as principal, disconnected/in recovery and we need to restore a back up into it.
  Since restore option is disabled,for that purpose I tried to remove the mirroring from MS and whole properties are shows as greyed out disabled.</p>
  
  <p>I tried </p>
  
  <pre><code>alter database mydb set partner off;
  </code></pre>
  
  <p>which returned</p>
  
  <blockquote>
    <p>The operating system returned error 21(The device is not ready.) to
    SQL Server during a read at offset 0000000000000000 in file 'ldf file
    path'. Additional messages in the SQL Server error log and system
    event log may provide more detail. This is a severe system-level error
    condition that threatens database integrity and must be corrected
    immediately. Complete a full database consistency check (DBCC
    CHECKDB). This error can be caused by many factors; for more
    information, see SQL Server Books Online.</p>
  </blockquote>
  
  <p>So I tried </p>
  
  <pre><code>alter database mydb set offline;
  </code></pre>
  
  <p>which returned</p>
  
  <blockquote>
    <p>Msg 1468, Level 16, State 1, Line 1<br/>
    The operation cannot be performed on database "mydb" because it is involved in a database mirroring session or an availability group.<br/>
    Some operations are not allowed on a database that is participating in
    a database mirroring session or in an availability group.<br/></p>
    
    <p>Msg 5069, Level 16, State 1, Line 1<br/>
    ALTER DATABASE statement failed.</p>
  </blockquote>
  
  <p>Then I tried to restore the DB from the backup file in recovery</p>
  
  <pre><code>RESTORE DATABASE Inetcat_mhra
     FROM DISK = '.bak location'
     WITH REPLACE,RECOVERY
  </code></pre>
  
  <p>which returned error</p>
  
  <blockquote>
    <p>Msg 3104, Level 16, State 1, Line 1 RESTORE cannot operate on database
    'mydb' because it is configured for database mirroring or has joined
    an availability group. If you intend to restore the database, use
    ALTER DATABASE to remove mirroring or to remove the database from its
    availability group. Msg 3013, Level 16, State 1, Line 1 RESTORE
    DATABASE is terminating abnormally.</p>
  </blockquote>