SQL Server database filled the hard drive and freeing up space isn't possible

Posted by Jon on Server Fault See other posts from Server Fault or by Jon
Published on 2011-10-28T17:20:39Z Indexed on 2013/07/03 17:09 UTC
Read the original article Hit count: 259

Filed under:
|
|
|

I have a database in SQL Server 2008 on a 1Tb hard drive and it filled the drive, there is only 4Kb free. The MDF file is 323Gb and the LDF is 653Gb. The hard disk this DB is on has no other files on it other than the MDF and LDF so it's impossible to free up any space on the drive. The main hard disk is smaller but there is enough room to transfer the MDF to that drive, in case that helps. This server is overseas at a customer site and it's not possible at the moment to add more disk space to the server. It's also not possible to delete any records because the DB is in a failed mode (due to no disk space) and it doesn't respond to most commands. The Db is currently in full recovery mode which is why the LDF file is so large. This DB really doesn't need to be in full recovery so going forward we plan on switching it to simple mode which will save us a lot of space. I also don't care about losing the LDF file, but I need all of the data. I've spent a lot of time looking for a way out of this problem but everything I've found first involves either freeing up disk space or adding more disk space, neither of which is an option at this time. I'm stuck and any help would be greatly appreciated.

I get the following log when trying to switch the DB to online mode.

Msg 945, Level 14, State 2, Line 3 Database 'DBNAME' cannot be opened due to inaccessible > files or insufficient memory or disk space. See the SQL Server errorlog for details. Msg > 5069, Level 16, State 1, Line 3 ALTER DATABASE statement failed. Msg 1101, Level 17, State 12, Line 3 Could not allocate a new page for database 'DBNAME' because of insufficient disk > space in filegroup 'DEFAULT'. Create the necessary space by dropping > objects in the filegroup, adding additional files to the filegroup, or setting autogrowth > on for existing files in the filegroup.

I've found the following solutions but none work due to having no disk space on that drive, and since the DB is in a failed state I can't run most commmands. - DBCC SHRINKFILE - can't be run because doing a 'use DBNAME' fails - Detaching the DB and then changing the location of the MDF/LDF files, this fails because the DB is in an offline mode so you can't run detach.

I'm at a loss about what else to try.

Thanks.

© Server Fault or respective owner

Related posts about sql-server

Related posts about diskspace

  • diskspace in ubuntu

    as seen on Super User - Search for 'Super User'
    I have installed windows and ubuntu side by side .and given the diskspace of 10GB in an another drive partition.after using two moths i have installed some software to it no it's not starting and writing on the screen that there is no diskspace so could not be started . what can i do now?but at starting… >>> More

  • scritp to create automatically ext4 and swap in unallocated diskspace

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    i've to install a number of machines. Some machines have windows 7 installed. Some machines not. The machines have 0 or 2 or 3 partitions. Every machine has enough free diskspace (20 to 250 GB) I installed an "golden client" and build an tar archiv of this client. Now, every client boots up a small… >>> More

  • nginx tmp file folder runing out of diskspace

    as seen on Server Fault - Search for 'Server Fault'
    I get mysql diskspace error Can't create/write to file '/tmp/#sql_777_0.MYI' (Errcode: 28) mainly because my ngnix server is writing file into the tmp folder which doesn't get clean up.. i added this command as per instructions on the nginx manual to the crontab but doesn't seems to be doing… >>> More

  • Mysql out of disk space

    as seen on Server Fault - Search for 'Server Fault'
    I have just finished developing a rails app which has a mysql db as a backend. The app is meant for high traffic and will store lots of information. I am planning to set up my own web server and host the site from it. If in future my disk space runs out i would want to expand by adding more space… >>> More

  • Checkpoint FW-1disk full

    as seen on Server Fault - Search for 'Server Fault'
    Hi, The logging filled the disk of the managment node. This cause the firewall nodes to start logging locally. After deleting some old logs, restarting the managment node logging is still being done locally at the firewall nodes. I have already done a fw fetchlogs on all firewall nodes to get the… >>> More