Question: How do you resolve Sql Server Database Error: "the log for database is not available"?
Please Login to see the rest of the answer
Answer: There is a chance that you tried to attach a database to a Server and during the process of attaching the database the database log wasn't attached.
- If this was the case then follow the solution below to resolve this issue:
- Check to see if the Database log hasn't hit the maximum file size specfied in the Database Properties
- Right click on the Database
- Click on "Files"
[NB] Once the database logs has been touched/modified the file won't be able to be modified again. So, changing the file size to unlimited space won't work.
However, this does not imply not trying at all, things might have changed by the time you are reading this article.
- If the database won't allow you to write to it because the Database Log is not available, try to stop the Sql Server Service and restart the Server. Chances are that Databse Log file is corrupt and you should start looking into creating a new Database with new log files.
- Another possible solution is to set up a Transaction Log Shipping in Database Properties, this will back up the database and it's logs at an interval.
- Another possible solution is to Shrink the Database Log file:
- Right Click the Database Name and navigate to "Tasks" then "Shrink Database", change from "Data" to "File" and choose "YourDatabaseLogFileName", finally click "Ok" to shrink the database log file.