As its names implies, the tempdb
database contains temporary data that are created during SQL Server operations.
Such data may include: temporary user objects (i.e. temporary tables, cursors), row versions (i.e. those that come up from online index operations), and other internal objects that are created by SQL Server Database Engine.
The tempdb is global on a SQL Server Instance, that is available to all the users/databases on a SQL Server Instance, so in the cases where an instance might contain a large number of databases resulting to a large number of operations which use temporary data, this might have as an effect the tempdb size to increase rapidly.
So, how can you shrink the tempdb database and limit its size?
Well, there is more than one option for doing this.
The following KB article describes three different methods for shrinking tempdb.
In summary, these are:
Altering the tempdb file size with the "ALTER DATABASE [tableName] MODIFY FILE" command
Using the "dbcc shrinkdatabase" command
Using the "dbcc shrinkfile" command
Labels: SQL Server, SQL Server Administration, SQL Server Performance