Detaching the database to free up space

  • I am trying to free up some space in the server by detaching the unused database and deleting the ldf & mdf files. Here are the steps I took

    1. Performed a full back up of the database

    2. Moved the BAK file to a different location in another server

    3. Ran the follwing on the database since it was a publisher in the replication

    sp_replicationdboption 'dbcentral,'publish','false'

    4.Detach the database

    5. Delete the files since I have a full back up.

    ( I have not performed the last step yet but want to make sure that I am not missing out anything)

    Thanks in advance.

  • I'd add a step before 5. Restore database from backup on another machine to validate I have a good backup. Otherwise it seems okay.

  • I'd definitely restore and use the backup before I deleted the original files.

    But rather than detach and delete the files yourself, just do a DROP DATABASE, which would be a cleaner method.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Good idea. Thanks!

Viewing 4 posts - 1 through 3 (of 3 total)

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