Friday, September 9, 2011

My SharePoint_Config Database fall over go bang

The other day I was tibnkering on my new demo rig (I love SSD's) and the whole OS Drive locked up on my, causing me to hard-crash the machine.


Uh-ho i thought... my VM was running at crash point... better check it over.


Lo and behold, my rig was dead on reboot.  Upon review my config_db was suspect - go figure - and I had to try and get it back (as I was going to lose quite a lot of work if i didn't).


So after a little trawl around I found the following.  I hope it helps someone else in the future:


Run this in SQL:



               alter database “Sharepoint_config” set emergency


Set DB to single user mode 



Run this in SQL to find the SPID for the connection to the Config_DB


                sp_who2


disconnect from SQL
ensure SQL Browser service started
open SQL Mgt but dont connect to the server
New Query


               Kill SPID# from SP_WHO2 (where # is the SPID noted previously)


use Sharepoint_config
dbcc checkdb ("sharepoint_config", repair_allow_data_loss)


Run the following SQL


               ALTER DATABASE DBNAME
               SET MULTI_USER


Your DB should now be back and happy