I want to attach my database from server to my pc, I'm using sql server 2000. When I attach the .mdb file, I get this error:

Error 9004: An error occurred while processing the log for database 'MyDatabase'

So, I found another suggest, which is re-generate the log file. This is the step I follow:

1.Make sure you have completed sucessfully all the prerequisite steps, i.e.: 1) database, marked as suspect was de-attached 2) failed hard drive was replaced;

2.Move de-attached database file to any safe location;

3.Delete a suspect database using SQL Server Enterprise Manager console;

4.Create a new database with the same (as the suspect database has) logical name and physical *.mdf and *.ldf file names. All the *.mdf and *.ldf files should be located in exactly the same locations (directories) as the suspect database;

5.Stop SQL Server services;

6.Replace a valid *.mdf file with suspected one (created on step 1 and 2);

7.Start SQL Server services;

8.Run SQL Server Query Analyzer and execute the following script:

9.Execute the following script:

select status from sysdatabases where name = 'your database name'

10.Execute the following script:

update sysdatabases set status= 32768 where name = 'your database name'

11.Restart SQL Server services;

12.Make sure a database (you trying to recover) visible in SQL Server Enterprise Manager console (having Emergency mode?status). After doing this, you can enter the database and SELECT the data or use BCP to get it out. You may encounter errors while doing this, but in most cases much of the data can be retrieved;

13.Execute the following script: >>>>>>>>Get error here<<<<<<<<<<<

dbcc rebuild_log ('your database name', 'full path to a new transaction log file')

>>>>> Error Message <<<<<<<<
Server: Msg 5180, Level 22, State 1, Line 1
Could not open FCB for invalid file ID 0 in database 'STS_EDUHQSRV1_1'.

Connection Broken


14.Execute the following script:

use 'your database name'
sp_dboption 'your database name', 'single_user', 'true'
dbcc checkdb ('your database name', repair_allow_data_loss)



15.nontime-consuming repair actions such as repairing extra keys in nonclustered indexes. These repairs can be done quickly and without risk of data loss;

16.time-consuming repairs such as rebuilding indexes. These repairs can be done without risk of data loss;

17.allocation and deallocation of rows and pages for correcting allocation errors, structural row or page errors. These repairs can result in some data loss;

18.deletion of corrupted text objects. These repair can result in some data loss, too.