locked
attach/detach RRS feed

  • Question

  • I know this feature is deprecated, but I just want to know wif there are any draw-backs of using this. I read somewhere that it changes the id of the database and a there is lot of stuff against attach/detach. Any thoughts on this?
    Tuesday, September 14, 2010 9:44 PM

Answers

  • Just to be clear, attach/detach is NOT being depreciated.  The syntax "sp_attach_db" is being depreciated for the "CREATE DATABASE" statement.

     

    • Marked as answer by Tom Li - MSFT Wednesday, September 22, 2010 8:37 AM
    Wednesday, September 15, 2010 9:48 PM

All replies

  • I am not sure what you mean here?  I still use attach and detach frequently, there are few things to keep in mind about it.  But it perfectly valid option...

     

    1) The database will no longer be accessible on server you are detaching it from.

    2) When you detach the database the security settings on the physical files change from Inherit to Individual that detaches it.

    3) Database ID will change when you attach it to another server; but you should not be concerned about low level meta data like that.

    4) When you attach a older version of database to newer version of SQL Server the meta data will be upgraded so you cannot attach it back to the older version.

     

    Detach and Attach is perfectly valid method for database migration; it just takes database offline.  If you need to consider side-by-side migration you might want to look at backup and restore.

    Only other thing I can think of it is, you are referring to the stored procedures; which yes have been changed.  The new syntax for attaching database is CREATE DATABASE... FOR ATTACH.

    Cheers!

    • Proposed as answer by TiborKMVP Wednesday, September 15, 2010 7:22 AM
    Tuesday, September 14, 2010 10:55 PM
  • Just to be clear, attach/detach is NOT being depreciated.  The syntax "sp_attach_db" is being depreciated for the "CREATE DATABASE" statement.

     

    • Marked as answer by Tom Li - MSFT Wednesday, September 22, 2010 8:37 AM
    Wednesday, September 15, 2010 9:48 PM