Solved

unable to shrink tempdb data file in single user mode

Posted on 2011-09-08
6
589 Views
Last Modified: 2012-05-12
select @@spid
union
select spid from sys.sysprocesses where dbid = 2

gives me only one row.. (the session is the only user in tempdb)

still the below does not shrink it. why? what could be blocking it, since there is no other spid that is keeping a hold on it?

dbcc shrinkfile (1,10240)
0
Comment
Question by:25112
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
dbaSQL earned 167 total points
ID: 36507500
0
 
LVL 5

Author Comment

by:25112
ID: 36507530
in that link, Method 2 & 3 do not avail any help. i am hoping to avoid Method 1.

if I am the only spid, why would there any hindrance to shrink it?
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 333 total points
ID: 36514840
You need to restart the SQL Server service and it will initialize tempdb to whatever setting you had configured.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 5

Author Comment

by:25112
ID: 36516865
i had told management that i will have to restart sql service after off-hours..

but now, when i ran dbcc shrinkfile (1,10240) again, it worked fine.. (it shrank it).. could there be processes not seeing in sysprocesses that could be holding tempdb, and when it is released it works ok to shrink?
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 333 total points
ID: 36517172
>>could there be processes not seeing in sysprocesses that could be holding tempdb, and when it is released it works ok to shrink? <<
Yes.
0
 
LVL 5

Author Comment

by:25112
ID: 36517499
good to know..
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now