Skip to content

Latest commit

 

History

History
76 lines (49 loc) · 5.7 KB

system-databases.md

File metadata and controls

76 lines (49 loc) · 5.7 KB
title description author ms.author ms.date ms.service ms.topic helpviewer_keywords monikerRange
System Databases
System Databases
WilliamDAssafMSFT
wiassaf
01/28/2019
sql
conceptual
system databases [SQL Server]
displaying system database data
modifying system data
viewing system database data
=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current

System Databases

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance]

[!INCLUDEssNoVersion] includes the following system databases.

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

Important

For Azure SQL Database single databases and elastic pools, only master Database and tempdb Database apply. For more information, see What is an Azure SQL Database server. For a discussion of tempdb in the context of Azure SQL Database, see tempdb Database in Azure SQL Database. For Azure SQL Managed Instance, all system databases apply. For more information on Managed Instances in Azure SQL Database, see What is a Managed Instance

Modifying System Data

[!INCLUDEssNoVersion] does not support users directly updating the information in system objects such as system tables, system stored procedures, and catalog views. Instead, [!INCLUDEssNoVersion] provides a complete set of administrative tools that let users fully administer their system and manage all users and objects in a database. These include the following:

  • Administration utilities, such as [!INCLUDEssManStudioFull].

  • SQL-SMO API. This lets programmers include complete functionality for administering [!INCLUDEssNoVersion] in their applications.

  • [!INCLUDEtsql] scripts and stored procedures. These can use system stored procedures and [!INCLUDEtsql] DDL statements.

These tools shield applications from changes in the system objects. For example, [!INCLUDEssNoVersion] sometimes has to change the system tables in new versions of [!INCLUDEssNoVersion] to support new functionality that is being added in that version. Applications issuing SELECT statements that directly reference system tables are frequently dependent on the old format of the system tables. Sites may not be able to upgrade to a new version of [!INCLUDEssNoVersion] until they have rewritten applications that are selecting from system tables. [!INCLUDEssNoVersion] considers the system stored procedures, DDL, and SQL-SMO published interfaces, and works to maintain the backward compatibility of these interfaces.

[!INCLUDEssNoVersion] does not support triggers defined on the system tables, because they might modify the operation of the system.

Note

System databases cannot reside on UNC share directories.

Viewing System Database Data

You should not code [!INCLUDEtsql] statements that directly query the system tables, unless that is the only way to obtain the information that is required by the application. Instead, applications should obtain catalog and system information by using the following:

  • System catalog views

  • SQL-SMO

  • Windows Management Instrumentation (WMI) interface

  • Catalog functions, methods, attributes, or properties of the data API used in the application, such as ADO, OLE DB, or ODBC.

  • [!INCLUDEtsql] system stored procedures and built-in functions.

Related Tasks

Related Content