Wednesday, May 6, 2009

SQL databse suspect

Well a power outage today killed my SQL database. Seems the database was in suspect mode. I got tons of errors. Logs pointed towards SQL so I tried the following:

EXEC sp_resetstatus ‘DBname’;
go
ALTER DATABASE DBname SET EMERGENCY
go
DBCC checkdb(’DBname’)
go
ALTER DATABASE DBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
go
DBCC CheckDB (’DBname’, REPAIR_ALLOW_DATA_LOSS)
go
ALTER DATABASE DBname SET MULTI_USER
go

I ran that in sql server management studio as a query. It fixed alot of errors but still had alot. I ended up running the SCCM 2007 disk again and picked to reconfigure the SQL section. Now my console is back up and running. Must warn you that the above can lose data if it can't be recovered.

No comments:

Post a Comment