08-System Databases in SQL Server 2005 PDF
08-System Databases in SQL Server 2005 PDF
System databases store metadata regarding the databases available in the instance
Description Records all the system-level information for an instance of SQL 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 2005. 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. 2
model Database
master Database
Records all the system-level information for a SQL Server instance. This includes: instance-wide metadata such as logon accounts, endpoints, linked servers, and system configuration settings, other databases and the location of those database files initialization information for SQL Server. Therefore, SQL Server cannot start if the master database is unavailable. In SQL Server 2005, system objects are stored in the Resource database. Contains the so-called system tables and views
3
File growth Autogrow by 10 percent until the disk is full. Autogrow by 10 percent to a maximum of 2 terabytes.
Model Database
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.
Resource Database
The Resource database is a read-only database that contains all the system objects that are included with SQL Server 2005. 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 is not visible from Management Studio Can be used only in single user mode and for troubleshooting
7
tempdb Database
It is a global resource that is available to all users connected to the instance of SQL Server It is used to hold the following: Temporary user objects that are explicitly created, such as: global or local temporary tables, temporary stored procedures, table variables, or cursors. Internal objects that are created by the SQL Server 2005 Database Engine, for example, work tables to store intermediate results for sorting. Operations within tempdb are minimally logged. This enables transactions to be rolled back. 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
8
10
System Catalog
Is the collections of metadata, or data about the objects of databases, such as: Tables, columns, indexes, views It is used by dynamic applications: applications that are not hard-coded to work with a specific set of tables and views must have a mechanism for determining the structure and attributes of the objects in any database to which they connect
11
12
Catalog Views
All user-available catalog metadata is exposed through catalog views. They are the views of the master database They belong to the schema sys Examples: sys.partitions sys.system_internals_allocation_units sys.database_files sys.tables sys.views
13