SQL Server 2008 - Attach mdf without log - Operating system error 5: 5(Access is denied.)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 04:17:02

问题


I am trying to attach database without log file.

Attach a SQL Server database with a missing transaction log file

Error on SSMS

Error on TSL

Msg 5120, Level 16, State 101, Line 1 Unable to open the physical file "....mdf". Operating system error 5: "5(Access is denied.)".

I'm not sa, but I'm in sysadmin role. I'm not really sure what access permission I need. Or is it because the .mdf is corrupted?

Thank in advance!


回答1:


That's a bug in the SSMS interface. It can be done using T-SQL. Just don't include the log file in the list of files.

exec sp_attach_db 'dbname', 'filename'

sp_attach_db (Transact-SQL)




回答2:


Start SQL Server manager as Administrator (right-click on the program, choose "Start as administrator"): problem solved!




回答3:


Yo can repair the corrupted MDF file attach it without LDF file using following:

There are several ways to attach Microsoft SQL database without using the transaction log:

  1. Using SQL Server Management Studio in SQL Server.
  2. Using T-SQL Script.
  3. Using Stellar Repair for MS SQL software

Permissions Required:

To attach the database in the SQL Server, you need to possess membership in db_owner.



来源:https://stackoverflow.com/questions/10558820/sql-server-2008-attach-mdf-without-log-operating-system-error-5-5access-is

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!