I have a Wise for Windows Installer package that will install SQL Express 2005 and then attach a database. In order to keep consistent I am placing the new .MDF file in C:\Program Files\Microsoft SQL Server\MSSQL$INSTANCE\data. If the folders don't exists I create them. Well, on one test machine I create the folder and copy the MDF to the directory and then use 'osql' to attach the database but I am getting this error:
Msg 5173, Level 16, State 1, Server SREXROAT2\FHMOBILE, 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. Msg 1813, Level 16, State 2, Server [COMPUTERNAME], Line 1 Could not open new database '[DATABASE NAME]'. CREATE DATABASE is aborted. Log file '[LOG FILE NAME]' does not match the primary file. It may be from a different database or the log may have been rebuilt previously.
Does anyone know how to get around this? It works on our other test machines with the same database.
hi,
a dumb question of mines... did you try with another copy of the installer package? is it corrupt?
regards
|||You should be installing both the .MDF and the .LDF.
|||The problem, besides not attaching correctly, was that the MDF file was attached to a different location and a different name so that when I would attach it during the install it would try and create the log file in the wrong spot and this case it already existed.
No comments:
Post a Comment