page contents

About the Post

Author Information

Moving the System Databases in SQL Server 2008R2

One of the more common tasks you will encounter in moving a system or user database from one physical location to another location. For example, Microsoft recommends that we place our backups, data files, transaction logs and tempdb files on four separate drives. However, the installer by default will place the system databases (Master, Model and MSDB) on the C drive. Even though the rest of the install will allow you to place them on other drives, to even include the tempdb. This will cause some performance issues for you if you leave them there. This article will walk you through the process of making those changes.

Here is the TechNet article that you can reference as you makes these changes: Move System Databases

Moving the master Database

To move the master database, please follow these steps.

  1. From the Start menu, point to All Programs, point to Microsoft SQL Server 2008R2, point to Configuration Tools, and then click SQL Server Configuration Manager.
  2. In the SQL Server Services node, right-click the instance of SQL Server (for example, SQL Server (MSSQLSERVER)) and choose Properties.
  3. Click on the Log On Tab and stop the service for the SQL Service instance


  4. Click on the Advanced Tab and then click the Startup Parameters field


  5. In this example, I am moving the system databases from the C drive to the H and O drives for my data and log files respectively. (Original is seen in top line A and modified line is B)
    1. dC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\master.mdf;-eC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG;-lC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
    2. -dH:\Program Files\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\master.mdf;-eC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG;-lO:\Program Files\MSSQL10_50.MSSQLSERVER\MSSQL\TLogs\mastlog.ldf
  6. You will need to copy and paste the line by using the select all option (right click to bring up the menu)


  7. Then you can do a control-c to copy to notepad to modify the parameters (Line A above) and then control-v to paste the new desired line into new startup (Line B above)
  8. Before you start the service, you will need to manually copy the master.mdf and mastlog.ldf files to the new locations
  9. Now start the service and all is well

Moving the Model and MSDB Database

To move the master database, please follow these steps.

  1. Check current location of MSDB & Model Databases by executing below query:



    NOTE: You can also use “Execc SP_HelpDB ‘<DBNAME>’ for these details.

    As you can see I placed a lot of files on my E drive, which I normally use for my backup drive. I need to fix that to align myself with best practices and also better performance.

  2. Run this command to update the system databases


    Note: It will update the system catalog


  3. Stop SQL Services
  4. Manually Move MSDB and Model Databases files to the new location
  5. Start SQL Services
  6. Check MSDB & Model Databases file location after movement

Tags: , , , , , , , , , ,

Trackbacks/Pingbacks

  1. How To: Move SQL Databases (User) | Scott Mattie's Blog - March 21, 2016

    […] DATABASE. I wrote my rough draft in an earlier article (that I ended up putting up on my site) on how to move system databases in SQL Server 2008R2. In this feature, I will talk about moving user databases in all versions (since they are using the […]

  2. How to: Move SQL Databases (System) - SQL Server - SQL Server - Toad World - March 28, 2016

    […] Darling‘s article Moving Databases with ALTER DATABASE. I wrote my rough draft in an earlier article (that I ended up putting up on my site) on how to move system databases in SQL Server 2008R2. In […]

Copy Protected by Chetan's WP-Copyprotect.