0

I've been tasked with migrating data from an instance of SQL Server 2000 to 2019. There are a total of four databases to bring over, three of which I was able to backup/restore into 2008 and then into 2019 without any issues. Please note: I am not a DBA in any sense, though I'm the closest thing to one on hand.

The fourth and final database presented the following error that prevented moving from 2008 to 2019:

System.Data.SqlClient.SqlError: An error occurred while processing the log for database 'DbNameHere'. The log block version 2 is unsupported. This server supports log version 3 to 6. (Microsoft.SqlServer.SmoExtended)

Is there a simple fix for this problem that I'm missing in the various SSMS menus?

Alternatively, is there a way to copy raw data from one server to another via, for instance, a flat file, and preserve the identity columns as identity columns? That is, I don't want to just strip that column and bulk insert, as they are often used as foreign keys in other tables, and with twenty-some-odd years of data, something is bound to break in doing this.

An example of an ideal final result in this solution would be something like: legacy table X has 1000 rows, the last of which has an identity column value of 1000. Once the move is complete, new table X has 1000 rows, the last of which has an identity column value of 1000, and upon insert the next row automatically increments to 1001.

Apart from unsuccessfully messing around with flat files, I've also tried the "Copy Database" option in SSMS, which also failed.

1 Answer 1

1

I would attempt to get SQL Server to rebuild the transaction log. Based on the error message, that might sort out the situation.

You first use sp_detach_db to detach the database. It is now very likely that the ldf file isn't needed when you do a subsequent attach, and perhaps rebuilding the log this way will sort the situation.

Then you attach the database, without the ldf file. Use CREATE DATABASE with either of the FOR ATTACH or FOR ATTACH_REBUILD_LOG options.

I would do this on the 2008 instance, since from what I understand you got the database in there successfully. But feel free to play around regarding on which version (2000 or 2008) you do the detach and also on which version (2000, 2008, 2019) you do the attach.

2
  • Thank you! This worked, more or less. Ultimately I had to do the following: delete existing backups in 2000; restore into 2008, then detach; copy the actual MDF file from 2008 to 2019; FOR ATTACH_REBUILD_LOG pointing at the MDF in 2019.
    – vodolazkiy
    Feb 15 at 15:42
  • I'm happy it worked for you. What you did was what I was trying to suggest, perhaps I wasn't entirely clear in my text. :-) Feb 15 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.