Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 5123

Moving data file from to a new location

$
0
0
Hi All,

Need some suggestion from experts.

We are using Microsoft SQL Server 2012 (SP1) .
Database has 6 data files and we have decided to move one of the data file to a new physical disk/driver.
Question is which of below methods is better/safer/faster and what is the difference between below 2 approaches.

Method-1. detach & attach
Method-2.
ALTER DATABASE my SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
ALTER DATABASE my SET OFFLINE;
ALTER DATABASE my MODIFY FILE (Name = my_Data,Filename = 'D:\DATA\my.MDF');
Manually move the file to new location
ALTER DATABASE my SET ONLINE;
ALTER DATABASE my SET MULTI_USER;

Also, is it advisable to run CHECKPOINT; before perform the change.
Note: we are taking backup before we making the above change.

Thanks,
-Sam

Viewing all articles
Browse latest Browse all 5123

Latest Images

Trending Articles



Latest Images