Link to home
Start Free TrialLog in
Avatar of crishna1
crishna1Flag for United States of America

asked on

Suspect database

How to fix a SQL 2000 Suspect Database when you have no backup.
I am new to database world.

Any information is higly appreciated.

THNX
SOLUTION
Avatar of arbert
arbert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arbert
arbert

You can also try running this from query analyzer:

sp_resetstatus yourdatabasenamehere
Avatar of Scott Pletcher
1) Make a copy of the SQL Server logs *immediately*, otherwise they may be lost.  The (default) file names are ERRORLOG thru ERRORLOG.6 in (default)
directory '?:\Program Files\Microsoft SQL Server\MSSQL\LOG'.  This may be needed to help determine how the db became suspect, and thus how to fix it.

2) Immediately after issuing the EXEC sp_resetstatus, do a backup.  Then, in the worst case, you can be back to where you started.
For example, you might need to a DBCC CHECKDB and eventually try to fix errors, which can lose data.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Be very careful before detaching a damaged db -- it may refuse to reattach.
I agree with Scott--I don't think I would attempt a detach...Also, sp_db_kill_users isn't a shipped SQL Server stored proc.....
Avatar of crishna1

ASKER

The following is the message i got when i tried , sp_resetstatus xxxx

Prior to updating sysdatabases entry for database 'xxxx', mode = 0 and status = 1073742096 (status suspect_bit = 256).
For row in sysdatabases for database 'xxxx', the status bit 256 was forced off and mode was forced to 0.
Warning: You must recover this database prior to access.
You're not working with a "log shipped" database are you???

From query analyzer run this (from the master database)

restore yourdatabasename with recovery
I used:  restore database XXXX with recovery

I got :

Server: Msg 4323, Level 16, State 2, Line 1
The database is marked suspect. Transaction logs cannot be restored. Use RESTORE DATABASE to recover the database.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
Is this a log shipped database?
No. It is a user database on a stand alone database.
sorry, i meant stand alone server.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How to restore a SQL Server database marked as "suspect"
At times a database appears to be marked as "suspect" in the Enterprise Manager. SQL Server marks a database as suspect with it can't access the database. What happens at a low level is that SQL Server sets one of the bits in the status field in the sysdatabases table.
For More:
http://www.devx.com/vb2themax/Tip/18624