Turn: The role of the Sql Server system database

Reprint link: http://blog.csdn.net/wgw335363240/article/details/6905459

Reprinted content:

The system database of Sql Server is divided into: master, model, msdb and tempdb . These four databases perform their own duties in SQL Server. As a research and development personnel, it is necessary to understand the responsibilities of these databases. Let's take a look at these The role of several databases.

 

1. Master database

The Master database records all system level information (table sysobjects) of the SQLServer system. He records all login accounts (table sysusers) and system configuration . The Master database is a database that records all other databases (tables sysdatabases), including the location of database files. The Master database records the initialization information of SQL Server , and he always points to an available backup of the latest Master database.

 

2. Model database

The Model database is used as a template for creating databases on the system . When the system receives the "Create DATABASE" command, the first part of the newly created database is copied from the Model database, and the rest is filled with empty pages, so there must be a Mode database in the SQL Server data.

 

3. Msdb database

The Msdb database is used by SQL Server Agent when scheduling alerts and jobs and logging operators . For example, if we back up a database, a record will be inserted into the table backupfile to record the relevant backup information.

 

4. Tempdb database

Tempdb database saves temporary tables and stored procedures generated during system operation . Of course, it also satisfies other temporary storage requirements, such as saving storage tables generated by SQL Server. The Tempdb database is a global advisory in which any user connected to the system can generate temporary tables and stored procedures. The contents of the Tempdb database will be emptied every time SQL Server is started, so every time SQL Server is started, the table will be clean. Temporary tables and stored procedures are automatically dropped after disconnection, and there will be no active connections when the system shuts down, so nothing in the tempdb database will be saved from one session of SQL Server to another.

By default, the tempdb database automatically grows as needed while SQL Server is running. However, unlike other databases, the database engine is reset to its original size each time it is started. If the size defined for the tempdb database is small, the work of automatically increasing the size of the tempdb database to the size required to support the workload may become part of the system processing load each time SQL Server is restarted. To avoid this overhead, use ALTER DATABASE to increase the size of the tempdb database.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326533344&siteId=291194637