<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>TempDB on Andy M Mallon - AM²</title><link>https://am2.co/tag/tempdb/</link><description>Recent content in TempDB on Andy M Mallon - AM²</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Tue, 28 Apr 2020 09:00:24 -0400</lastBuildDate><atom:link href="https://am2.co/tag/tempdb/index.xml" rel="self" type="application/rss+xml"/><item><title>Stop trying to shrink tempdb files</title><link>https://am2.co/2020/04/28/stop-trying-to-shrink-tempdb/</link><pubDate>Tue, 28 Apr 2020 09:00:24 -0400</pubDate><guid>https://am2.co/2020/04/28/stop-trying-to-shrink-tempdb/</guid><description>&lt;figure class="wp-caption alignright" style="max-width:455px"&gt;&lt;a href="https://ShouldIShrinkMyDatabase.com"&gt;&lt;img src="https://am2.co/wp-content/uploads/black-and-white-cat-1317844-910x1024.jpg" alt="" width="341" height="384" class="size-large wp-image-3090" /&gt;&lt;/a&gt; Every time someone shrinks a database, a kitten dies. &lt;/figure&gt;&#10;&lt;h2 id="stop-shrinking-your-tempdb-data-files"&gt;Stop shrinking your tempdb data files&lt;/h2&gt;&#10;&lt;p&gt;I recently wrote about &lt;a href="https://am2.co/2020/04/21/fixing-tempdb/"&gt;growing, shrinking, and removing tempdb files&lt;/a&gt;. In that article I explained that SQL Server won&amp;rsquo;t move a page that contains an internal worktable object, and thus trying to shrink tempdb files can be futile. Today, I&amp;rsquo;m going to explain how attempting to shrink tempdb files can actually be harmful.&lt;/p&gt;</description></item><item><title>Fixing tempdb: Growing, shrinking, and removing data files</title><link>https://am2.co/2020/04/21/fixing-tempdb/</link><pubDate>Tue, 21 Apr 2020 09:00:37 -0400</pubDate><guid>https://am2.co/2020/04/21/fixing-tempdb/</guid><description>&lt;figure class="wp-caption alignright" style="max-width:500px"&gt;&lt;a href="https://www.youtube.com/watch?v=RaCodgL9cvk"&gt;&lt;img src="https://am2.co/wp-content/uploads/drop-files-here-extra.jpg" alt="" width="500" height="224" class="size-full wp-image-3070" /&gt;&lt;/a&gt; Dropping tempdb files like they're hot&lt;/figure&gt;&#10;&lt;p&gt;I recently came across a server where &lt;code&gt;tempdb&lt;/code&gt; was breaking all the rules.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&#9;&lt;li&gt;Data files were all different sizes. I want all data files to be the same size so that proportional fill uses them evenly.&lt;/li&gt;&#10;&#9;&lt;li&gt;There were 10 &lt;code&gt;tempdb&lt;/code&gt; files, with 8 files on a dedicated disk, and 2 on a slower disk shared with other data files. And free space was sky high, so the extra files aren't needed anymore! (They were probably added to fix a short-term emergency, and never cleaned up.)&lt;/li&gt;&#10;&#9;&lt;li&gt;The log file was tiny, and didn't have room to grow. For a 500GB tempdb, the log file was only 4GB!&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="three-fixes"&gt;Three fixes&lt;/h2&gt;&#10;&lt;p&gt;There are three problems I&amp;rsquo;ve got to fix. I need to (1) remove those two extra files, (2) grow the &lt;code&gt;tempdb&lt;/code&gt; log file, and (3) even out the size of the data files (and shrink them a little to make room for the larger log file. We&amp;rsquo;re going to tackle these in the reverse order than I listed them&amp;ndash;partially out of necessity, and partially because it&amp;rsquo;s going to be easier.&lt;/p&gt;</description></item><item><title>Is it possible for master, tempdb, model and msdb to have a database_id other than 1,2,3,4 respectively?</title><link>https://am2.co/2020/02/12/is-it-possible-for-master-tempdb-model-and-msdb-to-have-a-database_id-other-than-1234-respectively/</link><pubDate>Wed, 12 Feb 2020 12:25:11 -0500</pubDate><guid>https://am2.co/2020/02/12/is-it-possible-for-master-tempdb-model-and-msdb-to-have-a-database_id-other-than-1234-respectively/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/259510/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;SQL Server &lt;a target="_blank" rel="noopener"&gt;System Databases&lt;/a&gt;, as far as I know, always have those same IDs and I have seen lots of maintenance scripts on the internet relying on the predicate &lt;code&gt;WHERE database_id &amp;gt; 4&lt;/code&gt; to exclude them from the actions of the script.&lt;/p&gt;</description></item><item><title>Cannot connect to my SQL Management studio after moving a tempDB</title><link>https://am2.co/2019/11/01/cannot-connect-to-my-sql-management-studio-after-moving-a-tempdb/</link><pubDate>Fri, 01 Nov 2019 22:27:39 -0400</pubDate><guid>https://am2.co/2019/11/01/cannot-connect-to-my-sql-management-studio-after-moving-a-tempdb/</guid><description>&lt;p&gt;&lt;a href="https://dba.stackexchange.com/q/252407/52344"&gt;&lt;img src="https://am2.co/images/stack-exchange-question-mark.svg" alt="Question on Stack Exchange" width="96" height="96" class="stack-exchange-question-icon" /&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="question"&gt;Question&lt;/h2&gt;&#10;&lt;p&gt;In quite a bad position here. This afternoon on my tempDB I ran the query:&#10; &lt;code&gt;sp_helpfile&lt;/code&gt; to locate where my MDF and LOG file were. My MDF was on my C: drive and my LOG file was on a D: drive so I've run the following query to move this Log file from the D: drive back to C: drive. (This may not have been exactly the query I run as I don't remember what it was precisely!)&lt;/p&gt;</description></item></channel></rss>