Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 nightmare! how to handle db in suspect?

Author  Topic 

wyx2000
Starting Member

5 Posts

Posted - 2010-11-15 : 19:20:44
I have two sql servers, db 1 in server A is in suspect after restart the sql service on server A. The db 1 is a Principal db which is in mirroring with a db in server B.
I tried to find solution to fix the suspect db. Here is what I tried
1, update sys table to set the status of the db 1 to emergency. I failed to do it since SQL server 2005 doesn;t allow change to system table.
2, I tried to ALTER DATABASE db1 SET EMERGENCY, I got "Database db1 cannot be opened. It has been marked SUSPECT by recovery."
3, I then tried ALTER DATABASE ablebase SET PARTNER OFF, it tells me the db1 is in suspect, cannot change.

Any idea? thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-15 : 19:49:31
Have you tried sp_resetstatus? http://msdn.microsoft.com/en-us/library/ms188424.aspx

Have you figured out why it's suspect such as by checking the Application and System Logs in Event Viewer?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-11-16 : 00:28:11
First. Do not detach that database. Do not restart the server.

I would honestly suggest that you fail over the mirroring (force if necessary), though it should have failed over automatically if you're running in high safety. Take a backup of the now-principal, drop the suspect database and restore. You're in the fortunate situation that you have another copy of the DB.

To see why it became suspect, check the SQL error log. There will be an entry in there saying why SQL marked the DB as suspect.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-11-16 : 00:29:42
quote:
Originally posted by tkizer

Have you tried sp_resetstatus?


quote:
This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use ALTER DATABASE instead.


The recommended way on SQL 2005+ is ALTER DATABASE SET EMERGENCY. sp_resetstatus should not be used any longer.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-16 : 00:35:03
Yeah but sp_resetstatus was easier to type. I provided the link to showcase the deprecation.

I find it very odd that MS doesn't just remove deprecated commands after two releases. sp_resetstatus has been deprecated since 2005, so get rid of it in 2008! Why wait?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2010-11-16 : 02:17:09
Have you guys ever actually had sp_resetstatus work? It usually just goes right back to suspect when I used to use it. Restore from backup would be the best course of action IMO.

-Chad
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-11-16 : 03:08:13
quote:
Originally posted by tkizer

I find it very odd that MS doesn't just remove deprecated commands after two releases.


Their deprecation cycle is 2 releases. Deprecated in 2005, final deprecation in 2008. 2008 R2 wasn't a full release, so doesn't count. If they do follow that cycle, resetstatus should be gone in the next version.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

wyx2000
Starting Member

5 Posts

Posted - 2010-11-16 : 13:31:33
Thanks for the replies.

I tried sp_resetstatus, but it did nothing.
Then I tried ALTER DATABASE db1 SET EMERGENCY and it says the db is in mirroring or something, cannot process.

The error message in sql log is
An error occurred during recovery, preventing the database 'ablebase' (database ID 6) from restarting. Diagnose the recovery errors and fix them, or restore from a known good backup. If errors are not corrected or expected, contact Technical Support.

For fail over, I am using .NET 2, and I have four dbs for the CMS. Although I have them mirroring to another SQL server, but I don't have much confident on the auto fail-over, I remember something could trigger one db fail-over but not others, then make a mess. I remmber there are some articles about how to fail-over multi-db with some SQL commands, but I am not sure how it handle the in-time fail-over.



Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-11-17 : 02:32:16
As the error says, you need to restore from a known good backup. This one does not look repairable.

Arrange a maintenance window, shut down the app, fail all the databases over to the secondaries, restart the app then drop and restore the suspect one. If you don't have confidence in mirroring, why are you using it?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

wyx2000
Starting Member

5 Posts

Posted - 2010-11-17 : 19:53:59
I don;t have other choice? do I?

At least with mirroring I can have a real-time copy in another server.

And SQL server 2005 cannot handle multi-db fail-over, right?
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-11-18 : 00:44:17
There's more than one options for HA. Depends on your needs, depends on your budget. Discussion for elsewhere.
Mirroring (in any version of SQL) is per-database (as opposed to clustering which is per-server). If you want multiple databases to fail together, you need job/monitoring that fails the rest over should one go.

My advice from the previous post still stands.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -