Solved

working with suspect/offline database

Posted on 2007-03-20
4
851 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Scott Pletcher
Scott Pletcher 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

705 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