I just ran into a problem where we were not able to create new tables in the database. The CREATE TABLE command would simply hang. After examining the log files, we saw the following error:
“Autogrow of file ‘<database_name>_log’ in database ‘<database_name>’ was cancelled by user or timed out after … ”
I examined the log files and found that the log file for the database had grown to over 50Gb.
My first attempt to truncate the log file was to use the “Shrink file” option from within Microsoft SQL Server Management Studio. To get there, right-click on the database name, select “Tasks” -> “Shrink” -> “Files”. In the dialog box that appears, change the file type from “Data” to “Log”. I tried several time to shrink the log file this way. No luck. I was not able to reduce the size of the log size to less than its allocated 50Gb.
The solution that my co-worker and I found was to use some SQL statements to reduce the log file size. The SQL we used was as follows: Continue reading Reducing the Size of SQL Server Log Files