I want to copy my database files from one machine to another machine (the same is true for copying them to different disks of the same machine), and the error "copy file or folder error" may occur, for example. This is because the SQL Server service is enabled and occupies part of the memory. Therefore, an error occurs when the program is occupied (the memory is not released at this time ). The solution can be to stop (or close) the SQL Server service. There is also a simple method.
First, the database is separated from the database server. The method is:
Right-click the database you want to copy and choose ---> task ---> detach. In this way, the *. MDF and *. LDF files can be moved or copied.
Then, after the replication is complete, attach the database to the database server. The method is:
Select database, right-click ---> attach ---> select the *. MDF file that you just separated.