Cant Reduce the Size of Temp DB in production , though the free space is 95%

Hi,
In my production environment , the TempDb is consuming around 30 GB, where i can see the free space is around 95%.
I tried to shrink and end up with no results. I Canot go with Restarting the services, since its production server. So i have to ignore the same.
I even tried to clear cache, buffer by using below Queries.  but again didnt work out. 
DBCC FREEPROCCACHE -- clean cache
DBCC DROPCLEANBUFFERS -- clean buffers
DBCC FREESYSTEMCACHE ('ALL') -- clean system cache
DBCC FREESESSIONCACHE -- clean session cache
DBCC SHRINKDATABASE(tempdb, 10); -- shrink tempdb
dbcc shrinkfile ('tempdev') -- shrink db file
dbcc shrinkfile ('templog') -- shrink log file
I can see around few TempTables alive in tempdb, but those are very very small in size. I am not sure why this is not coming down. Can you please help me to suggest on the same. 
Thank you 
hemadri

Hi 
You need to identify what objects/data/plans consume disk space
-- Queries causing the most (de)allocations in tempDB
SELECT TOP 10
tsu.session_id, tsu.request_id, tsu.task_alloc, tsu.task_dealloc,
erq.command, erq.database_id, DB_NAME(erq.database_id) AS [database_name],
(SELECT SUBSTRING([text], statement_start_offset/2 + 1,
(CASE WHEN statement_end_offset = -1
THEN LEN(CONVERT(nvarchar(max), [text])) * 2
ELSE statement_end_offset
END - statement_start_offset) / 2
FROM sys.dm_exec_sql_text(erq.[sql_handle])) AS query_text,
qp.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 tsu
INNER JOIN sys.dm_exec_requests AS erq ON tsu.session_id = erq.session_id AND tsu.request_id = erq.request_id
OUTER APPLY sys.dm_exec_query_plan(erq.[plan_handle]) AS qp
WHERE tsu.session_id > 50 AND database_id >= 5
ORDER BY tsu.task_alloc DESC
GO
 ---to determine the space used by objects in TempDB:
SELECT
 SPID = s.session_id,
 s.[host_name],
 s.[program_name],
 s.status,
 r.granted_query_memory,
 t.text,
 sourcedb = DB_NAME(r.database_id),
 workdb = DB_NAME(dt.database_id),
 mg.*
FROM sys.dm_exec_sessions s
INNER JOIN sys.dm_exec_connections c
ON s.session_id = c.most_recent_session_id
LEFT OUTER JOIN sys.dm_exec_requests r
ON r.session_id = s.session_id
LEFT OUTER JOIN
  SELECT
   session_id,
   database_id
  FROM
   sys.dm_tran_session_transactions t WITH (NOLOCK)
  INNER JOIN
   sys.dm_tran_database_transactions dt WITH (NOLOCK)
  ON
   t.transaction_id = dt.transaction_id
 WHERE dt.database_id = DB_ID('tempdb')
GROUP BY
 session_id,
 database_id
) dt
ON s.session_id = dt.session_id
CROSS APPLY sys.dm_exec_sql_text(COALESCE(r.sql_handle, 
c.most_recent_sql_handle)) t
LEFT OUTER JOIN sys.dm_exec_query_memory_grants mg
ON s.session_id = mg.session_id
WHERE r.database_id = DB_ID('tempdb') OR dt.database_id = DB_ID('tempdb')
AND R.status = 'running';
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • Help!  Cant reduce screen size

    I have somehow managed to enlarge the size of all icons and pages on the phone. I have tried pinching, double tapping and restarting the phone to no avail. Because text is so large i am unable to read messages and to get to an icon i have to scroll down the page and keep my fingers crossed that it will stop on the right one. To make calls in am having to use the voice control function.
    Does anyone have any ideas that i can try to reduce the font/icon/screen size???
    I am trying to restore settings via iTunes but as i am currently in Saudi Arabia the download time is ridiculous!

    I did the same thing. I even went to the att store to see if they can fix it. No one could. I looked on these forums and found out how to fix it. Double tap your screen with three fingers. You cant go to setting cause it is soooo large. Its on zoom. Good luck!

  • To shrink the size of TEMP tablespace

    Dear all,
    There is a databse with RAC, now in OEM the size of TEMP tablespace has been reached at 99.9%. now we want to shrink the size of TEMP tablespace.
    how to we do that???????
    plz help me...........

    Temporary tablespaces usually show they are full, however this space is not actually in use. It is rather allocated. Oracle has evaluated the best way to obtain the most of performance, and he said it is better to allocate once than allocate-deallocate-reallocate extents, so temporary space is not 'released'.
    If you want to feel psychologically more confortable with lower allocated space, you can drop your tablespace (create an interim default temporary tablespace first) and recreate it.
    You can also rebuild temporary datafiles:
    alter tablespace temp add tempfile 'C:\ORACLE\ORACLEXE\ORADATA\XE\TEMP01.dbf' size 32m;
    SQL> select name from v$tempfile;
    NAME
    C:\ORACLE\ORACLEXE\ORADATA\XE\TEMP.DBF
    C:\ORACLE\ORACLEXE\ORADATA\XE\TEMP01.DBF
    SQL> alter database tempfile 'C:\ORACLE\ORACLEXE\ORADATA\XE\TEMP01.DBF' drop including datafiles;
    Database altered.

  • How can I reduce the size of a PDF in Preview without the pics turning green?

    How can I reduce the size of a PDF in Preview without the pics turning green?

    Do you have to use Preview or would a third party utility like PDFShrink be acceptable?
    (Also look at the Similar Softwar section on that page I linked to.)

  • In attempting to change the size of an open window I minimized the dock instead and cant access

    In attempting to change the size of an open window I minimized the dock instead and cant accessMinimized dock

    I'm sorry, but we don't have any immediate plans to change this... but I would never say never... and we appreciate the suggestion. You might want to register on our Ideas site and post this idea there - http://ideas.acrobat.com - if it gets a lot of votes, it will go up on our list of priorities.
    Best,
    Michelle

  • Why, when I add or change the size of one cell, others cells of the page expand?

    Why, when I add or change the size of one cell, others cells of the page expand?

    Start with the links I provided in my first reply - From Tables to CSS Parts 1 and 2.
    There are tons of free online tutorials available on the web.
    SitePoint
    Positioning is Everything - deals with fixes for well-known browser bugs.
    Max Design - CSS Page Layouts
    TJK Design - one HTML, many CSS layouts
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • I use tripit on both my iphone and ipad.  However, while tripit will sync with the gmail calendar on my iphone, it will not sync with the gmail calendar on my ipad, even though the setting are all in place, correctly for both.

    I use the "Tripit" travel app on both my iPhone and iPad2.  While I have no problem getting my Tripit info synced to the Gmail Calendar on my iPhone, I am unable to get Tripit to sync to the Gmail calendar on my iPad, even though the setup information (email address, settings, etc.) are exactly the same.  I know that Tripit is installed correctly on the iPad, as I am able to go to that app directly and correctly see all of my info.  However, even though I've set up the secondary "Tripit" calendar feed (to Gamil) on the iPad, it's not synchronizing and showing up.  Is anyone else having this problem?

    All I had to do was complain.  I synced my iPhone to the Windows machine, checked the other account at iTunes prompting (where no apps had shown up previously), reconnected the iPad, and 140 apps downloaded including the App Store.  I have no idea why.

  • I just updated my 3gs to the latest iOS 5 update and now I am unable to text certain numbers.  I keep getting the error code 1121611611 invalid number, even though the number I have in my contacts is a 10 digit number.  Any suggestions on fixing this?

    I just updated my 3gs to the latest iOS 5 update and now I am unable to text certain numbers.  I keep getting the error code 1121611611 invalid number, even though the number I have in my contacts is a 10 digit number.  Any suggestions on fixing this?

    PhotogYogi wrote:
    I Have the same issue on a brand new iPad mini 2. My battery is only lasting up to 5 hours. I went on chat with Apple last night and they said my battery is fine and its a Safari issue. I'm literally losing 1% every 3-4 minutes. I tried recalibrating my battery, signing out of iCloud, shutting off all locations, turning off background app refresh, restoring network settings, restoring all, and finally restoring from iTunes with no luck. This is just awful. I got this iPad so I could use it on my long flight for a trip I have coming up, and unfortunately, it's not going to last that long, plus I'm concerned about how many times i will be recharging my battery because of this since battery's do have a life cycle dependent on the number of charges. This is frustrating and needs to be fixed ASAP and addressed by Apple.
    By the way, Apple told me to bring my device to the Apple Store because it's still under warranty. That's great and all, but I'm going to waste my time if there is no fix for this issue.
    Ok so you want Apple to address the problem, but yet you don't want to take it to them just in case they can't fix it? What if they can fix it? Complaining here certainly won't fix it.

  • Does Secure Empty Trash Accomplish the same task as Running disk util to wipe free space

    Does using the secure empty trash option accomplish the same task as running disk util to eliminate free space from old deleted files?   I'm currently running the 7 pass deal on my late '12 iMac.  Says its gonna take 7 hrs.   Can I use safari or iTunes  while the Big Mac works its magic?

    Does using the secure empty trash option accomplish the same task as
    running disk util to eliminate free space from old deleted files?
    No.
    Finder > Empty Trash just tells the file system that those areas on the drive are now available for overwriting with new data. Data deleted off hard drives can be recovered if this method is used before it's overwritten with new data with special software.
    Finder > Secure Empty Trash runs a 7x pass military approved overwrite only on the deleted files in the Trash, works for hard drives only.
    Disk Utility > Erase Free Space creates a huge file that takes the remaining free space on the volume selected and either writes zeros or 7x pass, then confirms it and then removes the file.  Takes a long time to complete, do not interrupt.
    This can be used if one forgets to use Secure Empty Trash or wants to scrub caches or other files that don't necessarily go to the Trash for user deletion, such as program files that self delete and download cache files etc.
    Only works for hard drives and there is no recovery possible for nearly all users. Those with special expensive magnetic equipment can possibly recover data off a zero pass, but not off a 7x overwrite.
    The zero erase free space can be also be used to pre-eliminate potential unknown bad sectors on hard drives before wanted data is written to them, thus preventing future issues with data retention on hard drives.
    Disk Utility > Erase - (not moving the slider) will erase all data on the volume or partition selected, including wanted data. It just tells the file system the deleted data is ready for overwriting. Thus can be recovered using special software before it's overwritten on hard drives only.
    Disk Utility > Erase w/Security Option - (or moving the slider from the left) will secure erase all data on the volume or partition selected, including wanted data.
    It can vary on the operating system version used from zero pass, to 3x overwrite, to 7x overwrite to 35x overwrite (old version for days past of smaller drives, don't use on newer larger drives as it will take weeks to finish.)
    Secure erase methods are used to secure erase private data off of hard drives only, doesn't work for SSDs.
    For secure data deletion off a SSD or any flash media, it's NSA advised to grind it into a fine powder.
    How do I securely delete data from the machine?

  • HT1657 I had rented a movie on my IPhone5 and after downloading almost all of it, I get an error that there is no enough space. Why doesn't the store check to see if I have enough free space before proceeeding with the order?

    After downloading almost all of it, I get an error that there is no enough space. Why doesn't the store check to see if I have enough free space before proceeeding with the order?
    How do I get a refund?

    Well, with apps genneraly you do get told ahead of time. I'm not sure of the current algorithm with movies though.
    Why not just clear up some space? You can check your usage in your settings btw.

  • After upgrading to 3.6.8 none of the plugins load even though there are updates available. The updates will not install and even though the error states to look at the console error log there are no errors listed in the log.

    After upgrading to 3.6.8 none of the extensions load even though there are updates available. The updates will not install and even though the error states to look at the console error log there are no errors listed in the log. All extensions are listed in Addons>Extensions.
    == This happened ==
    Every time Firefox opened
    == Upgrading to newer Firefox version (3.6.8)

    I have been having the same issue for the last two weeks. No real indication as to why it ever began other than I had turned off my router and Airport Extreme Base Station off for a weekend while I was away from my place.
    iPad, iPhone, iPod Touch, all have no issues at all with my Airport Extreme Base Station. Can stay connected throughout my living room, bathroom, bedroom, no issues whatsoever.
    My 5 month old MacBook Pro 2.66 GHz Core i7 Airport is sometimes perfect, able to connect, DHCP, and browse without issue. Then, for no reason, I won't be able to join my wireless network, or when I can join, I can't pick up an IP address. And then it will connect, pick up and IP, and then it won't browse. No real rhyme or reason to when this will happen, or when it works.
    I thought that it was an issue with my MacBook Pro, but then my sister visited with her brand new MacBook Pro 2.26 Intel Core 2 Duo, and while a month ago she was able to connect, DHCP, and browse without issue, this weekend she had all of the same issues I was having.
    My XBOX 360 and MacBook Pro have absolutely no issues with the wired connection. Only my WAN seems to have this issue.
    Did you ever find anything more to this?

  • HT203254 I bought my MacBook Pro since 2008. Now I live in Thailand, and my MacBook had the second symptom (No video on the computer screen (or external display) even though the computer is on). How can I get guarantee in Bangkok?

    I bought my MacBook Pro since 2008. Now I live in Thailand, and my MacBook had the second symptom (No video on the computer screen (or external display) even though the computer is on). How can I get guarantee in Bangkok?
    <Serial Number Edited by Host>

    "That's why I'm wondering whether they still can fix it as lifetime guaranty or not?"
    No, not lifetime.
    According to the referencd article:
    "If the NVIDIA graphics processor in your MacBook Pro has failed, or fails within four years of the original date of purchase, a repair will be done free of charge, even if your MacBook Pro is out of warranty."

  • Has anybody experienced that the water indicator has been damaged even though the phone has been in contact with any fluids?

    My 6months old Iphone 4S started to turn itself of or freeze before shutting down about a month ago.
    I've been told it's the top water indicator that is broken and that the phone has been in touch with fluids-which it really hasn't!!
    Has anybody else experienced that the water indicator has been damaged even though the phone has not been in contact with fluids?

    Hi,
    I'm going to contact you via private message to get more contact info and case number.
    regards,
    steve

  • TS3218 my 6th gen nano plays the same song over and over even though the repeat is off. can anyone help me with this problem?

    my 6th generation nano plays the same song over and over even though the repeat is not on.

    It sounds like the repeat setting has been enabled. See page 21 of your iPod's User Guide for instructions on turning it off.
    http://manuals.info.apple.com/en_US/iPod_nano_6thgen_User_Guide.pdf
    B-rock

  • I have to zip pdf files to email them to someone with a PC. The problem is they aren't smaller after zipping and I can't email them. I tried adjusting the Quartz filter to the Reduce file size. Now they're smaller, but the recipient can't read them. Help!

    I need to zip pdf files to email them to a PC user. The problem is file size is not reduced.
    I tried zipping them in Win 7 (which I use via Parallels 7) and sending them to the Finder to email.
    But lately nothing is reduced.  I tried choosing the Reduce File Size option in the Quartz Filter when I save the doc. The file size was reduced. However, the recipient could not read the file. Everything was blurry.
    Is there a solution?

    I am having some PDF sizing issues also, I am a BETA tester for TurboCAD Mac, and with the usage of (public) version 5, I have had some scaling issues. I have had (auto sent) 15 plus crash reports, (available as text) and had posted my scenario within the "lion- problems so far" article, so not to use up extra bandwith- or whatever- there are pictures there. I was not able to upload a PDF on site, and the staff @ Turbo CAd is working on it also. this is Lion specific new update, as I have posted many large format PDF's
    Here (edit to add url)
    Thanks for the helps!
    Johnny

Maybe you are looking for

  • K7N2 Delta-L

    My spec : - K7N2 Delta-L - Sempron 2200+ - ADATA Vitesta DDR 500 256 mb - FIC Radeon 9000 Pro 128 Mb 128 bit - HDD Seagate Barracuda 40 Gb - PSU Simbadda 350 watt My K7N2 no screen if I turn on it but if I use another board, My computer have no probl

  • URGENT! Help with creating more than one linked button

    Hi! Could someone help a newbie with trying to figure out this. I work in Flash CS3, AS3. I've created a button that links to another webpage by using this code (the code is added to a separate layer): import flash.events.MouseEvent; steud.addEventLi

  • I wnat to type in my password each time I go into e-mail instead of automatically hitting "sign in."

    My e-mail address book has been hacked. I want to type in my sign-in password each time instead of hitting "sign in" or having my email automatically remembered by Mozilla.

  • IOS 6.0 music shuffle does NOT work

    The music player does not remember where the last session ended.  I have about 1000 songs on my iPhone.  I play the songs in the Shuffle mode - and it worked fine on iOS 5.x.  Ever since I updated to iOS 6.0, the shuffle seems to be seriously broken.

  • I need a recommended way of recovering from Bus Off errors

    I have write problems when a UUT is instructed to reset. When the UUT in the reset state I get Error Passive warnings and Bus Off errors after attempting to write extended CAN messages using the Frame API. In brief the test goes like this, 1. I send