All below were done on a SQL Server 2005 instance
Restoring MASTER Database!!
- start SQL Server in Single User mode (add -m to the startup parameter)
- You can Google this with lots of results. Microsoft How to on SQL 2008 R2
Restoring MSDB Database
- This is easy, just restore like a user database
Restoring MODEL Database!
- Restore model in RECOVERY mode, never in NORECOVERY mode as SQL Server will stop (due to tempdb unable to create, without a model database)
- If you did NORECOVERY, the only way to get in is manual work.
For me, I started it and detach-and-attach the model database that I copy from another location, as one cannot issue RESTORE command in Single-User mode
net start MSSQLSERVER /c /m /T3608 (you can go into SQL BINN and run sqlserver -c -m -T3608 as well)
sqlcmd -E (to connect to the SQL Server)
Detach and Re-attach model databasesp_detach_db 'model'
sp_attach_db 'model', 'DATA.mdf', 'LOG.ldf'
|Command line parameter||Use|
|-c||Forces an instance of SQL Server not to start as a service.|
|-m||Allows updates to the system catalog.|
|-T3608||Recovers the master database only.|