Logical Name
my_Datamy_Log
Path:
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATAC:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA
FileName:
my.MDFmy_1.LDF
What would be the sql script to move these files to a new location: D:\DATA
Database is live so I would need to close existing connections.
You forgot to mention the name of your database (is it “my”?).
Now here you must manually move the files from their current location to D:\Data\ (and remember to rename them manually if you changed them in the MODIFY FILE command) … then you can bring the database back online:
This assumes that the SQL Server service account has sufficient privileges on the D:\Data\ folder. If not you will receive errors at the SET ONLINE command.