• I finally figured it out. The is one of those things Bill Gates once described as a "puzzle you're supposed to figure out." BOL doesn't give you enough information to pull it off, and the process for SQL 2005 and 2008 described several blog posts doesn't work in 2008 R2.

    This is what works when the master database in SQL 2008 R2 is lost or too corrupted to allow SQL Service to start. This assumes you have backups of the system databases. If you're not making these for all your instances, put that at the top of your to-do list.

    1) Open a command prompt using the AS Administrator option and navagate to

    C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\SQLServer2008R2(This is a different folder than for SQL 2008 - that one just gives you cryptic errors on step 2 below)

    2) Run setup.exe /ACTION=REBUILDDATABASE /INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS=<current admin account>

    Use your instance name instead of MSSQLSERVER if repairing a named instance. Add /SAPWD=<sa password> if using Mixed Mode, and /SQLCOLLATION=<collation> if not using the default (SQL_Latin1_General_CP1_CS_AS>. This will rebuild the system databases from templates.

    3) In SQL Configuration Manager, add the single user mode switch -m; to the Start Parameters do not leave a space before the other parameters. Launch the Instance. This will launch SQL Server in single user mode.

    4) Run SQLCMD in the command window. Enter the following

    1>restore database master from disk = '<path to master backup file>' with replace

    2>go

    When the master database is restored, SQL service will shut itself off.

    5) Go back to SQL Configuration Manager. Remove the Single User Mode switch -m; from the Startup Parameters. Start the SQL Server Instance.

    6) Launch SQL Management Studio and restore the MSDB database from your backup file. This will restore all your SQL Agent jobs. If you have modified the Model database, restore that one from backup too.

    Later I'll check SQL 2012 BOL to see if the procedure for 2012 is documented there. I'm out of here for the day...