Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

Database in "suspect" mode (SQL Server Management Studio 2005) Expand / Collapse
Author
Message
Posted Saturday, March 19, 2011 1:39 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, December 22, 2012 4:35 PM
Points: 12, Visits: 27
This morning, I made a backup copy of the SQL Server database. Because the log file has grown too big (over 15GB), I first shrank it to 1mb. After copying it, I opened SQL Server Management Studio 2005, tried to attach the backup database to it, but the operation failed. My guess is because the original database, which has the same name, has been previously attached to the SQL Server Management Studio. By trying to attach another db with the same name, I created a conflict and the operation failed. But what troubles me now is that the original database is labeled as "suspect" in SQL Server Management Studio. It looks like the original db has been corrupted.

I ran the following sql command:
DBCC CHECKDB ('DatabaseName’) WITH NO_INFOMSGS, ALL_ERRORMSGS


and the following message appeared:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '‘'.
Msg 319, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.

I used the copied database to overwrite the original one but it did not help. The problem exists, it looks like now the copied db is also corrupted. Too bad now I cannot even use the log file to restore the database because I have shrunk it to almost nothing.

Can any offer a solution? This is urgent because I used this database to run my own business at home. Thanks.
Post #1080882
Posted Saturday, March 19, 2011 2:13 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 12:40 AM
Points: 7,001, Visits: 8,439
henryvuong1000 (3/19/2011)
This morning, I made a backup copy of the SQL Server database. Because the log file has grown too big (over 15GB), I first shrank it to 1mb. After copying it, I opened SQL Server Management Studio 2005, tried to attach the backup database to it, but the operation failed. My guess is because the original database, which has the same name, has been previously attached to the SQL Server Management Studio. By trying to attach another db with the same name, I created a conflict and the operation failed. But what troubles me now is that the original database is labeled as "suspect" in SQL Server Management Studio. It looks like the original db has been corrupted.

I ran the following sql command:
DBCC CHECKDB ('DatabaseName’) WITH NO_INFOMSGS, ALL_ERRORMSGS


and the following message appeared:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '‘'.
Msg 319, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.

I used the copied database to overwrite the original one but it did not help. The problem exists, it looks like now the copied db is also corrupted. Too bad now I cannot even use the log file to restore the database because I have shrunk it to almost nothing.

Can any offer a solution? This is urgent because I used this database to run my own business at home. Thanks.


seems a bit scary what you did ....

Your statement didn't work because you didn't use "regular" single quotes.
That also happens when you copy quoted text from e.g. MSWord.

Replace the quotes by editing in a tsql panel and replace with new quotes.

Why didn't you create a regular tsql backup ?



Johan


Don't drive faster than your guardian angel can fly ...
but keeping both feet on the ground won't get you anywhere

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


"press F1 for solution", "press shift+F1 for urgent solution"


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me but most of the time this is me
Post #1080887
Posted Saturday, March 19, 2011 2:36 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:11 PM
Points: 42,470, Visits: 35,541
A critically important database with no backups that's suspect. Usually I'd say URLT, but not applicable in this case unfortunately.

What you did could not cause the suspect status. Recovery pending maybe, but not suspect. Suspect means that the database engine encountered some form of corruption while doing crash recovery.

What is the current situation?
If there's still a suspect DB...
Query sys.databases and post exactly what the state_desc for the database is
Open the SQL error log and find any and all messages relating to this database.

The error on checkDB is, as ALZDBA said, due to the quotes. There's a ` where there should be '
That said, you can't run checkDB on a suspect database. Hence the request for the database state and error log.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1080890
Posted Saturday, March 19, 2011 2:38 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:11 PM
Points: 42,470, Visits: 35,541
p.s. When (if) you recover the DB, you maybe should take a read through this - Managing Transaction Logs


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1080892
Posted Saturday, March 19, 2011 2:40 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, December 22, 2012 4:35 PM
Points: 12, Visits: 27
@SSCertifiable:
Can you explain further? I am not a SQL Server expert. I know some tsql but I'm still at beginning level. Note that I did not use any tsql command why performing the above operations. I only used GUI.

Why didn't I create a regular tsql backup? Because it is simpler to copy and paste the files than running a tsql command. The person who works with me does not know anything about sql. That's the way she backs up sql database.
Post #1080893
Posted Saturday, March 19, 2011 2:45 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:11 PM
Points: 42,470, Visits: 35,541
henryvuong1000 (3/19/2011)
Note that I did not use any tsql command why performing the above operations. I only used GUI.


What do you mean you used the GUI? There's no mechanism through the SSMS GUI to run CheckDB.
You said you 'ran the command'. If by that you mean a query window, paste that, press F5 (or use the menu), then the previous comments stand, there's an incorrect ` in that command.

Why didn't I create a regular tsql backup? Because it is simpler to copy and paste the files than running a tsql command. The person who works with me does not know anything about sql. That's the way she backs up sql database.


Simpler, wrong and quite likely to give you useless 'backups' that cannot be 'restored'. A file copy is not a SQL backup. That the person you work with does it, does not make it a good way or even a workable way.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1080895
Posted Saturday, March 19, 2011 2:51 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, December 22, 2012 4:35 PM
Points: 12, Visits: 27
Simpler, wrong and quite likely to give you useless 'backups' that cannot be 'restored'. A file copy is not a SQL backup. That the person you work with does it, does not make it a good way or even a workable way.


So when I overwrote the original file with the "Backup" (or that's what I thought) file, I have replaced the original file with a useless file? If that is so, am I hopeless?
Post #1080896
Posted Saturday, March 19, 2011 3:00 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:11 PM
Points: 42,470, Visits: 35,541
henryvuong1000 (3/19/2011)
So when I overwrote the original file with the "Backup" (or that's what I thought) file, I have replaced the original file with a useless file?


Quite possible.

If that is so, am I hopeless?


Can you go through all the questions I asked in my initial post here and answer them? Without all of that info, no way to tell how bad things are.

To be blunt, most likely outcome here is either recovery with some data loss or no recovery at all.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1080898
Posted Saturday, March 19, 2011 3:24 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, December 22, 2012 4:35 PM
Points: 12, Visits: 27
I am such a moron. I thought the error message was telling what's wrong with the database, but it appears I typed in the wrong sql command. Honestly, this is what I copied and pasted after search for a solution on google. Here's the error message I got with the CHECKDB command:
Database 'BTData' cannot be opened. It has been marked SUSPECT by recovery. See the SQL Server errorlog for more information.


Here's the last log file:

2011-03-19 13:53:35.92 Server Microsoft SQL Server 2005 - 9.00.1406.00 (Intel X86)
Mar 3 2007 18:40:02
Copyright (c) 1988-2005 Microsoft Corporation
Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

2011-03-19 13:53:35.92 Server (c) 2005 Microsoft Corporation.
2011-03-19 13:53:35.92 Server All rights reserved.
2011-03-19 13:53:35.92 Server Server process ID is 4224.
2011-03-19 13:53:35.92 Server Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG'.
2011-03-19 13:53:35.92 Server This instance of SQL Server last reported using a process ID of 716 at 3/19/2011 1:16:10 PM (local) 3/19/2011 8:16:10 PM (UTC). This is an informational message only; no user action is required.
2011-03-19 13:53:35.92 Server Registry startup parameters:
2011-03-19 13:53:35.92 Server -d C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf
2011-03-19 13:53:35.92 Server -e C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG
2011-03-19 13:53:35.92 Server -l C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mastlog.ldf
2011-03-19 13:53:35.95 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2011-03-19 13:53:35.95 Server Detected 2 CPUs. This is an informational message; no user action is required.
2011-03-19 13:53:36.01 Server Error: 8313, Severity: 16, State: 1.
2011-03-19 13:53:36.01 Server Error in mapping SQL Server performance object/counter indexes to object/counter names. SQL Server performance counters are disabled.
2011-03-19 13:53:36.01 Server Error: 3409, Severity: 16, State: 1.
2011-03-19 13:53:36.01 Server Performance counter shared memory setup failed with error -1. Reinstall sqlctr.ini for this instance, and ensure that the instance login account has correct registry permissions.
2011-03-19 13:53:36.01 Server Set AWE Enabled to 1 in the configuration parameters to allow use of more memory.
2011-03-19 13:53:36.62 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.
2011-03-19 13:53:36.70 Server Attempting to initialize Microsoft Distributed Transaction Coordinator (MS DTC). This is an informational message only. No user action is required.
2011-03-19 13:53:36.75 Server The Microsoft Distributed Transaction Coordinator (MS DTC) service could not be contacted. If you would like distributed transaction functionality, please start this service.
2011-03-19 13:53:36.75 Server Database Mirroring Transport is disabled in the endpoint configuration.
2011-03-19 13:53:36.76 spid4s Starting up database 'master'.
2011-03-19 13:53:36.89 spid4s Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.
2011-03-19 13:53:37.00 spid4s SQL Trace ID 1 was started by login "sa".
2011-03-19 13:53:37.03 spid4s Starting up database 'mssqlsystemresource'.
2011-03-19 13:53:37.26 spid4s Server name is 'MAIN-STATION'. This is an informational message only. No user action is required.
2011-03-19 13:53:37.26 spid8s Starting up database 'model'.
2011-03-19 13:53:37.40 spid8s Clearing tempdb database.
2011-03-19 13:53:37.57 Server A self-generated certificate was successfully loaded for encryption.
2011-03-19 13:53:37.59 Server Server is listening on [ 'any' <ipv4> 1433].
2011-03-19 13:53:37.59 Server Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\MSSQLSERVER ].
2011-03-19 13:53:37.59 Server Server local connection provider is ready to accept connection on [ \\.\pipe\sql\query ].
2011-03-19 13:53:37.61 Server Server is listening on [ 127.0.0.1 <ipv4> 1434].
2011-03-19 13:53:37.61 Server Dedicated admin connection support was established for listening locally on port 1434.
2011-03-19 13:53:37.64 Server The SQL Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies.
2011-03-19 13:53:37.64 Server SQL Server is now ready for client connections. This is an informational message; no user action is required.
2011-03-19 13:53:37.68 spid13s Starting up database 'ProList'.
2011-03-19 13:53:37.68 spid11s Starting up database 'msdb'.
2011-03-19 13:53:37.68 spid12s Starting up database 'test_BTData'.
2011-03-19 13:53:37.68 spid14s Starting up database 'BTData'.
2011-03-19 13:53:38.17 spid14s Error: 9003, Severity: 20, State: 9.
2011-03-19 13:53:38.17 spid14s The log scan number (7941:97506:1) passed to log scan in database 'BTData' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.
2011-03-19 13:53:38.17 spid14s Error: 3414, Severity: 21, State: 1.
2011-03-19 13:53:38.17 spid14s An error occurred during recovery, preventing the database 'BTData' (database ID 7) from restarting. Diagnose the recovery errors and fix them, or restore from a known good backup. If errors are not corrected or expected, contact Technical Support.
2011-03-19 13:53:40.11 spid8s Starting up database 'tempdb'.
2011-03-19 13:53:40.64 spid11s The Service Broker protocol transport is disabled or not configured.
2011-03-19 13:53:40.64 spid11s The Database Mirroring protocol transport is disabled or not configured.
2011-03-19 13:53:40.73 spid11s Service Broker manager has started.
2011-03-19 13:53:41.86 spid4s Recovery is complete. This is an informational message only. No user action is required.
2011-03-19 13:54:10.84 spid52 Using 'xpstar90.dll' version '2005.90.1399' to execute extended stored procedure 'xp_instance_regread'. This is an informational message only; no user action is required.
2011-03-19 14:15:42.76 Logon Error: 18456, Severity: 14, State: 16.
2011-03-19 14:15:42.76 Logon Login failed for user 'MAIN-STATION\SHOCKINGPRICE'. [CLIENT: <local machine>]

The database that has problem is "BTData". From this log, it looks like I have a corrupted log file? When I copy the files from one machine and pasted it on another machine for backup, then use the backup to overwrite the original file, I may have corrupted the log file?
Post #1080904
Posted Saturday, March 19, 2011 3:29 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:11 PM
Points: 42,470, Visits: 35,541
Exactly as you have, just replacing the ` (at the end of the database name) with '

However if the database is suspect, that will fail. You cannot checkDB a suspect database. Please go back to the first post I made in this thread and answer the questions that are there.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1080905
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse