Empty Space
  • Home
  • Resume
  • Posts
  • Personal
  • Code
Sign in Subscribe
code

Force clean database log files MS SQL

  • Robin Michael

Robin Michael

05 Apr 2017

The interactive tools are not working, but this script will clear a stubborn log file that won't release.

Link here

http://stackoverflow.com/questions/56628/how-do-you-clear-the-sql-server-transaction-log

Assumption: You are in simple mode

USE TheDatabase;
GO

CHECKPOINT;
GO

CHECKPOINT; -- run twice to ensure file wrap-around
GO

DBCC SHRINKFILE(TheDatabase_Logical_Name, 5); -- unit is set in MBs
GO;

Sign up for more like this.

Enter your email
Subscribe

Data Modeling: SQLite + Python

Working through a parsing problem of text files and finding the relationships between them. In this case there are three relevant files * UserIP - Holds the IP and UserId tracking information * Purchased - Holds the UserIds of every user that makes a purchase * AdClick - Contains various information, but the
04 Jul 2025 4 min read

Import git history

Need to import the git history of one repository into another due to consolidation of several separate microservices into a single vertical slice service. Example I have a repository called infra and I want to import the history of commits into the new current folder as it holds my consolidated
22 Jun 2025 1 min read

MySql: Upsert options

I was asked a question about doing an insert to a table with a unique index and id and to always set the field active if it exists. There are a multiple ways to do this, but I reached for the one that isn't actually available in MySql
14 Jun 2025 1 min read
Empty Space © 2025
Powered by Ghost