LKBEN11462: Find the actual size of tempDB on MS SQL-Server.
LKB | Created: 30/10/2020 | Version: 4 | Language: EN | Rating: 0 | Outdated: False | Marked for deletion: False
Author: Wim Peeters - Keskon GmbH & Co. KG
Latest update: 30/10/2020 | Comment:
Symptom
You need to find out how much space is needed by TempDB on your SQL Server.
Cause
TempDB can become big and knowing the current size is important.
Solution
You can use the GUI, right click on your TempDB and find the size. This is the initial size or startup size of TempDB. When TempDB grows, this will not match the actual current size.
To get the actual current size you can use the following command:
sp_helpdb 'TempDB'
Another possibility is to use:
select Name,size*8 as KB from Tempdb.sys.database_files
This will show a different view of TempDB and you will have to count the sizes together.
Full details can be seen with:
select * from Tempdb.sys.database_files
Please note that the size column is in KB.
About the Author
Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux in different European countries and different European languages. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform where he is one of the most important contributors and the main developer.