Partilhar via


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 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. Similarly, rolling back system object changes in a service pack only requires overwriting the current version of the Resource database with the older version.

Physical Properties of Resource

The physical file name of the Resource database are mssqlsystemresource.mdf and mssqlsystemresource.ldf. By default, these files are located in <drive>:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\. Each instance of SQL Server has one and only one associated mssqlsystemresource.mdf file, and instances do not share this file. In a cluster, the Resource database exists in the \Data folder on a shared disk.

The Resource database depends on the location of the master database. If you move the master database, you must also move the Resource database to the same location. For more information, see Moving System Databases. Also, do not put the Resource database in either compressed or encrypted NTFS file system folders. Doing so will hinder performance and prevent upgrades.

Backing Up and Restoring the Resource Database

SQL Server cannot back up the Resource database. You can perform your own file-based or a disk-based backup by treating the mssqlsystemresource.mdf file as if it were a binary (.EXE) file, rather than a database file, but you cannot use SQL Server to restore your backups. Restoring a backup copy of mssqlsystemresource.mdf can only be done manually, and you must be careful not to overwrite the current Resource database with an out-of-date or potentially insecure version.

Important

After restoring a backup of mssqlsystemresource.mdf, you must reapply any subsequent updates.

Accessing the Resource Database

The Resource database should only be modified by or at the direction of a Microsoft Customer Support Services (CSS) specialist. The only supported user action is to move the Resource database to the same location as the master database. For more information, see Moving System Databases.

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.

To determine the version number of the Resource database, use:

SELECT SERVERPROPERTY('ResourceVersion');
GO

To determine when the Resource database was last updated, use:

SELECT SERVERPROPERTY('ResourceLastUpdateDateTime');
GO

To access SQL definitions of system objects, use the OBJECT_DEFINITION function:

SELECT OBJECT_DEFINITION(OBJECT_ID('sys.objects'));
GO

See Also

Concepts

System Databases
Using a Dedicated Administrator Connection
Starting SQL Server in Single-User Mode

Other Resources

OBJECT_DEFINITION (Transact-SQL)
SERVERPROPERTY (Transact-SQL)
How to: Rebuild the Master Database for SQL Server 2005

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

14 April 2006

Changed content:
  • Corrected the information about backing up and restoring mssqlsystemresource.mdf.
  • Clarified the supported user actions in the section 'Accessing the Resource Database".

5 December 2005

Changed content:
  • Corrected the content about moving the Resource database.