For the best practice, we should make sure there is no connection to the database which file we want to move. We can use "Activity Monitor" in SQL Server Management Studio to check all the sessions are connecting to the databases on the SQL server.
If there is no connection to the database that we will manipulate, we detach and attach the database through following steps:
- In SQL Server Management Studio, select and right click the database, and then go to "Tasks" -> "Detach" .
- After the database is detached successfully, we can move the data or transaction file within file system.
- Next, we right click "Databases" and select "Attach ...".
- In the "Attach Database" window, select the files in the new path and hit "OK".
No comments:
Post a Comment