Question

There is a database called Resource database, which I know that is read only and contains information about system objects and does not save any user related data or metadata. I am using SSMS to manage my database instance and I can only see four system databases - master, model, msdb, tempdb. I'd like to know where can I find Resource database using SSMS? Or is Resource database intentionally invisible for users?

Thanks for your time.

Was it helpful?

Solution

The mssqlsystemresource database is hidden intentionally. The mssqlsystemresource is largely an implementation detail that allows the SQL Server installation and upgrade process to deploy new system objects versions without recreating objects in the master database as was done in SQL Server 2000 and earlier.

The physical location the mssqlsystemresource database files is a well-known documented location. In SQL Server 2008 and later versions, this is the instance BINN folder (e.g. C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Binn) together with other SQL Server binaries. In SQL Server 2005, the mssqlsystemresource were located in the same data folder as the master database files.

For learning, you can copy the mssqlsystemresource.mdf and mssqlsystemresource.ldf to a user data folder, change file permissions, and attach the database using a different database name. This should only be done on an isolated test instance and will allow you to easily view the system objects in the mssqlsystemresource database using SSMS.

CREATE DATABASE mssqlsystemresource_copy
    ON(NAME='data', FILENAME='D:\SqlDataFiles\mssqlsystemresource.mdf')
    LOG ON(NAME='log', FILENAME='D:\SqlDataFiles\mssqlsystemresource.ldf')
    FOR ATTACH;
GO

OTHER TIPS

I'd like to know where can I find Resource database using SSMS? Or is Resource database intentionally invisible for users?

You cannot find it using SSMS. The physical file location of resource database for versions SQL Server 2008 and later is

These files are located in :\Program Files\Microsoft SQL Server\MSSQL.\MSSQL\Binn\ and should not be moved

In SQL Server 2005 users were allowed to copy the resource database off to another location when they moved master database files. If you read SQL Server 2005 Master Database content it says that

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.

Since it was documented so users started moving it and playing around with it by moving to the different location. This has repercussions though many users complained that after moving resource database when they tried applying a service pack or CU update it failed.

The failure caused in SQL Server 2005 service pack upgrade which was eventually caused by movement of resource database location led to change in resource database location and it was decided that resource database would reside in the BINN folder along with the rest of the binaries. It's specifically in BINN folder because it does not contains any USER data only information related to SQL Server. Also, users would not touch files present in BINN folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top