Moving Database Files

  • I just learned that my database was created on my C:\ drive in the Program Files folder by default.  That folder contains a LOT of stuff.   It seems to me that for efficiency the database should be independent of that location.

    I read several how-to articles but didn't understand as much as I think I should from them. (My fault; not theirs.)  Looking at the Windows File Explorer, I find a Microsoft SQL Server folder but not much granularity of detail that I understand.  The wiki that I read mentions file names that I don't see in the File Explorer information.

    What should I consider before moving it?  If I should decide to move it, what do I need to know?  What must I consider?  My guess is that parts of the code should stay in the Programs Folder but that parts might benefit from being elsewhere.  Moving it might help me keep track of things.

    Be kind. Be calm. Be generous. Behave.

  • Pay attention to file / folder security

    Start with preparing your new drive ( physical / logical ) by copying the existing folder structures, including their ACL

    e.g.

    rem especially check the parameters /E /T /O ( you need to reply on the dialog, you are creating folders )
    xcopy "C:\Program Files\...\MSSQL" "F:\...\MSSQL" /E /T /O

    This only creates the folder structures at the new drive!

    To move user databases check "Move user databases"

    To move system databases ( master, msdb, tempdb, model ) check "Move system databases"

     

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

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

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