Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 Error Attaching .mdf file...

Author  Topic 

zlthomps
Starting Member

4 Posts

Posted - 2008-01-07 : 00:26:12
Attemping to reattach a recovered .mdf and associated .ldf from a crashed disk drive and I am getting the error below. I attempted to create a new db, stop the service, replace the new data files with the recovered db files and restarted the SQL service so that I could run a dbcc checkdb while the db was in suspect mode, however was unable to do this. This error leads me to belive that the log file needs to be rebuild, but that the mdf files could be a decent shape. Any help would be apprecaited. Thanks!

===================================

Attach database failed for Server 'AUTOBASE\Autobase'. (Microsoft.SqlServer.Smo)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.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.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)

===================================

An error occurred while processing the log for database 'ABSystem7'. If possible, restore from backup. If a backup is not available, it might be necessary to rebuild the log.
Could not open new database 'ABSystem7'. CREATE DATABASE is aborted. (.Net SqlClient Data Provider)

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

------------------------------
Server Name: .\Autobase
Error Number: 9004
Severity: 21
State: 1
Line 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)

zlthompscoworker
Starting Member

1 Post

Posted - 2008-01-07 : 00:39:46
The main problem is you are a complete Dumbass... Do the world a favor and Delete the database, kick yourself in the balls and then shoot yourself in the head.
Go to Top of Page

zlthomps
Starting Member

4 Posts

Posted - 2008-01-07 : 00:59:03
***forwards post to director of support*** ;)

I guess that means you dont have the answer, Brian. ;)
Go to Top of Page

zlthomps
Starting Member

4 Posts

Posted - 2008-01-07 : 01:48:47
I was able to get the db to start in emergency mode and run a dbcc using the steps from this resource...
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=598396&SiteID=1

The dbcc comes up clean, but other than the system tables, I dont see any of my user-defined views or tables
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-07 : 22:12:16
Better to contact Microsoft support if you really want to get your tables back.
Go to Top of Page

zlthomps
Starting Member

4 Posts

Posted - 2008-01-08 : 01:33:31
Thanks for the reply. This has definitely crossed my mind, but if there is anything that I could try before I advise the customer to spend the money, I would like to. I have a good copy of the mdf and ldf in a safe place.
Go to Top of Page

sql_noob
Starting Member

9 Posts

Posted - 2008-01-08 : 11:41:36
we do a nightly attach of a bunch of databases to another server for backup purposes and get this once in a while. we always end up having to do another sync with production databases because something corrupted the file
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-08 : 23:12:33
That's why better to do backup/restore.
Go to Top of Page
   

- Advertisement -