Você está na página 1de 2

1|Page

DATATECH IT INC

E - m a i l :

d . t e c h 1 4 0 1 @ g m a i l . c o m

SQL SERVER SYSTEM DATABASES


SQL Server uses system DBs to support different parts of the DB management system (DBMS). Each DB plays a specific role and
stores info that SQL Server needs to do its job. The system DBs are much like the user DBs generated in SQL Server. They store data
in tables and contain the views, stored procedures, and other DB objects that you also see in user DBs. They also have associated DB
files (that is, .MDF AND .LDF FILES) that are physically located on the SQL Server machine.

The folder where each of these DB files is located depends on the SQL Server installation. By default, the
installation process places these files in a folder named C:\Program Files\MS SQL Server\MSSQL. 1
\MSSQL\Data\.
MASTER DB
The master DB contains server-wide info about the SQL Server system.
This server-wide info includes logins, linked server info, config info for the server, and info about user DBs
generated in the SQL Server.
The actual locations of the DB files and key properties that relate to each user DB are stored in the master DB.
SQL Server cant start without a master DB. This is not surprising, given the type of info that it contains.
Without the master DB, SQL Server does not know the location of the DBs that it services and does not know
how the server is configured to run.
MODEL DB
The model DB is a template on which all user-generated DBs are based.
All DBs need to contain a base set of objects known as the DB catalog.
When a new DB is generated, the model is copied to create the requisite objects.
Conveniently, objects can be added to the model DB.
As an example, if you want a certain table generated in all your DBs, you can create the table in the model DB,
and it is then propagated to all subsequently generated DBs.

MSDB DB

The msdb DB is used to store info for the SQL Server Agent, the Service Broker, DB Mail, log shipping, and
more.
When you create and schedule a SQL Server Agent job, the job's parameters and execution history are STORED
IN MSDB.
Backups and maintenance plan info are stored in msdb as well.
If log shipping is implemented, critical info about the servers and tables involved in this process is stored in
MSDB.

TEMPDB DB
The tempdb DB stores temporary data and data objects.
The temporary data objects comprise temporary tables, temporary stored procedures, and any other objects you
can want to create temporarily.
The longevity of data objects in the temporary DB depends on the type of object generated. Ultimately, all
temporary DB objects are removed when the SQL Server service is restarted.
The tempdb DB is re-generated, and all objects and data added since the last restart of SQL Server are lost.

2|Page

DATATECH IT INC

E - m a i l :

d . t e c h 1 4 0 1 @ g m a i l . c o m

tempdb can also be used for some of SQL Server's internal operations. Large sort operations are performed in
tempdb before the result set is returned to the client.
Certain index operations can be performed in tempdb to offload some of the space requirements or to spread I/O.
SQL Server also uses tempdb to store row versions that are produced from DB modifications in DBs that use row
versioning or snapshot isolation transactions.

RESOURCE DB

The resource DB contains all the system objects deployed with SQL Server.
These system objects comprise the system stored procedures and system views that logically appear in each DB
but are physically stored in the resource DB.
MS moved all the system objects to the resource DB to simplify the upgrade process.
When a new release of the software is made available, upgrading the system objects is accomplished by simply
copying the single resource DB file to the local server.
Similarly, rolling back an upgrade only requires overwriting the current version of the resource DB with the older
version.
You do not see the resource DB in the list of system DBs shown in SQL Server Management Studio (SSMS).
You also cant add user objects to the resource DB.
For the most part, you should not be aware of the existence of the resource DB.
It has DB files named mssqlsystemresources.mdf and mssqlsystemresources.ldf that are located in the Binn
folder, but you cant access the DB directly.
In addition, you do not see the DB listed when selecting DBs using system views or with system procedures, such
as sp_helpdb.

DISTRIBUTION DB

The distribution DB, utilized during replication, stores metadata and history info for all types of replication.
It is also used to store transactions when transactional replication is utilized.
By default, replication is not set up, and you do not see the distribution DB listed in SSMS.
However, the actual data files for the distribution DB are installed by default.

Você também pode gostar