Shrink Database - Clear free space

  • We had a security leak where someone placed a classified document on our sharepoint server. We have deleted all occurrences of the file from the server, but now they want me to do a shrink database to insure all free space is cleared and the document cannot be recovered. I have heard this can cause performance problems, fragmentation and other issues. My database size is about 90GB with about 5 GB of free space. I don't think it would be healthy to shrink the db anymore than this. Anyhow I am looking for advice. One plan I thought of would be to stop the SQL services and run a win defrag on the DB partition then use BCWipe to clear free space.

  • Was the document in the SQL database ? Either way, I don't see how a shrink would help.

    A placebo solution would be to write 5 gig of junk data to your data base to fill it up, then delete the junk data to get your 5 gig back.

    If they're worried about recovery, then you should delete your transaction log backups so it cannot be restored (although nothing else could be either).

  • "Placebo solution" I had to chuckle at your choice of words... Anyhow, do you think the shrink database will do more harm than good?

  • Well, I dont think that shrinking database has anything to do with 'recovery of your classified document'.

    Instead you should try to see how it happened in first place and have an action plan so that it doesn't happen again.

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • paul_jacobs (6/16/2010)


    "Placebo solution" I had to chuckle at your choice of words... Anyhow, do you think the shrink database will do more harm than good?

    Yes

  • Sharepoint actually stored the document itself inside the SQL Server; so, you have something of a problem; with a shrink, I wouldn't expect it to guarantee that every disk sector that may have contained part of your classified document is released to the OS.

    The "Clean" way to do this, which you should test on a (smaller) test environment first, is:

    A) Do not shrink anything! If you already have, you'll need to do a complete free space/cluster tip wipe on the drive before you continue. Performance will be very bad while this happens.

    B) Ensure that there's no trace left of the classified document within SQL Server tables or indexes.

    C) Create a brand new database with its own .MDF's

    D) Within SQL Server, switch to single user mode, copy tables over to the new database, which has no part of the classified document.

    D) Detach, but do not delete, the old database files.

    E) Use a secure wiping utility (DoD 3 or 7 pass as required) to wipe the old database files. Again, performance will be bad while this happens.

    F) Attach the new files to the old database name, or vice versa.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply