Detach Files Before Moving ?

  • I need to move some SQL data files to a new drive, and was planning to detach, move, attach. But if SQL is down, with services off, and they end up back on the same letter drive, I don't need to bother with detach-attach, right ? Just move the files ?

  • Shall we understand the initial and final location after the "move" is the same?... kind of taking a backup of a specific disk-drive, replacing the affected disk-drive and then restoring the backup on the new disk drive?

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Yes, this relates to my other post about swapping out a drive. I need to move the files off the old drive, then back onto the new drive with the same drive letter.

    http://www.sqlservercentral.com/Forums/Topic589364-5-1.aspx

  • I'll put the database in restricted mode...

    Take a full backup -be sure the backup is good...

    Bring down SQL Server services...

    Do the disk swap...

    Light a candle...

    Start SQL Server services...

    Check error log.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Yes, if the files end up in the same logical location, you can simply move them and start the SQL Services.

    If they are not in the same logical location, you can still just move them if the SQL service is off. When you restart the SQL service, the database will come up in suspect mode and you would have to drop it. You would then be able to attach the files in the new location.

  • remember to ensure security permissions are retained on the data folders otherwise the SQL server service may not be able to access the files 😉

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 6 posts - 1 through 5 (of 5 total)

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