Sie sind auf Seite 1von 13

SQL Server 2008 Databases

Types of databases
1. System Databases: used to store system wide data and metadata. 2. User Databases: Created by users who have the appropriate level of permissions to store application data.

System database


master Database

Systemsystem-level information for an instance of SQL Records all the Databases

Server. Is used by SQL Server Agent for scheduling alerts and jobs. Is used as the template for all databases created on the instance of SQL Server. Modifications made to the model database, such as database size, collation, recovery model, and other database options, are applied to any databases created afterward. Is a read-only database that contains system objects that are included with SQL Server. System objects are physically persisted in the Resource database, but they logically appear in the sys schema of every database. Is a workspace for holding temporary objects or intermediate result sets.

msdb Database model Database

Resource Database

tempdb Database

Master Database
The master database records all the system-level information for a SQL Server system. This includes instancewide metadata such as logon accounts, endpoints, linked servers, and system configuration settings. master is the database that records the existence of all other databases and the location of those database files and records the initialization information for SQL Server. Therefore, SQL Server cannot start if the master database is unavailable. In SQL Server, system objects are no longer stored in the masterdatabase; instead, they are stored in the Resource database.

Model Database
The model database is used as the template for all databases created on an instance of SQL Server. Because tempdb is created every time SQL Server is started, the modeldatabase must always exist on a SQL Server system. When a CREATE DATABASE statement is issued, the first part of the database is created by copying in the contents of the model database. The rest of the new database is then filled with empty pages. If you modify the model database, all databases created afterward will inherit those changes. For example, you could set permissions or database options, or add objects such as tables, functions, or stored procedures.

MSDB Database
It is considered as the sql server agent s database as it is responsible for all automated and scheduled operations(i.e. used extensively for the storage of automated job definitions, job schedules, operator definitions, and alert definitions) It is also used by service broker, database mail, Reporting services. For storage of SSIS packages ,it is also used by integration services

tempdb database
The tempdb system database is a global resource that is available to all users connected to the instance of SQL Server Operations tempdb is re-created every time SQL Server is started so that the system always starts with a clean copy of the database. Temporary tables and stored procedures are dropped automatically on disconnect, and no connections are active when the system is shut down. Backup and restore operations are not allowed on tempdb. The size of tempdb can affect the performance of a system. overhead with the growing database can be avoided by increasing the size of tempdb.

Used by sql server to store temporary objects (i.e.temporary tables, views,cursors and table valued variables) Stores work tables containing intermediate results of a query prior to a sort opeartion or any other manipulation(sorting operation would be performed in it and return sorted results) Used to support connection options. It used to hold the following:
Temporary user objects that are explicitly created i.e. temp tables, stored procedures, variables, or cursors. Internal objects that are created by the SQL Server Database Engine, for example, work tables to store intermediate results for spools or sorting. Etc

Resource Database
The Resource database is a read-only database that contains all the system objects that are included with SQL Server. SQL Server system objects, such as sys.objects, are physically persisted in the Resource database, but they logically appear in the sys schema of every database. The Resource database does not contain user data or user metadata. The Resource database makes upgrading to a new version of SQL Server an easier and faster procedure. In earlier versions of SQL Server, upgrading required dropping and creating system objects. Because the Resource database file contains all system objects, an upgrade is now accomplished simply by copying the single Resource database file to the local server. It is not accessible during normal database operations.

The physical file names of the Resource database are mssqlsystemresource.mdf and mssqlsystemresource.ldf. These files are located in <drive>:\Program Files\Microsoft SQL server\MSSQL10_50.<instance_name>\MSSQL\Binn\. Each instance of SQL Server has one and only one associated mssqlsystemresource.mdf file, and instances do not share this file. SQL Server cannot back up the Resource database. The Resource database should only be modified by or at the direction of a Microsoft Customer Support Services (CSS) specialist. The ID of the Resource database is always 32767. Other important values associated with the Resource database are the version number and the last time that the database was updated.

Distribution Databases
It stores metadata and transactional history to support all types of replication on a SQL server One database distribution is sufficient.However if needed,multiple distribution databases can be configured. A model distribution database is installed by default and is used in the creation of a distribution database used in replication. It is installed in the same location as the rest of the system databases and is named distmdl.mdf

SQL Server 2008 Database Storage

Two files to store all system and user databases(including the resource db) Data File (Default extension is .mdf) Transaction log file(Default extension is .ldf)

The default location for the system db files is <drive>:\Program Files\Microsoft SQL Server\MSSQL.X\MSSQL\Data here x is the instance number Only developer can manipulate system databases