Tuesday, 3 March 2015

Databases


There are 3 types of databases in SQL, they are as follows

  1. System databases
  2. User databases
  3. Sample database

System databases: These are the default databases.There are 5 system databases, they are 

  1. Master
  2. Model
  3. Msdb
  4. Tempdb
  5. Resource

Master: It is the core database in server, without master, server won't start.Master database will store all the system objects physically. Master database will maintain the logins information, linked servers information, files of each database and end points information will be stored.The recovery model for the master database is simple.

Model: It is a template database for all the user defined databases. User defined databases are inherited from the model database that means user defined database acquires the same properties of the model database.The recovery model for the model database is full.

Msdb: Msdb is used to manage the SQL server agent configurations ie., scheduling alerts and jobs. If msdb is down,sql server agent goes down then there is no automation. It will maintain all the automation's in the server.The recovery model for the master database is simple.

Tempdb: Tempdb is used to store the temporary objects ie., tables, objects, views etc. each time sql server instance is restarted all the temp objects are flushed out or destroyed, so permanent objects cant be created in tempdb. The recovery model for the master database is simple. If tempdb is full then performance issues will raise, it has to be restart the server and restarting the server is not possible then we are recycling the log file or creating new log file by using sp_cycle_errorlog.

Resource: Resource database is the hidden database and it is a read only database which contains all  the system objects stored physically, and logically stored in all the system databases.






No comments:

Post a Comment