SQLServerCentral.com / SQL Server 2005 / Data Corruption / cannot attach mdf file / Latest PostsInstantForum.NET v2.9.0SQLServerCentral.comhttp://www.sqlservercentral.com/Forums/notifications@sqlservercentral.comSun, 02 Aug 2015 15:09:02 GMT20RE: cannot attach mdf filehttp://www.sqlservercentral.com/Forums/Topic1516475-266-1.aspxRecovery Toolbox for SQL Server is relevant and secure option. From here [url=http://www.sql.recoverytoolbox.com/]http://www.sql.recoverytoolbox.com/[/url]Sat, 06 Sep 2014 11:52:11 GMTkemberlypauloRE: cannot attach mdf filehttp://www.sqlservercentral.com/Forums/Topic1516475-266-1.aspxThanks a lot for the correction.Wed, 12 Mar 2014 21:48:34 GMTprettsonsRE: cannot attach mdf filehttp://www.sqlservercentral.com/Forums/Topic1516475-266-1.aspx[quote][b]prettsons (3/12/2014)[/b][hr]You need to remove the suspect mode from the server first then you can attach the database.[/quote]No.Suspect is a status that a database has, not a server and it's a smidgen hard to remove the suspect status from a database before it's attached.And as always recommending repair with data loss before even looking at the details of the corruption is a bad idea.4 month old thread, so I suspect the OP has resolved it one way or anotherWed, 12 Mar 2014 02:20:05 GMTGilaMonsterRE: cannot attach mdf filehttp://www.sqlservercentral.com/Forums/Topic1516475-266-1.aspxYou need to remove the suspect mode from the server first then you can attach the database.Run the following queries to remove the suspect mode:EXEC sp_resetstatus ‘yourDatabasename’; ALTER DATABASE yourDatabasename SET EMERGENCY DBCC checkdb(’yourDatabasename’) ALTER DATABASE yourDatabasename SET SINGLE_USER WITH ROLLBACK IMMEDIATE DBCC CheckDB (’yourDatabasename’, REPAIR_ALLOW_DATA_LOSS) ALTER DATABASE yourDatabasename SET MULTI_USERNote: You might choose some amount of data.Wed, 12 Mar 2014 00:49:16 GMTprettsonscannot attach mdf filehttp://www.sqlservercentral.com/Forums/Topic1516475-266-1.aspxHi,I have the following problem: Due to a harddisk problem the database went into Suspect mode.I don't want to risk losing any data by trying to fix it directly on the server since there are no recent backups so I copied the mdf and ldf files to another computer. While trying to attach the files a message came out: Attach database failed for Server 'SALESIRM\SQLEXPRESS'. (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------------------------------Program Location: at Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files, String owner) at Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabaseData.PrimaryFile.Attach() at Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabase.SendDataToServer()===================================An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)------------------------------Program Location: at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries) at Microsoft.SqlServer.Management.Smo.Server.AttachDatabaseWorker(String name, StringCollection files, String owner, AttachOptions attachOptions) at Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files, String owner)===================================SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:12459; actual 0:0). It occurred during a read of page (1:12459) in database ID 5 at offset 0x00000006156000 in file 'C:\Users\Terziyski\Desktop\insider\IrmCrm.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.During redoing of a logged operation in database 'IrmCrm', an error occurred at log record ID (14623:1865:10). Typically, the specific failure is previously logged as an error in the Windows Event Log service. Restore the database from a full backup, or repair the database.Could not open new database 'IrmCrm'. CREATE DATABASE is aborted. (.Net SqlClient Data Provider)------------------------------For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=824&LinkId=20476------------------------------Server Name: SALESIRM\SQLEXPRESSError Number: 824Severity: 24State: 2Line Number: 1------------------------------Program Location: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)My question is: Is there a way to attach the mdf and ldf files or should I risk and try to remove the Suspect mode on the server?RegardsThu, 21 Nov 2013 09:10:03 GMTvterziyski