[Fixed] SQL Error 945 | Database Cannot Be Opened due to Inaccessible Files

SQL error 945, Database cannot be opened due to inaccessible files or insufficient memory or disk space, is one of the common SQL Server errors that marks a SQL database failure. Luckily, you can cope with SQL error 945 by adjusting settings or using the SQL Recovery Tool. Carry out the best-suited solution and fix SQL error 945 immediately.

Updated by Cedric on Nov 27, 2024
 | Home > MS SQL Database Recovery

"Database [database name] cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server error log for details. (Microsoft SQL Server, Error: 945)"

Workable Solutions Step-by-step Troubleshooting
Fix 1. Enlarge Hard Drive Space As you can see in the error notification, the SQL database may not be opened due to...Full steps
Fix 2. Make Sure Autogrowth Is On Open SQL Server Management Studio and connect to the problematic database...Full steps
Fix 3. Check the Account Permission You need to check the account you are using and make sure you have...Full steps
Fix 4. Check the MDF/NDF File Find and right-click the ".mdf "or ".ndf" file of your database. Choose "Properties"...Full steps
Fix 5. Use SQL Database Repair Tool Stop MS SQL Server service. Press "Windows + R" and enter services.msc...Full steps
Fix 6. Try DBCC CHECKDB If there is no backup available, you can also try the DBCC CHECKDB repair option...Full steps

What Is SQL Error 945

SQL Server error 945 happens when a database is marked as "IsShutdown" or when the attaching and detaching of MDF file is not properly done and the recovery procedure fails to bring the database to a consistent state.

SQL error 945

It may occur due to different reasons:

  • Disproportionate storage consumed by memory-optimized tables
  • SQL database repair failure due to some missing files
  • Using corrupt backup
  • Improper shutdown of the database
  • Malware attacks

When you are bothered by the SQL Server error 945, there are six solutions to try.

How to Fix SQL Error 945 Database Cannot Be Opened Due to Inaccessible Files or Insufficient Memory or Disk Space in 6 Ways

According to user experience, there are effectiveness-based solutions to error 945 in SQL Server - Database cannot be opened due to inaccessible files. At the very beginning, you can restart your SQL database through ALTER DATABASE query. This query will help you to set the SQL Server database to online. If this doesn't work, figure out with the following methods. 

Fix 1. Enlarge Hard Drive Space

As you can see in the error notification, the SQL database may not be opened due to insufficient disk space, getting rid of the unnecessary files on the corresponding hard drive or add a larger hard drive is a potential solution to the SQL Server error 945. If you are worried about data loss, you can back up the hard drive with free backup software in advance before the removal.

Fix 2. Make Sure Autogrowth Is On

Since the database must be set to Autogrowth, you need to check and make sure the option is enabled. Here is the way to enable Autogrowth:

Step 1. Open SQL Server Management Studio and connect to the problematic database.

Step 2. Click "View" > "Object Explorer".

Step 3. Expand the "Database" folder.

Step 4. Right-click the database and choose "Properties".

Step 5. Under "Select a Page", choose "Files" and look for the Autogrowth settings and check the option "Enable Autogrowth".

Fix 3. Check the Account Permission

You need to check the account you are using and make sure you have the correct permission to perform operations.

Fix 4. Check the MDF/NDF File of the Database

If the MDF or NDF file of the database is marked as read-only, you may encounter the SQL error 945. Thus, be sure that the MDF and NDF files are not shown as read-only. To remove read-only on the MDF or NDF file:

Step 1. Find and right-click the ".mdf "or ".ndf" file of your database. Choose "Properties" > "Security", then you will see Group or Username.

Step 2. Select the user you want to give access to the file and check the permission.

Step 3. If the permission is not set to Full Control, you need to change it by clicking "Edit".

Step 4. Then you will see the Group or Username box. In that box, select the user and choose "Full Control".

Fix 5. Use SQL Database Repair Tool

Go to the error log and see why the database goes wrong. If it is due to a persistent I/O error related to Application Programming Interface, a torn page, or other hardware issues then resolved it by restoring the database from backup. If you don’t have any backup available, you can repair your SQL database with the professional MS SQL repair tool - EaseUS MS SQL Recovery.

  • Repairs corrupted SQL database files (MDF/NDF files)
  • Repairs corrupted SQL server database components - tables, triggers, indexes, keys, rules & stored procedures
  • Recovers deleted/dropped records from SQL Database

Let's see how to repair your database with it:

Step 1. Stop MS SQL Server service

Press "Windows + R" and enter services.msc.

Find and double-click "SQL Server (instant name)".

In the Properties windows, click "Stop" to end the SQL Server and click "Apply" to confirm.

Step 2. Run EaseUS SQL repair tool. In the main interface, click "Browse" (the two dots) to choose the corrupted MDF/NDF file. Then click "Repair" to start analyzing your MDF/NDF file. 

If you know the exact location of the file, click "Browse" to locate the database.

If you don’t know the file location, click "Search" to search for the .mdf or .ndf file in.

select the SQL database file

Step 3. When it has done, you will see all the database objects listed in the left pane of the window. Choose the database objects you'd like to repair and click "Export".

Select the database objects

Step 4. Choose a preferred way to export the database data: "Export to database" or "Export as SQL scripts". If you select "Export to database", you need to further select the server information, log into your account, and select a destination database, either a new one or an existing one.

export the SQL database objects

Step 5. Before you click "OK", now you need to restart the SQL Server.

Press "Windows + R" and enter services.msc.

Find and double-click "SQL Server (instant name)".

In the Properties windows, click "Start" to restart the SQL Server service and click "Apply" to confirm.

Step 6. Click "OK" to save the repaired files to your desired SQL database.

Fix 6. Try DBCC CHECKDB Repair Option

If there is no backup available, you can also try the DBCC CHECKDB repair option. However, it is not recommended since it may induce the Suspect Mode of your SQL database, which may further lead to another SQL Server database error 926. (Click to see more SQL database errors.)

Wrap Things Up

We focused on one of the most common SQL server issues, error 945. We have discussed the possible reasons and solutions to fixing database that cannot be opened due to inaccessible files or insufficient memory or disk space issue. You can try the manual methods to fix SQL server error 945 like enlarge hard drive space, checking account permission, checking database files, and trying DBCC CHECKDB. 

For an easier approach, EaseUS SQL repair tool is worth trying. It offers the simplest way to repair corrupted  (.mdf and.ndf) files, fix database log files, and recover damaged objects.

More Info: How to Fix SQL Server Error 926

Similar to SQL error 945, SQL error 926 can also occur due to improper connection to SQL Server or using the RESTORE database or RESTORE LOG procedures, showing the error message "Database cannot be opened. It has been marked SUSPECT by recovery".  Take the following ways to solve this problem. 

  • Check DBCC CHECKDB: Check the error report and solve the issue with provided solutions
  • Restore from database backup: Restore databases if you have any available backup
  • Contact error logs: If you can't restore the SQL database from backup, you can try to contact primary support or contact the error logs for SQL Server.

Was This Page Helpful?

 

EaseUS MS SQL Recovery

  • Restore (.mdf and.ndf) Files
  • Recover Corrupted Objects
  • Fix Database Log Files
TRY IT NOW