Attach and Detach Method vs SQL Manage object method

  • Hi there,

    if you want to detach a database you would right click on the DB->Tasks->Detach

    What are the motivations behind doing this? I suspect if you want to make edits to an existing database and don't want to alter the production environment.

    What's the difference between attaching (right click on databases -> attach) and "restoring" a database (right click on DB->Restore DB)?

    Again, what are the motivations behind doing either one of these?

    When copying a database (Right click->Tasks->Copy Database0> Use the wizard) Then at some point you can choose between 'Use the detatch and attach method or use the SQL Manage object method.

    What is the motivation behind doing the above or using the wizard?

    • This topic was modified 4 years, 5 months ago by  Nusc.
    • This topic was modified 4 years, 5 months ago by  Nusc.
  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Nusc wrote:

    Hi there,

    if you want to detach a database you would right click on the DB->Tasks->Detach

    What are the motivations behind doing this? I suspect if you want to make edits to an existing database and don't want to alter the production environment.

    If a database is detached, you cannot modify the database.  One reason is to move or copy the database files from one place to another.  A few examples would be moving to a new server, a different set of disks, or to copy a production database to a testing environment.

    What's the difference between attaching (right click on databases -> attach) and "restoring" a database (right click on DB->Restore DB)?

    Again, what are the motivations behind doing either one of these?

    A restore requires a backup of the database, an attach requires the database files.  These are not interchangeable operations.

    You do have a backup and recovery process set up? If so, a restore would be to recover a database in the event of a failure, or a mistake.

    When copying a database (Right click->Tasks->Copy Database0> Use the wizard) Then at some point you can choose between 'Use the detatch and attach method or use the SQL Manage object method.

    What is the motivation behind doing the above or using the wizard?

    The wizard is at best, troublesome.  If you need to make a copy of a database, I suggest you take a backup, and restore it to the new location.  You could detach, copy, and attach, but that would require the database to be brought offline.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

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

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