• MSSQL – Delete a Database

    Author
    Topic
    #474774

    Can anyone tell me what happens when I delete a database in MSSQL? Are the MDF and LDF files removed properly, or just marked as deleted? To be secure should I detach the files and destroy them securely? Is there a better way to be sure?
    Thanks

    Viewing 3 reply threads
    Author
    Replies
    • #1267237

      Microsoft says: When a database is deleted, the files and their data are deleted from the disk on the server. When a database is deleted, it is permanently removed and cannot be retrieved without using a previous backup.

      http://msdn.microsoft.com/en-us/library/ms189278.aspx

      There are, of course, utilities that can recover ‘deleted’ files, and the only way to be sure would be to overwrite the area on the disk(s) several times with rubbish.

      Look at the efforts the Government has taken to destroy the National Identity Register:

      http://www.computerweekly.com/Articles/2011/02/10/245363/ID-card-database-is-destroyed.htm

      Regards,

      Jules

      • #1267245

        Thanks, but my question is what does Microsoft mean? Talking about the recycle bin it says ‘must explicitly delete the files from the Recycle Bin to make the deletion permanent’. There seem to be a lot of tools around suggesting they can recover even those files, or at least some of the content, subject to what is over written.

    • #1267249

      Database files are no different than any other file when it comes to how they are treated by the OS on deletion. While they may not be put in the recycle bin, the entries in the MFT are marked as deleted. Until the space is re-used the data is still there. Yes, there are programs that can recover this data until it is over written.

      Joe

      --Joe

    • #1267251

      Thanks – that confirms what I had guessed

    • #1267436

      I would overwrite the data with an update query, then drop the database.
      Log files are much harder as they are just sequential writes and you really need to overwrite the file space.
      The easiest method is to provide physical security for the server and erase the disks securely (with DBAN) once finished.
      Alternatively, use something like Eraser to overwrite the files.

      cheers, Paul

    Viewing 3 reply threads
    Reply To: MSSQL – Delete a Database

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: