Get Adobe Flash player

Physical File Cannot be Opened – Attaching a Database

When attaching a database, the user gets a message stating the physical file could not be opened. This problem could be caused by the fact that an account without proper permissions cannot access a file. The *.mdf and *.ldf which is require to attach a database to a database instance. The message points to that clearly… “Access is Denied”Attach database failed for Server.

In order to fix this problem, you will have to increase your permissions to the MDF and the LDF files before attempting to attach them to the database. Locate the files and give your account full rights to the files. This requires you to navigate to the file location, right-click and select Properties to access the Security tab. Find your account or group and edit the permissions. You may currently only have Read access, so since your going to work with an online database you will have to make modifications, so give yourself Full Control.

Check the user permission

User Permission

After increasing the permissions, you should be able to attach the database to the instance without additional errors. Check the SQL instance to see if the database is now showing up and is expandable. Go through the different areas of the database to see if there are any issues viewing the tables, views and other objects. Especially check the Database Diagrams. When attaching a database, you may find that the database does not have an owner. The person who is attaching the database needs to become the owner in order to create or see database diagrams.

That’s all it takes to workaround the message “Physical file cannot be opened” when attaching a database. This is simply a permissions issue and can easily be resolved.

Defender USA