how to move system DB files of MS SQL 2022

Rory_Feng 66 Reputation points
2024-01-18T01:51:20.77+00:00

Hello MS experts.

After installing MS SQL 2022, there are the following files in the system DB folder.

master.mdf mastlog.ldf model.mdf modellog.ldf MSDBData.mdf MSDBLog.ldf model_msdbdata.mdf model_msdblog.ldf model_replicatedmaster.ldf model_replicatedmaster.mdf

Compared to the system DB file after installing MS SQL 2016, the following files seem to be newly generated in MS SQL 2022.

model_msdbdata.mdf model_msdblog.ldf model_replicatedmaster.ldf model_replicatedmaster.mdf

If I want to manually move the System DB (e.g. model.mdf) to a new location, I think would run the SQL command below.

ALTER DATABASE database_name MODIFY FILE ( NAME = logical_name , FILENAME = 'new_path\os_file_name' );

I would like to know how to manually move the following files to a new location.

In SQL studio I can not see the systemDB name below

Could you please tell me the detailed method?

model_msdbdata.mdf model_msdblog.ldf model_replicatedmaster.ldf model_replicatedmaster.mdf

Thank you.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,470 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 116.8K Reputation points MVP
    2024-01-18T22:58:48.57+00:00

    The procedure for how to move the system databases is documented here: https://learn.microsoft.com/en-us/sql/relational-databases/databases/move-system-databases?view=sql-server-ver16.

    Note that the procedure for moving master is not the command you had above.

    Unfortunately, these new databases are not documented in this topic. These databases are used when you set up a new Contained Availability Group, so if you are not planning to use that feature you will not need them. Then again, what happens if you just stop SQL Server and move them elsewhere, I don't know.

    0 comments No comments

  2. LiHongMSFT-4306 30,666 Reputation points
    2024-01-19T08:39:52.2233333+00:00

    Hi To copy files to the new location, we need to stop the SQL Server instance.

    After it stops, it will be possible to move the files to the new location. After we have copied the files to the new folder, we can start the instance by right clicking on the instance name and selecting Start.

    The instance should start successfully.

    Refer to this article for more details.

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.