Skip to content

Instantly share code, notes, and snippets.

View thiagoserra's full-sized avatar
🎯
Focusing

Thiago Serra F Carvalho thiagoserra

🎯
Focusing
View GitHub Profile
@thiagoserra
thiagoserra / Move TempDB.sql
Created May 6, 2022 20:46 — forked from FlogDonkey/Move TempDB.sql
Moves SQL TempDB files to designated location, and sizes them appropriately. If there are multiple instances hosted on the same SQL Server, divide the drive size by the instance count, and create folders for each instance name on the destination drive.
/*
Snippet is nuts and bolts for creating/moving to an isolated tempdb drive.
After you run this, SQL Server must be restarted for it to take effect
*/
DECLARE @DriveSizeGB INT = 40
,@FileCount INT = 9
,@RowID INT
,@FileSize VARCHAR(10)
,@DrivePath VARCHAR(100) = 'T:\' + @@SERVICENAME + '\';