Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 457141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:32:27+00:00 2026-05-12T22:32:27+00:00

I am facing a serious issue in my production server where the temp DB

  • 0

I am facing a serious issue in my production server where the temp DB grow exponantialy. Is there any way we can recover the tempDB space without restarting the SQL service?

Cheers
Kannan.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:32:28+00:00Added an answer on May 12, 2026 at 10:32 pm

    I would ignore posts advising you to change the recovery model or limit the size of tempDB(!).

    You need to track down the actual cause of the growth.

    If you have the default trace turned on (it’s on by default, out of the box), you can retrospectively find out what caused the growth by running this:

    --check if default trace is enabled
    if  exists (select 1 from sys.configurations where configuration_id = 1568)
    BEGIN
    
    declare @defaultTraceFilepath nvarchar(256)
    
    --get the current trace rollover file
    select @defaultTraceFilepath = CONVERT(varchar(256), value) from ::fn_trace_getinfo(0)
    where property = 2
    
    SELECT ntusername,loginname, objectname, e.category_id, textdata, starttime,spid,hostname, eventclass,databasename, e.name 
    FROM ::fn_trace_gettable(@defaultTraceFilepath,0)
          inner join sys.trace_events e
                on eventclass = trace_event_id
           INNER JOIN sys.trace_categories AS cat
                ON e.category_id = cat.category_id
    where 
          databasename = 'tempDB' and 
          cat.category_id = 2 and --database category
          e.trace_event_id in (92,93) --db file growth
    
    END
    

    Otherwise, you can start a SQL Profiler trace to capture these events. Turn on capturing of Auto Growth events, Sort Warnings and Join Warnings and look for cross joins, hash joins or missing join conditions.

    SQL Server exposes a way to identify tempDB space allocations by currently executing queries, using DMVs:

    -- This DMV query shows currently executing tasks and tempdb space usage
    -- Once you have isolated the task(s) that are generating lots 
    -- of internal object allocations, 
    -- you can find out which TSQL statement and its query plan 
    -- for detailed analysis
    select top 10
      t1.session_id, 
      t1.request_id, 
      t1.task_alloc,
      t1.task_dealloc,  
      (SELECT SUBSTRING(text, t2.statement_start_offset/2 + 1,
              (CASE WHEN statement_end_offset = -1 
                  THEN LEN(CONVERT(nvarchar(max),text)) * 2 
                       ELSE statement_end_offset 
                  END - t2.statement_start_offset)/2)
         FROM sys.dm_exec_sql_text(sql_handle)) AS query_text,
     (SELECT query_plan from sys.dm_exec_query_plan(t2.plan_handle)) as query_plan
    from      (Select session_id, request_id,
    sum(internal_objects_alloc_page_count +   user_objects_alloc_page_count) as task_alloc,
    sum (internal_objects_dealloc_page_count + user_objects_dealloc_page_count) as task_dealloc
           from sys.dm_db_task_space_usage 
           group by session_id, request_id) as t1, 
           sys.dm_exec_requests as t2
    where t1.session_id = t2.session_id and 
    (t1.request_id = t2.request_id) and 
          t1.session_id > 50
    order by t1.task_alloc DESC
    

    (Ref.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing strange issue on Windows CE: Running 3 EXEs 1)First exe doing
I'm facing what looks like a simple a issue of computing a mean value
I am facing a weird issue. I am changing the text color of my
I am facing below errors when trying to statically link libDuma, Can you tell
I am facing problem with an Oracle Query in a .net 2.0 based windows
I am facing a problem with .NET generics. The thing I want to do
I'm facing a problem with IE6. I took the toggle function from this website
I have a public facing website that has been receiving a number of SQL
I am facing a problem. I would like to localize my action names in
I'm facing a real problem in understanding how to draw a variable diagram to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.