tempdb growth

As its names implies, the tempdb database contains temporary data that is created during SQL Server operations, therefore, the tempdb growth is one significant issue that needs to be properly managed in SQL Server.

Temporary data stored in tempdb system database

Temporary data stored in temdb 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.

 

How you can shrink tempdb?

So, how can you shrink the tempdb database and limit its size?

Even though tempdb is fully managed by SQL Server’s Database Engine, there are some things you can try to shrink it.

The following KB article describes three different methods for shrinking tempdb.

In summary, these are:

Method 1
Altering the tempdb file size with the “ALTER DATABASE [tableName] MODIFY FILE” command

Method 2
Using the “dbcc shrinkdatabase” command

Method 3
Using the “dbcc shrinkfile” command

 

Note: Generally, it is not recommended to try and manually limit the size of tempdb. Instead, you need to make a proper disk capacity planning and know your databases and any heavy batch operations they may run that use tempdb.

 

 

Strengthen your SQL Server Administration Skills – Enroll to our Online Course!

Check our online course on Udemy titled “Essential SQL Server Administration Tips
(special limited-time discount included in link).

Via the course, you will learn essential hands-on SQL Server Administration tips on SQL Server maintenance, security, performance, integration, error handling and more. Many live demonstrations and downloadable resources included!

Essential SQL Server Administration Tips - Online Course with Live Demonstrations and Hands-on Guides
(Lifetime Access/ Live Demos / Downloadable Resources and more!)

Learn More

 


 

Learn essential SQL Server development tips – Enroll to our Online Course!

Check our online course titled “Essential SQL Server Development Tips for SQL Developers
(special limited-time discount included in link).

Sharpen your SQL Server database programming skills via a large set of tips on T-SQL and database development techniques. The course, among other, features over than 30 live demonstrations!

Essential SQL Server Development Tips for SQL Developers - Online Course
(Lifetime Access/ Live Demos / Downloadable Resources and more!)

Learn More

 

Featured Online Courses:

 

Read Also:

Subscribe to our newsletter and stay up to date!

Subscribe to our YouTube channel (SQLNetHubTV)!

Like our Facebook Page!

Check our SQL Server Administration articles.

Check out our latest software releases!

Check our eBooks!

 

Rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Loading...

Reference: SQLNetHub.com (https://www.sqlnethub.com)

© SQLNetHub