Error 945 Severity Level 16
Message Text
Database '%.*ls' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.
Error 945 is returned when the database is marked 'IsShutdown' because of low memory and the database goes into inaccessible mode. This occurs when a database cannot be recovered due to missing files, or some other resource error that usually can be corrected easily. If during your SQL database you face SQL error 945 in MS SQL Server and if you are not sure what to do next then follow these steps by step method to troubleshoot the error:-
USE master
SELECT DATABASEPROPERTY ('master', 'IsShutDown')
Where master=”name of your database” the rest will remain the same, the purpose of this query is to find whether the database is inaccessible or not. If the output result is 1 then the data is inaccessible and the next thing you are going to do is apply this query.
use master
alter database db_name set offline
The purpose of the above query is to bring the database in offline mode
Now we need to bring back the database back to online mode, the purpose of this is that when we make it back to online mode the SQL verifies the Log files and rest of the files as well and if there are any errors it list them. For that we will apply this query
use master
alter database db_name set online
The issue is mainly related to file location and if it is the problem then you can apply the following query which in most cases will resolve the issue
alter database db_name
modify (file=’logical name’, filename=’physical name’)
go
Where db_name is the name of your database and ‘logical name ’ is the name set by you or the DBA for the database and ‘Physical name’ is system defined and is guaranteed to be unique.
In case if you are unable to retrieve your data back or it got corrupted due the error then you should try using one of our SQL database recovery software which comes handy in such situation and almost instantly fixes the SQL error 945.