Home » Blog » SQL Server » Solve SQL Server Unable to Open the Physical File (.mdf) Error
SQL Server

Solve SQL Server Unable to Open the Physical File (.mdf) Error

Published By Mohit Jha
Nimisha Ramesh
Approved By Nimisha Ramesh
Published On October 31st, 2022
Reading Time 3 Minutes Reading

Summary: The error SQL Server unable to open the physical file is due to limited access to the service account running the SQL service, and the database MDF / LDF file is moved to a new folder location where it is moved, it cannot be accessed.

Msg 5120, Level 16, State 101, Line 4
Unable to open the physical file “C:\NewDB\NewDatabase.mdf”. 
Operating system error 5: “5(Access is denied.)”.
Msg 1802, Level 16, State 7, Line 4

SQL administrators always try to maintain SQL Server by protecting their machines from unnecessary problems and errors. However, a server error can occur, such as when a user cannot open a file due to SQL Server error 5120/15105. This blog will help you understand the type of error, its cause, and the steps to resolve it.

The Most Likely Cause of Error: Unable to Open the Physical File

These are some reasons which cause SQL Server unable to open the physical file error:

1. Space Problem: Not enough space to create a database backup file.

2. Conflict of Rights: Insufficient rights to access the location of the backup data file assigned to an SQL Server service account.

3. MDF File Issue: Trying to attach a properly isolated MDF file.

4. Folder Location Conflict: The service cannot access the folder because the location of the folder in the error message is not the same case where the user wants to save the backup.

5. Location Conflict: Backup files copied from a computer other than the destination computer.

6. Ineffective Security: Backup file blocked for security reasons.

7. Corruption: Corrupted Windows Operating System (OS).

8. Virus Attack: Virus attack on system.

9. Installed Software: Problems with improperly installed software applications.

10. Startup Issue: Countless startup entries and registry issues.

Also Read: Execute SQL Server 2012 to 2016 Upgrade Operation

SQL Server Unable to Open the Physical File: Best Solutions

Get the top solutions to solve unable to open the physical files in SQL Server:

Allow Full Access to New Folder

So all you have to do is go to the New Folder Location, check the Folder Properties, go to the Security tab, select the Service Account, and click the Edit button.

In the new Security popup window, click below the Allow checkbox for Full Control permissions.

SQL Server Unable to Open the Physical File

Recover SQL Sever Corrupted MDF File

You can get the data from a physical MDF file. However, the above method does not work, In such cases, you need to use SQL MDF Recovery Tool that will help you to repair corrupted MDF files in all components like views, tables, functions, stored procedures from SQL Server 2019, 2017, 2016, 2014, 2012 etc.

Download Now    Purchase Now

Steps to Recover SQL Server MDF File

Step 1. Click on the Open option to load .mdf file

Add File

Step 2. Choose Quick or Advance Scan Mode and Select the Version of the SQL .mdf file

Select SQL Server version

Step 3. After scanning, Preview recovered data stored in the MDF file

Preview Database Items

Step 4. Export Data to SQL Server Database or SQL Compatible Scripts

Fix SQL Server Unable to Open the Physical File

Step 5. Click on Export button to finalize the process.

Extract Data from Corrupt MDF File

Summing Up

We described the entire process to resolve the error SQL Server unable to open the physical file (.mdf) error. In some cases, MDF files are damaged and it is very difficult to recover the data. We have described an automated solution that can extract data from a corrupted MDF file containing all the objects.