|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 2:47 PM
Points: 1,178,
Visits: 2,701
|
|
I have gone through many many different forums in trying to identify my tempdb issues. None of the queries are giving me the data i want. Basically at the moment my tempdb log file is 38 gb, after i run all the queries from different forums i see ONLY 300 MB being used in tempdb. I am still lost and have these questions:
i) Do the DMV's consider log file usage/capacity at all or is it just data file?
ii) Can someone please provide me with a query which will tell me which spid has used up all the tempdb data and log file.
Thanks
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Monday, June 17, 2013 1:45 PM
Points: 15,442,
Visits: 9,572
|
|
sp_who2 should tell you which SPIDs are active in tempdb. Can use the Management Studio activity monitor (right-click the server name in the object explorer if you haven't use that tool before), but that can be a pain since it updates constantly.
DBCC SQLPERF(LOGSPACE) should tell you how much log space is being used.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 2:47 PM
Points: 1,178,
Visits: 2,701
|
|
GSquared (10/30/2012) sp_who2 should tell you which SPIDs are active in tempdb. Can use the Management Studio activity monitor (right-click the server name in the object explorer if you haven't use that tool before), but that can be a pain since it updates constantly.
DBCC SQLPERF(LOGSPACE) should tell you how much log space is being used.
I see that ONLY 25% is being used. I did try to take with backup with truncate_only option and then shrink,still log file shows 38 gb.?
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:29 AM
Points: 38,113,
Visits: 30,401
|
|
TempDB is in simple recovery model, Backup log with truncate_only does nothing to a DB in simple recovery.
When shrinking a log file, you can't shrink past the active portion of the log. If that's right at the end of the file, you'll need to wait until it cycles around to shrink the log.
p.s. Why are you shrinking the log anyway?
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 2:47 PM
Points: 1,178,
Visits: 2,701
|
|
GilaMonster (10/30/2012) TempDB is in simple recovery model, Backup log with truncate_only does nothing to a DB in simple recovery.
When shrinking a log file, you can't shrink past the active portion of the log. If that's right at the end of the file, you'll need to wait until it cycles around to shrink the log.
p.s. Why are you shrinking the log anyway?
Thanks. What do u mean by " If that's right at the end of the file, you'll need to wait until it cycles around to shrink the log."
I am curious to see that why is my tempdblog 40gb, basically my end goal is to find the process which is causing it to grow such big
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:29 AM
Points: 38,113,
Visits: 30,401
|
|
The log is a circular file, SQL writes log records until it reaches the end of the file, then cycles round and starts reusing the file from the beginning. Managing Transaction Logs http://www.sqlservercentral.com/articles/Transaction+Log/72488/
If you want to see what's using the log, put some monitoring in place, don't shrink it and force it to grow again.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 2:47 PM
Points: 1,178,
Visits: 2,701
|
|
I guess at the moment i wanted to know why can't i shrink my logfile, what is holding up. Any query that can tell me this?
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 4:29 AM
Points: 38,113,
Visits: 30,401
|
|
DBCC LOGINFO
If the active portion of the log is at the end of the file (or near the end) you will not be able to shrink because nothing can move log records and shrink can only remove space that's after the active portion of the log
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: 2 days ago @ 11:12 PM
Points: 323,
Visits: 973
|
|
you can restrict the tempdb log file size ,so that it will stop growing and log file will get reuse . and then you can try to shrink .
also restarting the sql server service can help you ...but I will never recommend for it 
----------------------------------------------------------------------------- संकेत कोकणे
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Monday, June 17, 2013 10:16 AM
Points: 863,
Visits: 2,135
|
|
sanket kokane (10/31/2012)
you can restrict the tempdb log file size ,so that it will stop growing and log file will get reuse . and then you can try to shrink . also restarting the sql server service can help you ...but I will never recommend for it 
restarting sql server will help and how about closing/droping all the temp objects after its use is over.
but restricting tempdb size might also cause the query related to tempdb to wait for resources incase other resource still want the tempdb space.
Regards Durai Nagarajan
|
|
|
|