What is the implication at attempting an attach without detach?



  • Sql server attach prerequisite states that a db must be detached before trying to attach it to another instance ( https://docs.microsoft.com/en-us/sql/relational-databases/databases/attach-a-database?view=sql-server-ver15#Prerequisites )

    However this migration link ( https://docs.microsoft.com/en-us/sql/database-engine/install-windows/choose-a-database-engine-upgrade-method?view=sql-server-ver15#migrate-to-a-new-installation ) recommends an attach without any mention about detach. Example:

    enter image description here

    What is the implication at attempting an attach without detach?



  • However this migration link recommends an attach without any mention about detach.

    You are not reading it correctly, the attach here means any database for which mdf file is present. A classic case here is stopping the database and moving the mdf files and then attaching it, this actually avoids detach. But I seldom use this method

    1. It changes database owner
    2. Many times specially with SQL Server 2005/2008 i have faced database corruption while stopping DB, moving mdf files and attaching.

    https://dba.stackexchange.com/questions/11177/attach-detach-vs-backup-restore

    Nothing beats good backup and restore.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2