A Production database has 14 secondary files divided over 6 filegroups with one single log file.
This database skipped into Suspected mode .The database was then detached . Now we are not able to attach the same.It shows "Attach Database failed with 9004 error (an error occurred while processing the log for database )" .
We tried a workaround as
- Rename the exsisting Data and logfiles.
- Create an empty database with the same name and physical file layout (file,filegroup structure (irrespective of file size) )
- Stop the sql services;
- Swap in the files you want to attach in place of the empty DB files, and start the server
- Put the db in emergency mode using " UPDATE master..sysdatabases SET status=-32768 WHERE name=' ' "
- Put the db in single user mode using sp_dboption
- Run DBCC CHECKDB(dbname,repair_allow_data_loss)
we are encountering error at the last step as "Could not run BEGIN TRANSACTION in database because the database is in bypass recovery mode "
Could you please suggest us a alternative workaround so as the database can be brought online.