The master database records all the system-level information for a SQL Server system. This includes instance-wide metadata such as logon accounts, endpoints, linked servers, and system configuration settings. In SQL Server, system objects are no longer stored in the master database; instead, they are stored in the Resource database. Also, master is the database that records the existence of all other databases and the location of those database files and records the initialization information for SQL Server. Therefore, SQL Server cannot start if the master database is unavailable.
For Azure SQL Database logical server, only master Database and tempdb Database apply. For the concept of a logical server and logical master database, see What is an Azure SQL logical server?. For a discussion of tempdb in the context of Azure SQL Database, see tempdb Database in Azure SQL Database. For Azure SQL Database Managed Instance, all system databases apply. For more information on Managed Instances in Azure SQL Database, see What is a Managed Instance
Physical Properties of master
The following table lists the initial configuration values of the master data and log files. The sizes of these files may vary slightly for different editions of SQL Server.
|File||Logical name||Physical name||File growth|
|Primary data||master||master.mdf||Autogrow by 10 percent until the disk is full.|
|Log||mastlog||mastlog.ldf||Autogrow by 10 percent to a maximum of 2 terabytes.|
For information about how to move the master data and log files, see Move System Databases.
The following table lists the default value for each database option in the master database and whether the option can be modified. To view the current settings for these options, use the sys.databases catalog view.
|Database option||Default value||Can be modified|
|Database Availability Options||ONLINE
|Service Broker Options||DISABLE_BROKER||No|
For a description of these database options, see ALTER DATABASE (Transact-SQL).
The following operations cannot be performed on the master database:
Adding files or filegroups.
Changing collation. The default collation is the server collation.
Changing the database owner. master is owned by sa.
Creating a full-text catalog or full-text index.
Creating triggers on system tables in the database.
Dropping the database.
Dropping the guest user from the database.
Enabling change data capture.
Participating in database mirroring.
Removing the primary filegroup, primary data file, or log file.
Renaming the database or primary filegroup.
Setting the database to OFFLINE.
Setting the database or primary filegroup to READ_ONLY.
When you work with the master database, consider the following recommendations:
Always have a current backup of the master database available.
Back up the master database as soon as possible after the following operations:
Creating, modifying, or dropping any database
Changing server or database configuration values
Modifying or adding logon accounts
Do not create user objects in master. If you do, master must be backed up more frequently.
Do not set the TRUSTWORTHY option to ON for the master database.
What to Do If master Becomes Unusable
If master becomes unusable, you can return the database to a usable state in either of the following ways:
Restore master from a current database backup.
If you can start the server instance, you should be able to restore master from a full database backup. For more information, see Restore the master Database (Transact-SQL).
Rebuild master completely.
If severe damage to master prevents you from starting SQL Server, you must rebuild master. For more information, see Rebuild System Databases.
Rebuilding master rebuilds all of the system databases.