Home » SQL Server Error : 945, Severity: 16. Database ‘%.*ls’ cannot be opened due to

SQL Server Error : 945, Severity: 16. Database ‘%.*ls’ cannot be opened due to

SQL Server Error : 945 Details


SQL Server Error: 945
Severity: 16
Event Logged or not: No
Description:
Database ‘%.*ls’ cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.
Severity 16 Description:
Indicates general errors that can be corrected by the user.

“Database [TestDb] 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)”

SQL Server error 945 occurs mostly when a database is marked as “IsShutdown” or when the attaching / detaching of MDF file is not done properly by server and it fails to bring database to a consistent state.

This SQL Server Error 945 error may occur due to:

  • Storage consumed by memory-optimized tables
  • SQL database repair failure due to some missing or corrupt files
  • Using corrupt backup which was due to power glitch or some other reason
  • Improper shutdown of the database like crashing of server etc..
  • External hacking attempts

Reading sql server error log location from SQL Query

For sql server error code 945, we need to check SQL Server Error Log File used by SQL Server Database Engine. It  can be done by reading SQL Server Error Logs. DBA can execute the XP_READERRORLOG extended stored procedure to read the SQL Server Error Log and search for its location used by the instance of SQL Server.

USE master
Go
xp_readerrorlog 0, 1, N'Logging SQL Server messages in file', NULL, NULL, N'asc'
Go

The parameters for XP_READERRRORLOG are:
1. Value of error log file we would like to read. values are 0 = current, 1 = last one before current, 2 = second last before current etc…
2. Log file type:- 1 or NULL = error log, 2 = SQL Agent log
3. Search string 1:- String one you want to search for
4. Search string 2:- String two you want to search for to further refine the results
5. start time for Search
6. end time for search
7. Sort order for search results:- N’asc’ = ascending, N’desc’ = descending

By default, we have 6 Server Error Logs kept but we can increase the number of SQL Server Error Logs from the default value of six.

For other ways to read and find error log location please our artcile https://sqlserver-dba.co.uk/error-log/sql-server-identify-location-of-the-sql-server-error-log-file.html

Solution for Resolving the Error

Solution for microsoft sql server error 945 msdb or sql server service error code 945 or sql server express error code 945 or other similar errors with 945 is

1. Add more hard drive or disk space either by adding new hard drive with larger size or cleanup removing of unnecessary files from hard drive.

2. Check if the database is set on Autogrow for it to expand.

3. Check if the AD or system account which is trying to access the database has enough permission to perform operation.

4. Check the error log and see details of errors on why the database is having issues.

5. Make sure that .mdf and .ldf file are not marked as read only on operating system file system level.

 

SQL Server Error Code and solution summary


SQL Server Error: 945
Severity: 16
Event Logged or not: No
Description:
Database ‘%.*ls’ cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.

1. Add more hard drive or disk space.

2. Check if the database is set on Autogrow for it to expand.

3. Check if the AD or system account has enough permissions.

4. check error log and see details of errors

5. Make sure that .mdf and .ldf file are not marked as read only

Leave a Reply

Your email address will not be published. Required fields are marked *