Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Temp DB getting full.. Any remedies


Temp DB getting full.. Any remedies

Author
Message
a4apple
a4apple
SSC-Enthusiastic
SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)

Group: General Forum Members
Points: 170 Visits: 406
Hello Everyone,

I have a proc, that is used as a job previously that pulls lot of data. From the past 2 days, it is getting failed due to the reason, Temp DB getting full. It is a proc with lot of Outer joins and Group By statements and pulling lot of data from XML too.. Is there any solution for this. This is how my temp db looks like right now.


I used the following query on my DB and got the

SELECT
name AS FileName,
size*1.0/128 AS FileSizeinMB,
CASE max_size
WHEN 0 THEN 'Autogrowth is off.'
WHEN -1 THEN 'Autogrowth is on.'
ELSE 'Log file will grow to a maximum size of 2 TB.'
END,
growth AS 'GrowthValue',
'GrowthIncrement' =
CASE
WHEN growth = 0 THEN 'Size is fixed and will not grow.'
WHEN growth > 0 AND is_percent_growth = 0
THEN 'Growth value is in 8-KB pages.'
ELSE 'Growth value is a percentage.'
END
FROM tempdb.sys.database_files;
GO


tempdev 400.000000 Autogrowth is on. 10 Growth value is a percentage.
templog 300.000000 Autogrowth is on. 10 Growth value is a percentage.
tempdev1 400.000000 Autogrowth is on. 128 Growth value is in 8-KB pages.
tempdev2 400.000000 Autogrowth is on. 128 Growth value is in 8-KB pages.
tempdev3 400.000000 Autogrowth is on. 128 Growth value is in 8-KB pages.


Any Suggestion would be really helpful. Thanks in advance.

Good Luck Smile .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47415 Visits: 44405
Larger growth increments (fixed MB), grow TempDB manually, ensure there's enough space on the drive, tune the queries to use less TempDB.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


a4apple
a4apple
SSC-Enthusiastic
SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)

Group: General Forum Members
Points: 170 Visits: 406
GilaMonster (9/21/2012)
Larger growth increments (fixed MB), grow TempDB manually, ensure there's enough space on the drive, tune the queries to use less TempDB.


Growth size is 8KB and 10% on the other.. I actually dont know what they are.. My question is do I have to change them??

Grow tempdb manually? are there any steps to do it?

Enough space on the drive -- There is like 40GB on the drive.

queries are using Left joins on XML and I will try to optimize too, before that any other suggestions on the above listed.

Good Luck Smile .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47415 Visits: 44405
That's default growth increments, as I said, you probably want larger growth increments.

Growing a file manually - ALTER DATABASE ... ALTER FILE


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


a4apple
a4apple
SSC-Enthusiastic
SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)SSC-Enthusiastic (170 reputation)

Group: General Forum Members
Points: 170 Visits: 406
GilaMonster (9/21/2012)
That's default growth increments, as I said, you probably want larger growth increments.

Growing a file manually - ALTER DATABASE ... ALTER FILE



Can you please elaborate more.. This is my first time doing this. Also can you tell me is that a good way to do it?

Good Luck Smile .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45442 Visits: 39942
a4apple (9/21/2012)
Hello Everyone,

I have a proc, that is used as a job previously that pulls lot of data. From the past 2 days, it is getting failed due to the reason, Temp DB getting full. It is a proc with lot of Outer joins and Group By statements and pulling lot of data from XML too.. Is there any solution for this. This is how my temp db looks like right now.


I used the following query on my DB and got the

SELECT
name AS FileName,
size*1.0/128 AS FileSizeinMB,
CASE max_size
WHEN 0 THEN 'Autogrowth is off.'
WHEN -1 THEN 'Autogrowth is on.'
ELSE 'Log file will grow to a maximum size of 2 TB.'
END,
growth AS 'GrowthValue',
'GrowthIncrement' =
CASE
WHEN growth = 0 THEN 'Size is fixed and will not grow.'
WHEN growth > 0 AND is_percent_growth = 0
THEN 'Growth value is in 8-KB pages.'
ELSE 'Growth value is a percentage.'
END
FROM tempdb.sys.database_files;
GO


tempdev 400.000000 Autogrowth is on. 10 Growth value is a percentage.
templog 300.000000 Autogrowth is on. 10 Growth value is a percentage.
tempdev1 400.000000 Autogrowth is on. 128 Growth value is in 8-KB pages.
tempdev2 400.000000 Autogrowth is on. 128 Growth value is in 8-KB pages.
tempdev3 400.000000 Autogrowth is on. 128 Growth value is in 8-KB pages.


Any Suggestion would be really helpful. Thanks in advance.


Unless I'm readinng this output you provided incorrectly, TempDb is sitting at a total of 1.6GB with a 300MB log. That's not what I'd consider to be a large TempDB. I boot my production servers with a 20GB TempDB and even that is small by some folk's standards.

Why do you think TempDB is getting full? Are you approaching the physical disk limit?

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
ChrisM@Work
ChrisM@Work
SSCrazy Eights
SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)SSCrazy Eights (9K reputation)

Group: General Forum Members
Points: 9028 Visits: 19039
a4apple (9/21/2012)
Hello Everyone,

I have a proc, that is used as a job previously that pulls lot of data. From the past 2 days, it is getting failed due to the reason, Temp DB getting full. It is a proc with lot of Outer joins and Group By statements and pulling lot of data from XML too.. Is there any solution for this.
...
Any Suggestion would be really helpful. Thanks in advance.


Breaking up a large complex query into smaller chunks as #temp tables can help if SQL Server is creating large worktables (and bitmaps to support joins) in tempdb, which it's likely to do if there are different aggregation levels in your queries. Can you post the code? Better still, the actual plan.

“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
ramachandran narayanan
ramachandran narayanan
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 44
Dear Sir,

I have a query
there is only one field 'datetime' in the table.I have to calculate shifts ,intime and outtime is needed.
how to calculate intime and outtime?
Thanks and Regards
N.Ramachandran
anthony.green
anthony.green
SSCertifiable
SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)

Group: General Forum Members
Points: 6108 Visits: 6078
ramachandran narayanan (9/24/2012)
Dear Sir,

I have a query
there is only one field 'datetime' in the table.I have to calculate shifts ,intime and outtime is needed.
how to calculate intime and outtime?
Thanks and Regards
N.Ramachandran


Please do not hijack other peoples threads.

Please start your own thread and please also follow the information in the second link of my signature on how to post code and data for the best help.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
When a question, really isn't a question - Jeff Smith
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search