In the last 11 years of blogging, I have never received a question which I have received yesterday. The question which I often receive is about how to add TempDB files in SQL Server but I have never received a question about how to remove a TempDB file.
Two days ago, I wrote an article SQL SERVER – How to Create Table Variable and Temporary Table? It was a very basic article for beginners. However, to my surprise, I have got tremendous response to that blog post and also got quite a lot of feedback about the it. Out of all these one feedback which stood out was that I did not include discussion about Global Temporary Table. I agree that when I was writing this blog post I did not think of this, but it is never too late to write about any topic. Let us see in this blog post how to create a global temporary table?
This is a very simple question and indeed many of us know about this one. However, if you are absolutely beginner, you will for sure need help with this one. Let us understand how we can create a table variable and temporary table in this simple tutorial.
Question: What is the Initial Size of TempDB? Trust me, this question is way more complicated than you read in one line.
This was really one of the issue where I was totally confused because SQL Server was raising incorrect error message. Let me first tell you what I was doing. I was trying to move TEMPDB database files to a new location. I ran below alter commands and restarted SQL Server. Let us learn about OS Error 5.
SQL SERVER – DBCC SHRINKFILE: Page 1:26423878 Could not be Moved Because it is a Work Table Page – TempDB Files
This blog is an outcome of an email communication with my client. The issue was that they were having big tempdb files. They had multiple files and of uneven size. As soon as they restart SQL, the initial size itself was huge and when they tried to shrink the TempDB database, it was not doing anything. Here was the message in SQL Server Management Studio query window.
I have started blogging on my site long ago and my whole idea was to make script repository so that others can reuse it. Now when I look back, there are many scripts and many solutions which I have written. Personally, I have used many of them. Today I am sharing another script which I have used with one of my clients and it was very useful for me in troubleshooting a strange TempDB log file issue. Let us learn about Monitoring TempDB Space Usage.