Are you having any luck with this?
Main Topics
Browse All Topicshow do you recover suspect database in SQL database?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
:-)
I'm not here for the points... if you want to give them to someone else, be my guest.
So here it goes:
This is a little bit tricky but it works on every database you might have:
Because this procedure modifies the system tables, the system administrator must enable updates to the system tables before creating this procedure. To enable updates, use this procedure.
use master
go
sp_configure 'allow updates',1
go
reconfigure with override
go
The sp_resetstatus procedure can be executed only by the system administrator.
ALWAYS SHUT DOWN SQL Server IMMEDIATELY AFTER executing this procedure.
Syntax: sp_resetstatus database_name
Example: sp_resetstatus PRODUCTION
Database 'PRODUCTION' status reset!
WARNING: You must reboot SQL Server prior to
accessing this database!
Stored Procedure Code:
CREATE PROC sp_resetstatus @dbname varchar(30) AS
DECLARE @msg varchar(80)
IF @@trancount > 0
BEGIN
PRINT "Can't run sp_resetstatus from within a transaction."
RETURN (1)
END
IF suser_id() != 1
BEGIN
SELECT @msg = "You must be the System Administrator (SA)"
SELECT @msg = @msg + " to execute this procedure."
RETURN (1)
END
IF (SELECT COUNT(*) FROM master..sysdatabases
WHERE name = @dbname) != 1
BEGIN
SELECT @msg = "Database '" + @dbname + "' does not exist!"
PRINT @msg
RETURN (1)
END
IF (SELECT COUNT(*) FROM master..sysdatabases
WHERE name = @dbname AND status & 256 = 256) != 1
BEGIN
PRINT "sp_resetstatus can only be run on suspect databases."
RETURN (1)
END
BEGIN TRAN
UPDATE master..sysdatabases SET status = status ^ 256
WHERE name = @dbname
IF @@error != 0 OR @@rowcount != 1
ROLLBACK TRAN
ELSE
BEGIN
COMMIT TRAN
SELECT @msg = "Database '" + @dbname + "' status reset!"
PRINT @msg
PRINT " "
PRINT "WARNING: You must reboot SQL Server prior to "
PRINT " accessing this database!"
PRINT " "
END
go
After the procedure is created, immediately disable updates to the system tables:
sp_configure 'allow updates',0
go
reconfigure with override
go
Ok, that's all.
From this point forward, you may reset the suspect status on any database by calling sp_resetstatus "db_name"
Both the answers are perfectlu correct but surely the most important thing is finding why the database is suspect and the repairing that. One particluarly nasty reason for the database to become suspect is the deletion of a log file!
I would advise that the advise previously given of looking through the error log followed and action taken to prevent the problem occuring again.
SQL Server is very weak on its implementation. I've worked with it for several years and every now and then it corrupts it's own data!
Sometimes this is due to system abnormal shutdown and the SQL Server recover mechanism is not the best I've seen.
I'm sorry to say that but since I've changed to Oracle everything turned out different. It's more stable, it's recovering works flawlessly, it's fast, the PL/SQL language is easier to understand and code...
.... and I do not intend to get back to SQL Server for the next years.
best regards.
GREETING!
This question was awarded, but never cleared due to the JSP-500 errors of that time. It was "stuck" against userID -1 versus the intended expert whom you awarded. This corrects the problem and the expert will now receive these points; points verified.
Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them. If you are an EE Pro user, you can also choose Power Search to find all your open questions.
This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added. You'll also find a link there for Experts who wish to participate in the cleanup effort of old and abandoned questions.
http://www.experts-exchang
http://www.experts-exchang
Thank you,
Moondancer
Moderator @ Experts Exchange
Business Accounts
Answer for Membership
by: mayhewPosted on 1999-07-05 at 19:40:02ID: 1096171
If you start the SQL Server before giving external storage devices a chance to warm up, or perhaps if a drive comes unplugged, the server will detect a failure of the device and mark all databases mapped to that device as SUSPECT.
Having that value in the status column will prevent the server from ever trying to recover that database. In order to regain access to the database, you need to turn off that bit and restart the SQL Server.
You can do this manually by logging in as sa and doing the following:
use master
go
sp_configure "allow updates", 1
reconfigure with override
go
update sysdatabases
set status = status - 256
where name = "your database name here"
and status & 256 = 256
go
sp_configure "allow updates", 0
reconfigure
go
WARNING: Be sure you read through the error log and that you understand why the database was not recovered.
Hope this helps!