Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

working with suspect/offline database

Posted on 2007-03-20
4
Medium Priority
?
857 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 900 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 70

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 600 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
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 backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

610 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