If you see any of the following two errors when you attach a database to an SQL instance:
TITLE: Microsoft SQL Server Management Studio
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
CREATE FILE encountered operating system error 5(failed to retrieve text for this error. Reason: 15105) while attempting to open or create the physical file ‘E:\_restore\MSSQL10_50.SHAREP\MSSQL\DATA\UPSA_Social.mdf’. (Microsoft SQL Server, Error: 5123)
Event ID: 3415
“Database ‘Your database’ cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery.”
Then you should know it has nothing to do with the permissions to the database files you try to add, it is only because you need to start SQL Server Management Studio as administrator(Right click and select Run as Administrator).
Take a look at the error messages below.