Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Attach Database Error after moving MDF Expand / Collapse
Author
Message
Posted Sunday, March 3, 2013 12:31 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 12:50 PM
Points: 2,832, Visits: 8,509
I needed to move the MDF to another location so I detached the database, and dragged the MDF to a new folder. I was thinking it had finished copying, so I attempted to attach it, but got an error because the MDF was in use. No surprise. After the copy finished, I tried to attach again, but now I get the error:

"Unable to open the phuysical file "F:\log\search_log.LDF Operating system error 5 "Access is denied" SQL Error 5120.

I did not make any changes to the LDF, so not quite sure why that is throwing the error.

Any suggestions ?



Post #1425991
Posted Sunday, March 3, 2013 1:27 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 2:42 PM
Points: 224, Visits: 1,732
"Access is denied" check if account, on which running sql server have sufficient rights
Post #1426001
Posted Sunday, March 3, 2013 1:30 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 2:09 PM
Points: 40,193, Visits: 36,597
The SQL Server service does not have permissions on the log file or the directory it's in. Check the permissions, ensure that SQL Server service has full control over both folder and file.

Log file, not data file.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1426003
Posted Sunday, March 3, 2013 3:19 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 12:50 PM
Points: 2,832, Visits: 8,509
The permission problem seems like it would be a red herring. I had no trouble moving (detach/attach) a different database in the same folders. And I wasn't moving the log file, just the MDF.


Post #1426022
Posted Sunday, March 3, 2013 3:30 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 2:09 PM
Points: 40,193, Visits: 36,597
Check the permissions, the error is OS error 5, that is a permission problem.
Could be that in the detach the permissions on the files were changed, I have seen that. Usually the SQL Server service retains permissions, but worth checking.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1426023
Posted Sunday, March 3, 2013 3:31 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 12:50 PM
Points: 2,832, Visits: 8,509
You are correct (as usual). All good now after manually putting permissions back on.


Post #1426024
Posted Sunday, March 3, 2013 3:53 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, October 9, 2014 4:06 PM
Points: 450, Visits: 1,342
There are a number of reasons to rather do an OFF LINE rather than a DETACH when moving database files like this. In SQL 2005 there was a particular issue with permissions being lost, but it looks like this happens ocassionally in SQL 2008 as well. I've never seen this happening using OFF LINE.

Another issue is a detach losses some database spesific configurations that are maintained in the MASTER database (e.g. cross database ownership chaining - not a recommended option), which aren't lost when an OFF LINE is used.

Cheers

Leo
Post #1426031
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse