How to shrink tempdb.mdf:
Exec Backup log tempdb with no_log the restart SQL Service If not used, then execute: use tempdbdbcc shrinkfile (Tempdev, 1)
How to shrink tempdb.log
1: DBCC ShrinkDatabase (Tempdb, 10) --- 10 Percent2: DBCC ShrinkFile (LogicalFileName, Newsize) --- Newsize: MB
Why:
When Tempdb is used to store temporary table data, it is reset to its initial size each time you start the database engine.