A few days back we have moved to 2014 from 2012 server and we kept the same settings as earlier like we are using 8 data files in Tempdb for better performance and all placed in single drive.
As this is data warehouse environment batch loads are running continuously and tempdb drive is getting full.Even though 98% free space in Database it could not able reuse space and throwing disk is full.
Insufficient space in tempdb to hold row versions. Need to shrink the
version store to free up some space in tempdb. Transaction
(id=239368387 xsn=1273322 spid=126 elapsed_time=1590) has been marked
as a victim and it will be rolled back if it accesses the version
store. If the problem persists, the likely cause is improperly sized
tempdb or long running transactions. Please refer to BOL on how to
configure tempdb for versioning.
Question
-
Is there any specific settings for tempdb to avoid these issues in SQL Sever 2014?
-
Any recommendation for tempdb performance improvement like enabling trace flag -T1118 ?
In 2012 it was taking only 64 GB and now even 450 GB is not sufficient.
Server specification.
SQL Server detected 4 sockets with 15 cores per socket and 30 logical processors per socket, 120 total logical processors; using 120 logical processors based on SQL Server licensing. 512 GB RAM.
Best Answer
Before troubleshooting TempDB space, it is good to know what objects are using TempDB.
Even though you have issues only with Version Store, knowing what objects are using TempDB will give you a good idea on where to start.
Remember, TempDB is a global resource for all databases, so this will be used for all databases. At a high level these are the objects that can use TempDB:
1. User objects
2. Internal objects
These are internal objects created by SQL Server for Work Tables, Hash Joins, sorts...
3. Version Store
Further Cursors, Database Mail, DBCC CHECKDB can also use TempDB. See this article for more details Capacity Planning for tempdb
Now that we know how TempDB is used, we can track TempDB space utilization using DMVS provided by SQL Server..
To Track user objects which are consuming the most space:
space used by user objects:(Active Only)
Space used by Internal Objects((Active Only)):
Version Store: You can find the list of transactions which are using version store. To see how much space they consume, refer to article at the end
Space used by transaction will be cleaned automatically when the transaction has completed. If the transaction is open for long time, it will prevent Version Store cleanup and you may have to check why, by joining with sys.dm_exec_sessions or sys.sysprocesses
You also can automate this space usage collection for later analysis.
This is just to give you idea, but it may not work in your version as some columns might have changed.
Query to gather details:
Once you have gathered enough data, you can analyze using below queries:
Query 1: This query reports the maximum allocated space in TempDB over all the data points collected
Query 2: This query computes the maximum allocated pages and the version store size in megabytes over all the data points collected. If the amount of TempDB space that is allocated to the version store is large, it implies that long-running transactions are generating or consuming versions.
Query 3: This query shows the top five queries that are allocating the most pages for internal objects.
Below are the references i used which can help you further:
Below is must read: