asp.netsql-serverasp.net-mvcdatabase

"The transaction log for database is full due to 'LOG_BACKUP'" in a shared host


I have an Asp.Net MVC 5 website with EntityFramework codefirst approach in a shared hosting plan. It uses the open source WebbsitePanel for control panel and its SQL Server panel is somewhat limited. Today when I wanted to edit the database, I encountered this error:

The transaction log for database 'db_name' is full due to 'LOG_BACKUP'

I searched around and found a lot of related answers like this and this or this but the problem is they suggest running a query on the database. I tried running

db.Database.ExecuteSqlCommand("ALTER DATABASE db_name SET RECOVERY SIMPLE;");

with the visual studio (on the HomeController) but I get the following error:

System.Data.SqlClient.SqlException: ALTER DATABASE statement not allowed within multi-statement transaction.

How can I solve my problem? Should I contact the support team (which is a little poor for my host) or can I solve this myself?


Solution

  • Call your hosting company and either have them set up regular log backups or set the recovery model to simple. I'm sure you know what informs the choice, but I'll be explicit anyway. Set the recovery model to full if you need the ability to restore to an arbitrary point in time. Either way the database is misconfigured as is.