move file.mdf or file.ldf

  • how can i move (file.mdf) or (file.ldf) file to another location????

  • is it for a user database or a system database?

    if its a user database you can just detach the database, move the files and reattach. System databases are a little more complicated

  • yes i mean user data base..

  • nbaghm (6/1/2008)


    yes i mean user data base..

    ok detach/attach is the way to go. right click on database, detach. move the files in windows, right click databases, attach, point to your mdf and ldf and job done.

    oh and one more thing, if its a production database i would backup before you detach, just in case 🙂

  • thanks a lot i made it...thank u..:D

  • or you could have done the following:

    1. ALTER DATABASE SET OFFLINE;

    2. Move/copy the database file to the new location

    3. ALTER DATABASE ');

    4. ALTER DATABASE SET ONLINE;

    both detach/attach and this method have the same end results

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

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