• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1149
  • Last Modified:

MSDE: sp_attach_db gives osql 'device activation error


I have a properly detached databasefile db.mdf and db.ldf copied to a cliënt computer wich has MSDE installed. When i try to attach this database in MSDE, i get the following error:

Msg 5105, Level 16, State 2, Server PC_LIEVE\TAAKOVERZICHT, Line 1
Device activation error. The physical file name 'D:\MSDETest\Taakoverzicht.MDF'
may be incorrect.

The file exists in the specified location, security is everyone permitted. What can be the cause of this?
  • 3
  • 2
1 Solution
DroezelAuthor Commented:
1> EXEC sp_attach_db @dbname= N'Taakoverzicht', @filename1 = N'D:\MSDETest\Taako
verzicht_Data.MDF', @filename2 = N'D:\MSDETest\Taakoverzicht_Log.ldf'
2> GO

This is the command being used.
Melih SARICACommented:
check filenames of the Files u gave a filename parameters
DroezelAuthor Commented:
These are the filenames, copied right out of explorer:


they are identical (believe me, i checked like 2500 times), permission on the folder = everyone - full control
I also log on using the administrator (sa) account with the following command:

osql -SLAPPIELIEVE\Taakoverzicht -Usa -PTOAdmin

And I still get the same error:
Msg 5105, Level 16, State 4, Server LAPPIELIEVE\TAAKOVERZICHT, Line 1
Device activation error. The physical file name
'D:\MSDETest\Taakoverzicht_Data.MDF' may be incorrect.

I have really no idea what's wrong here.

Is there maybe another way to attach a database from some kind of script or command?

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Can you try this if it will make any difference:

EXEC sp_attach_single_file_db @dbname = N'Taakoverzicht',
   @physname = 'D:\MSDETest\Taakoverzicht_Data.MDF'
DroezelAuthor Commented:
I found that the problem was that another sql server instance was running. When I stop that server, the attach works
Melih SARICACommented:
i guess these databases r being used by other SQL Server Instance.. U ave the same databases on the other Instance..


Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now