Sample Header Ad - 728x90

User does not have permission to alter database '', the database does not exist, or the database is not in a state that allows access checks

0 votes
0 answers
2072 views
Our log file was full, so I made a mistake in trying to shrink it. My original thought was to move the log file to a different drive, shrink the log, then move it back. However, I did it incorrectly. What I did was the following: 1. Set the database in Single User Mode 2. Took the database offline 3. Moved the log file to a different drive Tried to bring the database back online, and now getting the following errors: >Msg 5011, Level 14, State 7, Line 10\ User does not have permission to alter database '', the database does not exist, or the database is not in a state that allows access checks I tried to move the log file back without shrinking it and still get that error. I am not sure how to bring the database back online at this point and unfortunately have not found a solution via various Google articles. I tried to find SPIDs that were blocking
SELECT request_session_id FROM sys.dm_tran_locks WHERE resource_database_id = DB_ID('DB') 
Select * from master.sys.sysprocesses Where spid > 50 And dbid=DB_ID ('DB')
These brought back no results. Log is configured with maximum size. Recovery mode is FULL. Unfortunately, do not take regular backups. Tried to run ALTER DATABASE OffLineDB SET ONLINE but get the error: > User does not have permission to alter database 'OfflineDB', the database does not exist, or the database is not in a state that allows access checks.\ Msg 5069, Level 16, State 1, Line 5\ ALTER DATABASE statement failed. We cannot do anything to bring the database online or put it into MULTI_USER mode. Any "ALTER" command executed gives that error message. The database is "OFFLINE" in "SINGLE_USER". I can use the ALTER command on any other DB, but just not this one to bring it back online. The physical log files are in the same place as the database shows. We do not have DAC enabled. The log just keeps showing: >"Logon failed for user [user]. Reason: Failed to open the explicitly specified database '[Database]'. [CLIENT: ". Error: 18456 Severity 14. State 38 The database being offline is causing those errors. Just cannot seem to be able to bring it back online and into MULTI_USER mode. I believe that the issue is due to file permissions when I moved the log file and moved it back, but just cannot seem to figure out how to get them back.
Asked by A M C (9 rep)
Oct 26, 2023, 09:22 PM
Last activity: Oct 27, 2023, 12:39 PM