- Rebuilding and Recovering the <tt>master</tt> Database
- Potential Problems in Rebuilding and Restoring the <tt>master</tt> Database
- Recovering Other Databases after <tt>master </tt> Has Been Rebuilt
- Notes on Logins and Users after a <tt>master</tt> Rebuild
- Program to Generate Logins from the User Database
- Remapping Orphaned Users
- Recovering msdb
- Summary
Potential Problems in Rebuilding and Restoring the master Database
The following are three potential rebuilding and restoring problems and fixes:
Problem 1: The rebuildm.exe tool gets caught in an infinite loop. It should only take a few minutes to rebuild.
Fix: Rebuildm.exe may have problems with the read-only attributes on the CD for the master data files. Copy them to a local hard drive and then run the following command:
C:\tmp\master> attrib -r *.*
This will take the read-only attributes off and the rebuildm.exe should run.
Problem 2: You try and restore the master from a backup and you get the following error:
restore database master from master_backup go Server: Msg 3108, Level 16, State 1, Line 1 RESTORE DATABASE must be used in single user mode when trying to restore the master database. Server: Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally.
Fix: Put the SQL Server into single-user mode via the command line. Execute the following from the BINN directory:
sqlservr.exe -c -m
Problem 3: Trying to put the master database into single-user mode via sp_dboption or Alter database results in the following error:
sp_dboption master, 'single user', true go /* Server: Msg 5058, Level 16, State 5, Line 1 Option 'SINGLE_USER' cannot be set in database 'MASTER'. sp_dboption command failed. */
Fix: Place the SQL Server into single-user mode via the command line. You need to stop SQL Server and restart it by executing the following from the BINN directory:
sqlservr.exe -c -m