System and User Databases in SQL Server
In SQL Server, there are two types of databases: system databases and user databases.
SYSTEM DATABASES -
System databases are pre-installed and play a crucial role in the functioning of the SQL Server system. The following are the four main system databases in SQL Server:
Master: contains configuration information for the entire SQL Server instance and acts as the central repository for all system-level metadata. For example, it stores information about logins, linked servers, and system configuration settings.
Model: used as a template for all user databases created on the server. For example, if you want all newly created databases to have the same settings, you can modify the model database to include these settings, and they will be automatically applied to all new databases.
MSDB: used by SQL Server Agent and other features to store information such as job schedules, backup and restore history, and more. For example, the MSDB database stores information about the jobs that SQL Server Agent runs, such as scheduling information and run history.
TempDB: a global temporary database used to store temporary objects and intermediate results. For example, when you run a query that involves sorting or grouping, the intermediate results are stored in the TempDB.
USER DATABASES -
User databases, on the other hand, are databases created by users to store application data. For example, you might create a database to store information about customers, orders, and products for an e-commerce website. User databases can be created from the Management Studio or using T-SQL scripts.
Comments
Post a Comment