Posted At : Nov 22, 2010 12:47 PM
| Posted By : Ed Tabara
Related Categories:
SQL
This weekend had a
hair pulling moment when noted that on one of my sites the DB was down with a
"SUSPECT" mark on it. Checking through logs told me that at restart replication didn't went well. Tried many different things to solve the problem but nothing worked till found a short list of commands that worked just FINE! maybe i lost a couple of broken records but that's fine taking in mind that nothing else worked and i was about to lose everything.
So here is the magic code:
EXEC sp_resetstatus ?DBname?;
ALTER DATABASE DBname SET EMERGENCY
DBCC checkdb(?DBname?)
ALTER DATABASE DBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (?DBname?, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE DBname SET MULTI_USER
Hope it saves someone else nerves.

Comments (0) |
Print |
| 1300 Views
| 3% / 0% Popularity