0

One of our production DBs is stuck in Suspect mode since we installed SQL Server 2008 R2 SP3.

Earlier today we found that most text fields (nvarchar) had the following data appended to it

</title><style>.ali7{position:absolute;clip:rect(441px,auto,auto,407px);}</style><div class=ali7><a href=http://highquality-cialis.com >cialis online</a></div></title><style>.ali7{position:absolute;clip:rect(441px,auto,auto,407px);}</style><div class=ali7

Every time I tried running queries to remove that bit, the SQL Server Service and Agent Service keep constantly restarting.

I tried Installing SP2 & SP3 but still having the same issue.

After installing SP3 and rebooted, I was able to run a few queries then got an error message about Shared memory and now the DB I was using is in Suspect mode.

Now I can't bring the DB back online.

I've tried following this blog post Creating, detaching, re-attaching, and fixing a SUSPECT database. But when I try to run this

ALTER DATABASE [DemoSuspect] SET EMERGENCY;
GO
ALTER DATABASE [DemoSuspect] SET SINGLE_USER;
GO
DBCC CHECKDB (N'DemoSuspect', REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS, ALL_ERRORMSGS;
GO

I get this error

Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 7929, Level 16, State 1, Line 1
Check statement aborted.  Database contains deferred transactions.

If I run this SELECT DATABASEPROPERTYEX (N'DemoSuspect', N'STATUS') AS N'Status';

It says the DB is online.

If I try to restore from the latest full backup, as soon as I select from Database or From Device the list of backup sets to restore is blank.

Then keep getting "You must select a restore source".

UPDATE

I was able to restore to a second db using T-SQL, but the main db is still in suspect mode and can't detach or take offline.

The other issue now is that it uses file groups to store old data related to two tables.

How can I remove the suspect db and make the new db point to the file groups? Or so I need to copy the file groups?

4
  • 2
    You have been targeted by SQL injection. Getting your database online is not going to prevent this from happening again. Also, if you have a valid full backup (.bak file), try to restore it with RESTORE DATABASE commands. Stop using the clunky point and click UI that will only hold information about backup files created in very particular ways. Oct 19 '15 at 22:59
  • @AaronBertrand I have been able to restore but now I can't access from the application server, I keep getting "80004005 unspecified error" Even though I restored it to a new db name, changed the connection strings and created a new user for the application Oct 20 '15 at 0:41
  • Many potential reasons for 0x80004005, generally it's a permissions error in most cases, but impossible from information given to tell what state you're in right now. Oct 20 '15 at 1:23
  • I ended up raising that users permissions to be able to use the system, not ideal but it's the only way I managed to make it work. Even though it had the exact same permissions as before Oct 20 '15 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.