• Indeed,Ahmad Osama, that is the best way (especially because downtime is not an issue) !

    (I was just reflecting on that this morning, you know how that goes 😉 )

    Or use the :

    -sp_detach_db

    - move the you intended to the new drive.

    - sp_attach_db specifying all file locations

    Be sure the sqlserver service account has been granted windows auth to the folder that hosts the db-file at the new location !

    Check "Moving Database Files" in books online

    [edited/added]

    Keep in mind you'll have to move the actual file to the new location or you'll get this errormessage at startup time of the database !

    alter database MyTestDb set online

    go

    Msg 5120, Level 16, State 5, Line 1

    Unable to open the physical file "X:\MSSQL.1\MSSQL\log\MyTestDb_data_2.ndf". Operating system error 2: "2(error not found)".

    Msg 945, Level 14, State 2, Line 1

    Database 'MyTestDb' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.

    Msg 5069, Level 16, State 1, Line 1

    ALTER DATABASE statement failed.

    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