I am trying to drop distribution database but cannot as I am getting this error:

The operating system returned error 21(The device is not ready.) to SQL Server during a read at offset 0x00000000056000 in file 'E:\XXX_Replication\Data\distribution.MDF'. 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.

The underlying drive on which the .mdf file existed was replaced, thus deleting the .mdf files. Replication is not needed on this server. But this is production server and cannot be restarted.. Please help me to delete this database.

migrated from stackoverflow.com Nov 30 '15 at 15:29

This question came from our site for professional and enthusiast programmers.

  • Can you share the database schema and the SQL code that you are trying to execute? – FelisCatus Nov 30 '15 at 11:46
  • What ever I try to do, be it ALTER DATABASE or any other command , I get the above error – Abu Rayyan Nov 30 '15 at 11:59

first of all, thanks for the help and suggestions. I have now managed to delete the distribution database without rebooting the server. this is how i did it.

  1. Created a distribution database with similar file locations on a different server.
  2. Took the backup of this new distribution database.
  3. Restored this backup on the existing distribution database with REPLACE, MOVE option.
  4. Finally disabled distribution on the server.

Thanks again for the help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.