5 types of system database in SQL:
1) Master database
2) Resource database
3) Tempdb database
4) Model database
5) msdb database
1) Master database
- The ''VID''(very important database) of the SQL. Without this database, the server cannot be started. (because it store the initializing information)
- Act as a identity card for the server, because it store all the system level information.
(store all the authorized user information, logon accounts, system configuration settings and others metadata)
- The system object used to store in this master database but it is now in the resource database.
- Physical file : master.ldf and master.mdf
- It is not advise to : change any logon information or change information in the master database. In fact, a lot of changing, dropping, renaming, creating action is not allowed in this database. ( as per mention in msdn.
- If you have to do something with the master database, such as create user object , you are advice to backup the master database. In case of the master database unusable, you can restore the master database or rebuild the master (this is for severe damage, server not able to restart , and this will cause all the system database being rebuild ) .
2. Resource database
- A read-only database
- It contains all the SQL server system object(e.g. sys.object) but do not contain user metadata(e.g. user logon).
- Since the system object stored in resource database, the process of upgrading the newer version of SQL become faster and easier. This is due to there is no need to drop and create system object, just need to copy the single resource file to the local server.
3. Tempdb database
- As the per mention in the name, this is a temporary database. This means that whenever a server offline, all the data(e.g. temporary table, store procedure, view, etc) is deleted. Nothing will be saved.
- The object is created explicitly. Used as a temporary storage place, for example, a temporary working table to store some immediate result of some result based on sorting or order by.
- Size, the size of the tempdb is not advisable to be too small. System processing could be too occupied by auto-growing database that support workload requirement if it is too small, this will affect the performance.
4. Model database
- As a template to all database.
- Must exist. Some setting also being use during the start-up (creation) of the tempdb.
- When "CREATE DATABASE" statement is issue, the first part of the database is created by copying the content of model database.
- Physical file : 1) model.mdf & 2)modellog.ldf
- The model database can be modified but the newly create database afterward will inherit the same behavior. There are some actions that are not allowed such as dropping the guest user, changing the owner from sa user, removing primary file group and etc.
5. msdb database
- This database is used by the sever.
- Use by SQL server agent for scheduling alert and jobs
- To do some logging or data storing of some processes such as who, when, where to and what had be backup. It then uses this information to propose the restoring database's plan.
- Physical file: 1)MSDBData.mdf & 2)MSDBLog.ldf
- There are also some actions that are not allowed such as participating in data mirroring , setting database to OFFLINE and etc.
No comments:
Post a Comment