SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Trying to migrate old mdf to new system, possible corruption?


Trying to migrate old mdf to new system, possible corruption?

Author
Message
faxanadu2
faxanadu2
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 6
Hi,
Im completely inexperienced with SQL databases, and Im in desperate need of help trying to get a database migrated from my Dad's old computer to his new one.
I apologize in advance for being long winded...

Brief back story:
Old computer was running XP and SQL Server 2005 with a proprietary medcal front end program called Chiro8000, which created database called PM_CHIRO.mdf.
Old PC's motherboard decided it had had enough of life and one morning it simply stopped turning on. I put together a new computer with the exact same software, and installed the old harddrive as a slave so i could access the data.

The new install of the Chiro8000 program created its own empty database at C:\Program Files\Forte Systems\Chiro8000\Data\PM_CHIRO.mdf
The old database I need to restore is at D:\Program Files\Forte Systems\Chiro8000\Data\PM_CHIRO.mdf

The Chiro program has a "database manager tool" but Ive been using MS SQL Server Management Studio Express

Obviously if I try to just attach the old one I get "Cannot attach a database with the same name as an existing database" error.
So I try detaching the new blank one and attaching the old version, which gives me:

______________________________________________________________________________________________________________
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)


The log scan number (9884:437:2) passed to log scan in database 'PM_CHIRO' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.
Could not open new database 'PM_CHIRO'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 9003)
_______________________________________________________________________________________________________________

There is no .BAK to restore from, and the old database worked fine up until the point that the computer died. For those wondering, it did not crash while running, it shut down politely and then refused to turn on.

I've also tried to rebuild the log using the syntax:

USE [master]
GO
CREATE DATABASE [PM_CHIRO] ON
(FILENAME = N'D:\Program Files\Forte Systems\Chiro8000\Data\PM_CHIRO.mdf')
FOR ATTACH_REBUILD_LOG
GO


Which gives me the error:

Msg 5173, Level 16, State 1, Line 1
One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup.
Log file 'C:\Program Files\Forte Systems\Chiro8000\Data\PM_CHIRO_log.LDF' does not match the primary file. It may be from a different database or the log may have been rebuilt previously.
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'PM_CHIRO'. CREATE DATABASE is aborted.

So at this point...no clue... I'm sure all of you SQL people out there could figure this out pretty quick, but Im way over my head as it is.
I dont have a .BAK
If its a corruption issue Id love to know how to repair it, even if it means possibly losing some data, because right now Im up a creek without a paddle....and theres a waterfall...made of sharks.

Thanks in advance.
faxanadu2
faxanadu2
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 6
Okay, Nevermind, figured it out with some trial and error and some suggestions

Had to delete the log file on the C: drive, THEN rebuild the log using

EXEC sp_attach_single_file_db

Its all good now!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search