Solved

Microsoft SQL

Posted on 2010-11-25
6
464 Views
Last Modified: 2012-05-10
Hello

i have a terrible problem with my MS SQL Database. All of the sudden, while working in the application that is using the database it has stopped working and closed (with no error message). Restarting the application, it could not connect back to the database... restart, reboot, reload MS SQL service and still nothing. That was the time i loaded MS SQL Management Studio Express 2005 (v9.00). There i've noticed that my database was marked with Suspect status. I did a lot of research on the net and on this portal trying to find a solution... none of the steps explained in different posts were good for me. Can anyone describe a step by step tutorial to try repairing my database?

My server is:Microsoft SQL Server 2000 - 8.00.760 (Intel X86), Dec 17 2002 14:22:05, Desktop Engine on Windows NT 5.1 (Build 2600: Service Pack 3) and has been running for three years with no flaws. Also i don't have a recent backup only made a copy of the mdf and ldf files after the crash.

I'm not interested into buing 400$ or more worth of software just to repair a database (i've already paid for the SQL license... ) as i saw some providers offer.

Regards,
Cosmin
0
Comment
Question by:Cosmin Curticapean
6 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 34213637
try to take  that db offline and then online ..
if that doesnt work, detach it and attach it
0
 
LVL 32

Expert Comment

by:ewangoya
ID: 34214174

Before attempting to take it offline or detach, run DBCC CHECKDB to see if you have some kind of corruption that can be repaired
From there you can choose your next step
0
 
LVL 3

Expert Comment

by:expert_dharam
ID: 34214899
According to me, following might be the possibilities:

1. Account running the MSSQLSERVER service is not locked/disabled/expired.
2. .mdf file's 'Read-Only' attribute is true/checked in the properties window.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Cosmin Curticapean
ID: 34215659
so, from what i have read untill today, i should never detach a suspect database because of the risk of not being able to attach it back... even so, i did detach and got this message when trying to attach again.

TITLE: Microsoft SQL Server Management Studio Express
------------------------------

Attach database failed for Server 'CIEMPONTAJ'.  (Microsoft.SqlServer.Express.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)

------------------------------

 
Error while undoing logged operation in database 'Keypont'. Error at log record ID (53403:16:205).
An error occurred while processing the log for database 'Keypont'.
Could not open new database 'Keypont'. CREATE DATABASE is aborted.
Location:       recbase.cpp:1378

Expression:       m_offBeginVar < m_SizeRec
SPID:             52
Process ID:       2484
Location:       logscan.cpp:3063
Expression:       (m_lastLSN == NullLSN) || (m_lastLSN > m_curLSN)
SPID:             52
Process ID:       2484
Location:       logscan.cpp:3282
Expression:       m_lastLSN == NullLSN || startLSN < m_lastLSN
SPID:             52
Process ID:       2484 (Microsoft SQL Server, Error: 3624)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=3624&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------


Also i've put the attached log file with some errors.
ERRORLOG
0
 

Accepted Solution

by:
Cosmin Curticapean earned 0 total points
ID: 34216521
--- SOLVED ---

after reading another dozen articles about MS SQL repair from SUSPECT mode i've managed to do this:

-without detach-ing the DB ( as i've read, this is not recommended) i've executed this scripts:

1) UPDATE sysdatabases SET status = 32768 WHERE name = 'problematic_database'
GO

2) ALTER DATABASE problematic_databaseSET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('problematic_database', REPAIR_ALLOW_DATA_LOSS)

3) DBCC traceon(3604)
DBCC rebuild_log('problematic_database','c:\Program Files\Microsoft SQL Server\MSSQL\Data\problematic_database.ldf')

4) ALTER DATABASE problematic_database SET MULTI_USER

this did put the database in single mode, check-ed for errors, rebuild-ed the ldf file and change back to multiuser mode. After this i could access the DB oncemore.

As remarks to your posts:
-detach is not recomended in SUSPECT mode, as you might not be able to reattach it back
-DBCC checkdb is only a part of the solution
-no accounts were expired, and no read-only mode was set.

Thanks all for the support,
Cosmin
0
 

Author Closing Comment

by:Cosmin Curticapean
ID: 34246201
the solution worked in a private case, might not work for other cases.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

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

19 Experts available now in Live!

Get 1:1 Help Now