Imagine you lose master DB

· Uncategorized
Authors

Imagine, you lose the disk where your master DB is located on. It can happen to the best of us. Today it happened to me.
Luckily, we had a copy of all DB files. Don’t ask why.
This is what needs to be done:

  1. Stop panicking; SQL Server is not sensitive to emotions
  2. Copy all system DB files to a new location. Don’t bother copying tempdb files as these will be created from scratch.
  3. Adapt the startup parameters of the SQL server service to the new location of the master DB files
  4. Start SQL server in single user mode (sqlservr -c -m -f)
  5. Connect using SQLCMD and alter the mssqlsystemresource  DB to use the new location of its DB files
  6. Restart SQL server in single user mode
  7. Connect using SQLCMD and alter model, msdb and tempdb to use the new location of its DB files
  8. Stop SQL server and start in full access mode.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: