Tuesday, January 5, 2010

Resource Database in Sql 2005

The Resource database is a read only, hidden system database that contains
all the SQL Server system objects such as sys.objects which are physically available only in the Resource database,even though they logically appear in the SYS schema of every database.


Advantages of having the resource database:


All service packs,hotfixes applied will be modifying the resource DB, so if there are any issues after installing the service pack and if you want to roll back the installation,just copy the resource mdf and ldf files from the backup.


we can copy resource db while Sql Server is in running mode.

One important point is that Resource db and Master Db should reside in the same folder in Sql 2005 Server.

Its very important for a DBA to include the Resource Database as part of the Disaster Recovery Document and they should ensure
that Resource Database is part of daily back up plan along with other system and user databases.


Restoring Master Databse in SQL 2005

It is always recomemded to document the steps in disater recovery scenarios.
Below are the steps to restore master db in sql 2005 server
Step 1: Stop the SQL SERVICES
Step 2:Enter Command Prompt
Step 3: Go to the path where sqlservr.exe resides.[ default it will be available in : Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn]
Step 4: Execute below query to take the instance into Single User Mode.
sqlservr -c -m
Step 5: Goto MangementStudio-->Cilck on New Query Tab-->Execute Below Query.
RESTORE DATABASE MASTER FROM DISK = '.BAK FILE PATH' WITH REPLACE
Output:
The master database has been successfully restored. Shutting down SQL Server.
SQL Server is terminating this process.
Step 6: Start the services