问题
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:
- Using SQL Server Management Studio in SQL Server.
- Using T-SQL Script.
- 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