How to move the Microsoft SQL Server database to another disk partition



Updated November 2024: Stop getting error messages and slow down your system with our optimization tool. Get it now at this link
  1. Download and install the repair tool here.
  2. Let it scan your computer.
  3. The tool will then repair your computer.

The information is stored somewhere. Sometimes it is not suitable for the original location. If you have little space, add a new disk array or are just curious, it’s a simple procedure to move a database in Microsoft SQL Server to that new desired location. It is clear that best practice procedures must be maintained for the DB’s proper investment. It is always a good idea to separate your databases to allow maximum I/O.

Moving the Microsoft SQL Server database

November 2024 Update:

You can now prevent PC problems by using this tool, such as protecting you against file loss and malware. Additionally, it is a great way to optimize your computer for maximum performance. The program fixes common errors that might occur on Windows systems with ease - no need for hours of troubleshooting when you have the perfect solution at your fingertips:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.

Download Now

Many things you need :

  1. An account in the local administrator group
  2. An SQL Server instance
  3. SQL Server Management Studio
  4. SA privileges for your SQL Server

This would probably work :

Locate the directory of your SQL database you want to move. By default (which is not good practice) the location of your databases is here :

C:Microsoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLDATA

Program filesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLDATA

Unlike yours, this one is here. I’d check, but if you’re ridiculously confident, don’t bother.

Go to the SQL Server Management Studio. Find the database you want to move and right-click the bad guy. Move the mouse down a little until you reach Tasks. Bring up this menu and click Disconnect.

This window appears. If there are active connections, it is probably best to tell these users to hurry, as they are busy doing nerd work to be more productive. If they refuse, there’s a checkbox to throw them out. I tend to check that box anyway.

Then click OK.

Okay, go back to the directory where the database is located. Select the.MDF and LDF files. Cut it out and paste it into the new position, noting the new position as you need it.

It may therefore take some time to copy it to its new location. Find something else to do in the meantime. There would be no harm in reading several other articles from the windowsbulletin.com. Once there, return to the SQL Server Management Studio. Right-click the database folder, then click Attach Attach.

Locate the new location of your database, select the database and click OK.

Click OK. Click OK in the next window. Press the F5 key to update the SQL window. If your database is available, you did a good job. Otherwise…….there is always an event display.

Link of interest: SQL Server downloads via Microsoft.

Guest contribution : Greg Partlow



Expert Tip: This repair tool scans the repositories and replaces corrupt or missing files if none of these methods have worked. It works well in most cases where the problem is due to system corruption. This tool will also optimize your system to maximize performance. It can be downloaded by Clicking Here

Related Video

Scroll to Top