May 26, 2009 at 11:43 am
I have SQL Server Express installed on my laptop and created my database there.
I detached it wrongly thinking to send a copy to a remote associate to install on his server. I didn't realize my tables, diagrams etc. would disappear.
I used this syntax to detach it:
use master
go
sp_detach_db 'mydb'
go
When reattaching, I use
CREATE DATABASE mydb
ON (FILENAME = 'C:\[etc path to .mdf file]')
FOR ATTACH
GO
Execute brings this message:
Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mydb_log.LDF'. Operating system error 5(error not found)".
I was previously getting a similar error on my .mdf file, but changing permissions on the folder and file cleared that one. Doing so is not helping on this one.
I shall be grateful for any help.
May 26, 2009 at 12:10 pm
Operating system error 5 is "Access denied"
Check the folder and the log file, make sure that the SQL Service account has full permissions on the file.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 26, 2009 at 12:20 pm
Many thanks for the reply. I have successfully reattached.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply