1

My problem is that I want to delete a DB from our production server. It is a test DB that needed to be there for some reason, so the mdf and ldf are on LUNs that are insecure and oftentime lost connection to the server, not like our production LUNs that are OK.

The problem is that I can't delete the database. It throws:

El sistema operativo ha devuelto el error 1117(failed to retrieve text for this error. Reason: 15105) en SQL Server durante leer en el desplazamiento 0x00000687a10000 del archivo 'T:\XXX_XXXXX_xx.mdf'

We are using SQL Server 2008 [10.0.5500.0].

It won't let me go into DB settings or read from tables. I can't manually delete the files either. I think a server restart should help. Today is Tuesday and we got a schechuled restart on Saturday 04.

Have any of you encontered this issue?

4
  • Does it let you set the database offline? Mar 2 '17 at 22:46
  • It won't let me, either by T-SQL or by graphical interface Mar 2 '17 at 23:04
  • Can't stop the service?
    – McNets
    Mar 3 '17 at 0:12
  • Yes I can, but it's a production environment, not until saturday. Mar 3 '17 at 0:23
2

That just means it can't find that file at the moment. Either wait for when the drive to be available, or, as Martin suggested, try setting the database offline: ALTER DATABASE FOO SET OFFLINE

If that works, you should be able to follow it up with a DROP: DROP DATABASE FOO.

Then delete the files at your leisure.

1
  • Don't forget to clean up the database files when you have deleted the OFFLINE database. SQL Server leaves them on the disks if the database was OFFLINE when you deleted the database.
    – John K. N.
    May 10 '19 at 13:17
2

If you have SQL Server 2016 or greater you can use DROP DATABASE IF EXISTS

DROP DATABASE IF EXISTS [FOO]

https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-database-transact-sql?view=sql-server-2017

0

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.