Solved

working with suspect/offline database

Posted on 2007-03-20
4
841 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hi ScottPletcher
I never know that we can this 2 numbers...
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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…

762 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

10 Experts available now in Live!

Get 1:1 Help Now