Question:
When I set up the SQL Server database for Spitfire, I had the opportunity to specify the location for the primary MDF, the secondary file group NDF, and the SQL transaction log LDF. How do I change the location of any of these components at a later time?
Answer:
This procedure is best carried out using Enterprise Manager on the SQL Server itself. All users must be off the system.
- Open Enterprise Manager.
- Expand the server.
- Expand the database collection.
- Optional — decrease the size of the files prior to the move.
(To achieve maximum reduction in the LDF file, this step is best performed after a full backup.)- Right-click on the database to be relocated.
- Choose All Tasks | Shrink Database.
- Click OK.
- Right-click on the database to be relocated.
- Choose Properties.
- Move to the Data Files and Transaction Log tab pages. Make note of the Location of each file. Close the dialog.
- Right-click on the database to be relocated and choose All Tasks | Detach.
- Use Windows Explorer and move the files from the current locations noted in step 6 to the new locations. Given that the MDF, NDF and LDF can be quite large, the move can take several minutes per file.
- Back in Enterprise Manager, right-click on the Databases collection and choose All Tasks | Attach.
- Use the browse button to find the MDF and then click Verify.
- Update the paths to any additional files.
- Enter the database name (from step 5).
- Specify SA as the database owner.
Additional Comments:
For best performance and data protection, the LDF should be on a separate set of physical devices. It should not share I/O heads with the MDF or NDF files.See KBA-01280 for information about relocating your Spitfire database on another SQL Server.
KBA-01010; Last updated: May 11, 2016 at 11:27 am;
Keywords: move MDF NDF LDF SQL