Sql-server – Advisable to restart a SQL Server running Windows when disk space is low

disk-spacesql server

We've had a sudden drop in hard drive space on the OS partition of our SQL Server (as databases are being stored there). It's causing various issues, and we're unable to move one of the databases, as the OS now seems to be placing pre-emptive locks on the database to ensure that the machine at least stays running.

We've tried everything we can think of. Is it advisable to now stop the SQL Server instance then restart Windows?

We're thinking this is the only way to clear things up, however our infrastructure guy is concerned that Windows will first try to write its state to disk before it restarts which could make the issue worse.

Any advice/experience in this situation?

Best Answer

The short answer is that we eventually literally pulled the plug on the SQL server and got away with it, (although I wouldn't necessarily recommend the approach). If you're in a situation like we were with this though, here's the full scenario:

  • We couldn't log onto the box at all, and all services dependant on the database were running very slowly. The OS seemed to be partially shutting down.
  • Eventually got lucky and managed to allocate an extra 6Gb to the server (from a low of 4Mb free), by connecting to it using computer management (after several attempts).
  • After this, all attempts to detach the database we wanted to move failed (we tried setting the database into single user mode with immediate rollback, also setting it into simple recovery mode, manually killing off SPIDs, nothing worked).
  • We were seeing pre-emptive database locks placed by the OS (presumably for the OS to ensure it could keep running), which seems to have been what was preventing us detaching the database in order to move it to a different drive.
  • We tried to stop the entire database instance, however this didn't work and eventually we literally pulled the plug on the server.
  • When it restarted we were able to immediately detach the database as the restart straightened out the OS. Moved the database, re-attached it and we're back in business :)
  • The database we moved is (initially) stuck in 'read only' state, however we do only read from it.