

SELECT name, physical_name AS current_file_location If you have moved system database data or log files to a different location, you must move the files again. Rebuilding the system databases installs all system databases to their original location. Record the current location of all data and log files for the system databases. SERVERPROPERTY('Collation') AS Collation SERVERPROPERTY('ResourceLastUpdateDateTime') AS ResourceLastUpdateDateTime, SERVERPROPERTY('ResourceVersion') AS ResourceVersion, SERVERPROPERTY('ProductLevel') AS ProductLevel, SERVERPROPERTY('ProductVersion ') AS ProductVersion, You must reapply these hotfixes after rebuilding the system databases. Record all hotfixes applied to the instance of SQL Server and the current collation. Record all server-wide configuration values. Perform the following tasks before you rebuild the system databases to ensure that you can restore the system databases to their current settings.

For example, you may have user-defined objects in the master database, scheduled jobs in msdb, or changes to the default database settings in the model database. Any user modifications to these databases are lost. If a new collation is specified in the rebuild statement, the system databases are created using that collation setting. When the master, model, msdb, and tempdb system databases are rebuilt, the databases are dropped and recreated in their original location. This article provides step-by-step instructions to rebuild system databases in SQL Server. System databases must be rebuilt to fix corruption problems in the master, model, msdb, or resource system databases, or to modify the default server-level collation.
