SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

The Dangers of Detach

I ran across a twitter conversation about a post recently. The post talks about detaching or attaching databases in bulk.

I agree that detaching databases in some cases is bad, but it’s not necessarily something I’d avoid. Detach is a good way to prep for upgrades, movement, etc. It may or may not be faster than backup/restore, depending on your environment, but it’s something to consider.


If you are going to detach, there are a couple things I’d recommend. First, make sure you have a good backup. A backup is just that, a backup plan, a backup file, a way to recover when things go wrong. It isn’t your data, it’s a copy. A detached mdf is your data. Make sure you have a backup before detaching and messing with files.

Second, never move files. Never, ever, ever, ever, move database files. Detach/attach is a valid way to move databases, but always copy the files.

Filed under: Blog Tagged: administration, sql server, syndicated

The Voice of the DBA

Steve Jones is the editor of SQLServerCentral.com and visits a wide variety of data related topics in his daily editorial. Steve has spent years working as a DBA and general purpose Windows administrator, primarily working with SQL Server since it was ported from Sybase in 1990. You can follow Steve on Twitter at twitter.com/way0utwest


Leave a comment on the original post [voiceofthedba.wordpress.com, opens in a new window]

Loading comments...