model_msdbdata and log, model_replicatedmaster and log – What are they?

There was a question that came up on the MCM mailing list about what are these files: model_msdbdata.mdf, model_msdblog.ldf, model_replicatedmaster.mdf, model_replicatedmaster.ldf? It was pointed out that the files don’t show up in the typical DMVs and seem to not really be used at the moment.

These are the databases used as the basis for the system databases in contained availability groups. Definitely don’t touch them, just leave them be, even if you aren’t using availability groups (let alone contained).

Much as was noted above, the databases don’t show up in the typical catalog views:

These databases are *special* databases (sort of like how resource is special, but resource is used differently) and should be treated as system databases. You’ll need to check the actual base tables that don’t filter out internal usages in order to see them:

If, for some reason, you feel the need to move them, don’t. These are tiny databases, there shouldn’t be that huge of a need to move them. If you don’t have a few MB left on the disk and it just _must_ be moved or some “requirements” document says they must, you have other more pressing issues.

This is thrown at the following, so it’s part of startup. Since the databases aren’t shown to the user in any way, I would just leave them there for now. I was messaged and told that you alter the database and change the location as if it were a normal database, which does seem to work! I still don’t see a need to move them, though. Seems like an unnecessary amount of handling for nothing.

ALTER DATABASE model_msdb MODIFY FILE ( NAME = MSDBData, FILENAME = 'X:\Your_Location\model_msdbdata.mdf');
ALTER DATABASE model_msdb MODIFY FILE ( NAME = MSDBLog, FILENAME = 'X:\Your_Location\model_msdblog.ldf');

ALTER DATABASE model_replicatedmaster MODIFY FILE ( NAME = replicatedmaster, FILENAME = 'X:\Your_Location\model_replicatedmaster.mdf');
ALTER DATABASE model_replicatedmaster MODIFY FILE ( NAME = replicatedmasterlog, FILENAME = 'X:\Your_Location\model_replicatedmaster.ldf');

Thanks to everyone who responded and let me know! Learned something new!

4 thoughts on “model_msdbdata and log, model_replicatedmaster and log – What are they?”

    1. Thanks! I didn’t have much time to respond as thoroughly via email this weekend as I wanted. Hopefully this helps 🙂

  1. Thank you Sean for this great post.
    Trying to know about this since 2 months and landed here. Yes, DMV, master_files didn’t show about it but when I did look on to System Database files directory, these 4 new files appeared.
    Is this purely related to “Contained Database” or does this come with SQL Server 2022 any version (Developer or Enterprise or so)?

    Thank you.

    1. It’s for contained availability groups but will be present in all editions of SQL 2022 and forward.

Comments are closed.