How to archive a database

  • Hey,

    Each of my customers has his own database. Sometimes a customer quits. When that happens, I want to archive that database. My idea is:

    1) Make a full backup to "\\backupserver\final_backups\FINAL_BACKUP_CUSTOMERNAME.BAK"

    2) Detach the database "DBCUSTOMER"

    3) Delete the files DBCUSTOMER.MDF and DBCUSTOMER_LOG.LDF

    Is this the way to go? And if so, how do I do step 3 with T-SQL?

    Thanks,

    Raymond

  • Why not just drop the database after you have backed it up?

  • That simple eh...

    Thanks!

    Raymond

  • Just a thought, I would also keep and stash away a copy of the associated logins scripted out using the sp_help_revlogin procedure. That way, you can reinstall the database on another server if needed, and it will keep the same security ID's for the logins, and any SQL Authentication passwords.

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

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