Tuesday, February 14, 2012

Corrupted SQL Files !!!

Hi:

I try to run VB2005 Sample101, "Using Datagridvies" with SQL Express,

Here is what I got !"

"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
back up.

Cannot open use default database. Login failed.
Login failed for use 'XXXXXXXXXXX\Administrator"
Lof File 'C:\Program Files\Microsoft SQL Server\MSSQL.1\Data\AdventureWorks_Data_Log.idl' does not match the primary file. It may be from a different database or the log
may have been rebuilt previously."

Then I re attached the Database again. Still the Same problem.

I try other sample that used Northwin and Pubs (SQL2000 ) and attached to

SQLExpress, Well I suffered the SAME PROBLEM.

WHY, Please Help

Thanks

Simon

Try downloading the sample databases from http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46a0-8da2-eebc53a68034&DisplayLang=en

Might as well use something you know is working. From the looks of it, you are trying to attach a database and the path may not be the same as the one defined in the metadata of the database file.

|||

I downloaded this Sample and Try Last Nite. The Same Problem. That What I thought initially, I make a new connection and try to run the Sample Again, Well SAME Problem.

Thanks

|||

Hi,

Have you try attaching your sample database with only .MDF file ... while you doing this it will ask you for creating a new for you. But do this carefully / test it on dev server before doing on production server.

|||

Hi,

Have you tried the option i suggest ?

Hemantgiri S. Goswami

|||Could you please post your connection string here ?

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

SimonOng wrote:

"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
back up.

Cannot open use default database. Login failed.
Login failed for use 'XXXXXXXXXXX\Administrator"
Lof File 'C:\Program Files\Microsoft SQL Server\MSSQL.1\Data\AdventureWorks_Data_Log.idl' does not match the primary file. It may be from a different database or the log
may have been rebuilt previously."

Have experienced very similar error.

Have my application on staging server ( non-stop ) and uploaded other one to execute short S. Q. L. script . It finished without errors and I noticed no problems. From once , this shocked me

First I think about concurrent attach by both applications ( it's SQL express ) , but this doesn't sound very reallistic.

Don't want to believe that the database may be destroyed this way . . .|||This is not clear to me, which steps did you actually take ?


Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment