Solved

working with suspect/offline database

Posted on 2007-03-20
4
845 Views
Last Modified: 2012-06-21
Hi,
I manage to get and information on web on how to work with suspect/offline database and the statement is below:

sp_configure 'allow updates',1
GO
RECONFIGURE WITH OVERRIDE
GO

UPDATE master.dbo.sysdatabases
SET Status = 24
WHERE [Name] = 'YourDatabaseName'
GO

and I check in BOL for sysdatabase but I dont find any status=24 represent for what, so where is this number from?

0
Comment
Question by:motioneye
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
imran_fast earned 300 total points
ID: 18755439
Check this link
http://www.sqlservercentral.com/columnists/bknight/unmarksuspect.asp

A database can be marked for many reasons. Generally it falls into the following conditions :
A database or log file is missing.
In SQL 6.5, a device may not be present or in 7.0/2000 a file may not exist.
SQL Server may not have been able to restore the database in ample time.
The database could be corrupt.
The database is being help by the operating system. This could be a 3rd party backup software or defrag software. I've had even a virus scanning software cause this once.
SQL Server does not have enough space to recover the database on startup.
To fix this problem, perform the following functions:

Review the SQL Server and NT error logs to see if you can find where the problem occured.
Start SQL Server in single user mode.
Go to your control panel and services.
Stop SQL Server
Add the -m switch in the parameters pane below.
Start SQL Server
Run sp_resetstatus with the @dbname parameter. (ie : sp_resetstatus @dbname = "pubs")
Perform detailed DBCC checks (CHECKDB, CHECKALLOC, etc)
Run a few random queries to see if you experience any problems.
If no problems occur, stop and start SQL Server and open the database to production.
As an absolute last resort, you can place your database in emergency mode. By placing it in this mode, you will be allowed to copy data out of the database, even if the data is corrupt. To place your database in emergency mode, use the following command:

SP_CONFIGURE 'allow updates', 1
RECONFIGURE WITH OVERRIDE
GO
UPDATE master..sysdatabases set status = -32768 WHERE name = 'pubs'
GO
SP_CONFIGURE 'allow updates', 0
RECONFIGURE WITH OVERRIDE

You can then BCP data out and place it into a different database.
0
 

Author Comment

by:motioneye
ID: 18755487
Hey guys,
Look at the link here, they must be confidence to update the status =24 but I'm in ruin to know what is the "24" represent for

http://www.mssqltips.com/tip.asp?tip1204
0
 
LVL 69

Assisted Solution

by:ScottPletcher
ScottPletcher earned 200 total points
ID: 18757906
24 is a combination of 8 and 16:
8 = trunc. log on chkpt; set with sp_dboption.
16 = torn page detection, set with sp_dboption.

Look at the description of the "status" column in the entry for "sysdatabases".
0
 

Author Comment

by:motioneye
ID: 18769718
Hi ScottPletcher
I never know that we can this 2 numbers...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now