Skip to content

Instantly share code, notes, and snippets.

View erikdarlingdata's full-sized avatar
💭
Chillin 🤖

Erik Darling erikdarlingdata

💭
Chillin 🤖
View GitHub Profile
/**************************************************************************
Check Index Fragmentation based on Page Fullness and Fill Factor
***************************************************************************
Author: Eitan Blumin | https://www.eitanblumin.com
Version History:
2020-10-20 Added @MaxDOP parameter, and better comments & indentation
2020-01-07 First version
Description:
This script was inspired by Erik Darling's blog post here:
@TheRockStarDBA
TheRockStarDBA / Shrink_DB_In_Chunks.sql
Last active May 13, 2024 07:01
Shrink database in chunks - tsql
/*
This script is used to shrink a database file in
increments until it reaches a target free space limit.
Run this script in the database with the file to be shrunk.
1. Set @DBFileName to the name of database file to shrink.
2. Set @TargetFreeMB to the desired file free space in MB after shrink.
3. Set @ShrinkIncrementMB to the increment to shrink file by in MB
4. Run the script