Source: SQL Drip 7-error and workaround for attach function using SQL Server
Today, with the SQL Server 2008 Attach feature attached a database, a bit of a problem, the prompt error is:
Unable to open physical file "D:\Documents\Dalt\XXXX.mdf" Operating system error 5: ' 5 (Error not found) ' (Microsoft SQL Se Rver:error 5120) ".
Remember to do similar operations did not have any problems, do not know why this, there is no way to find a solution on the internet,
Http://social.msdn.microsoft.com/Forums/en/sqldatabaseengine/thread/9e563890-e35f-4524-82b9-3cca08fec5ed
MSDN Forum says you need to add a user right to the. mdf,.ldf file, run the following statement to find the name of the permission
1 Declare @sqlser varchar( -)
2 EXECMaster.. Xp_regread@rootkey='HKEY_LOCAL_MACHINE', @key='System\currentcontrolset\services\mssqlserver',
3 @value_name='objectname', @value=@sqlserOUTPUT
4 PRINT 'Account starting SQL Server Service:' +Convert(varchar( -),@sqlser)
The result on my machine is: Account starting SQL Server Service:localsystem, then right-click the folder containing the. mdf,.ldf file, switch to the security interface, add LocalSystem user. I can never find this user here, as
But here are some users such as: User (Prchaz01210\user), Administrator (Prchaz01210\user), I gave the latter to add Full Control permissions, and then try to attach, did not expect to succeed, I do not know the above statement to find out what information, and so there is time to see.
SQL bit 7-errors and workarounds for attach features using SQL Server