Problem: I have a SQL Server database sitting on a 1 TB drive. The log will not grow past 5 MB even when the MAXSIZE
is set much larger than 5 MB.
Error received:
The transaction log for database 'Temp' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
Questions:
- How do I fix this?
- Why is this happening?
Code:
CREATE DATABASE Temp ON PRIMARY(
NAME = Temp
, FILENAME = 'C:\\Temp.mdf'
, SIZE = 2MB
, FILEGROWTH = 10%)
LOG ON (
NAME = Temp_Log
, FILENAME = 'C:\\Temp.ldf'
, SIZE = 1MB, MAXSIZE = 70MB
, FILEGROWTH = 10%)
Result of select name, log_reuse_wait_desc from sys.databases where name = 'temp';
:
name, log_reuse_wait_desc
Temp, NOTHING
Additional Information:
- Sql Server manager says
maxsize = 5mb
andrestricted growth
- Recovery mode
Simple
- Database is handling hundreds of individual SQL Statements as it is for a data integration tool
Updated Addition information:
When the SQL statement is run directly in the SQL server manager it creates successfully and does not cause errors on implementation...On the other hand if the create database statement is run progmatically using System.Data.SqlClient and the exact same syntax it creates the Database with all defaults. I have to additionally supply alter database statements to achieve the proper behavior.
Code to run Queries:
public void AcuConvert()
{
using (DestD)
{
SqlCommand command = new SqlCommand();
DestD.Open();
command.Connection = DestD;
foreach (var item in Entity.SqlDestinationQueries.ToList())
{
command.CommandText = item.Query;
command.ExecuteNonQuery();
}
foreach (var item in Entity.SystemQueries.ToList())
{
command.CommandText = item.Query.Replace("@Sys", SysD.Database);
command.ExecuteNonQuery();
}
foreach (var item in Entity.InsertQueries.ToList())
{
command.CommandText = item.Query.Replace("@Source", SourceD.Database); ;
command.ExecuteNonQuery();
}
}
}