May 5, 2003 at 9:14 am
Hello. I am trying to restore and MDF/LDF file combo and am having trouble. If I try to attach I get a message "Cannot associate files with different databases". I think the problem is that I after backing up those files, we reinstalled SQL 7. Even though the server name and install directories are the same, it still won't work.
Any ideas would be appreciated.
May 5, 2003 at 11:06 am
Are you attaching the db files to a db with the same name that it had before?
May 5, 2003 at 11:12 am
Yes, I am. Another problem is that the we never did a "detach". We just stopped the services and copied the MDF and LDF file.
May 5, 2003 at 1:28 pm
Guess since you did not detach , it might not take the attach . I think u cannot attach if you did not detach the files. Maybe you can try to restore the backup's.
May 5, 2003 at 1:34 pm
The database should be attached back as long as you properly shut down the services. Can you post statement/commands here to show how did you try to get the database back?
May 5, 2003 at 3:37 pm
I tried:
EXEC sp_attach_db @dbname = N'cpk',
@filename1 = N'c:\MSSQL\Data\cpk_data.mdf',
@filename2=N'c:\MSSQL\Data\cpk_log.ldf'
I also tried it without the log file. Both times, I got the error.
May 8, 2003 at 1:26 am
Hi,
Make sure the version of SQL Server is the the same as the one you are trying to attach to. That includes Service Pak updates.
Good Luck.
May 8, 2003 at 2:41 am
I've notiched that sometimes sp_attach dosn't work.
Maybe you could try the command:
create database cpk on primary (filename='c:\mssql\data\cpk_data.mdf') for attach
May 8, 2003 at 7:04 am
tigersbh,
Can you copy and paste the error messages from QA after your execute the sp_attach_db statement?
May 8, 2003 at 8:06 am
Yes, it's possible the service packs versions are different. I'll have to figure out what SP we had before.
"create database cpk on primary (filename='c:\mssql\data\cpk_data.mdf') for attach" didn't work either. I still get:
Server: Msg 5173, Level 16, State 1, Line 1
Cannot associate files with different databases.
Server: Msg 5105, Level 16, State 1, Line 1
Device activation error. The physical file name 'D:\MSSQL7\data\DSM_CPKFinishing_be_Log.LDF' may be incorrect.
Server: Msg 945, Level 14, State 1, Line 1
Database 'DSM_CPKFinishing_be' cannot be opened because some of the files could not be activated.
Server: Msg 1813, Level 16, State 1, Line 1
Could not open new database 'DSM_CPKFinishing_be'. CREATE DATABASE is aborted.
Thanks for all of your replies.
May 8, 2003 at 8:09 am
NOTE: You might have noticed a discrepancy in the database names. The actual database name is "DSM_CPKFinishing_be". I shortened it to "CPK" in our discussions, but have always typed the full name when using the "attach" commands.
May 8, 2003 at 8:27 am
quote:
Device activation error. The physical file name 'D:\MSSQL7\data\DSM_CPKFinishing_be_Log.LDF' may be incorrect.
It seems log file 'DSM_CPKFinishing_be_Log.LDF' is not in directory ''D:\MSSQL7\data\'. Can you check that?
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply