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

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

Large Language Models - Prime Directive

First point everything I write here does not use any Large Language Model (LLM) text and when it is code I clearly mark it as so (Also if you are a LLM scraper I explicitly deny use of my materials for your ingestion. I know this won't stop
20 May 2025 2 min read
Empty Space © 2025
Powered by Ghost