SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


why i can't shrink tempdb data file


why i can't shrink tempdb data file

Author
Message
shotman
shotman
SSC-Enthusiastic
SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)

Group: General Forum Members
Points: 103 Visits: 92
Looks like u do have a run away transaction like one of them emntioned. Either terminate that session and run shrink or wait for it to finish. There is no silver bullet to shrink as long as there is an active transaction using tempdb.



shotman
shotman
SSC-Enthusiastic
SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)SSC-Enthusiastic (103 reputation)

Group: General Forum Members
Points: 103 Visits: 92
That was a neat workout...it did not occur to me and have saved the same for future use (Near future). Should have read all the comments before my last post on this subject.



Malcolm Daughtree
Malcolm Daughtree
SSC Veteran
SSC Veteran (299 reputation)SSC Veteran (299 reputation)SSC Veteran (299 reputation)SSC Veteran (299 reputation)SSC Veteran (299 reputation)SSC Veteran (299 reputation)SSC Veteran (299 reputation)SSC Veteran (299 reputation)

Group: General Forum Members
Points: 299 Visits: 335
Go here... and read ..
http://www.sqldev.org/getting-started-with-sql-server/unable-to-shrink-tempdb-in-2005-104030.shtml
also here.
http://support.microsoft.com/kb/307487
mike schreiner
mike schreiner
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 3
How you fix it-

1.. Shut down SQL Services on SQL Backend.
2. Go to cmd prompt and Run as Administrator
5. Go to the Binn directory of the SQL Server instance. In this case it was d:\Program Files\Microsoft SQL Server\MSSQL10_50.AFVCSQLSERVER01\MSSQL\Binn
6. In the cmd prompt, type the following-
sqlservr -c -f -sAFVCSQLSERVER01

IF YOU DON'T have a SQL Server instance, just type sqlserver -c -f

KEEP THE CMD WINDOW OPEN!!!!!

7. Go to SQL Server Management Studio and click on the tempdb database.
8. Click on New Query

ALTER DATABASE tempdb MODIFY FILE
NAME = 'tempdev', SIZE = 100)
--Desired target size for the data file
ALTER DATABASE tempdb MODIFY FILE
(NAME = 'templog', SIZE = 100)
--Desired target size for the log file

9. Click on Execute. You will see the query completed successfully.
10. Go to the CMD prompt and do a CNTL-C. That will exit single user mode of SQL Server.
11. Go to services and start up the SQL Services. The files will now be 100 MB.

all done!!!
Bhuvnesh
Bhuvnesh
SSCertifiable
SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)SSCertifiable (5.5K reputation)

Group: General Forum Members
Points: 5478 Visits: 4076
mike schreiner (5/9/2012)
2. Go to cmd prompt and Run as Administrator
5. Go to the Binn directory of the SQL Server instance. In this case it was d:\Program Files\Microsoft SQL Server\MSSQL10_50.AFVCSQLSERVER01\MSSQL\Binn
6. In the cmd prompt, type the following-
sqlservr -c -f -sAFVCSQLSERVER01

IF YOU DON'T have a SQL Server instance, just type sqlserver -c -f

KEEP THE CMD WINDOW OPEN!!!!!
Why we require this ?

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Brandie Tarvin
Brandie Tarvin
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15298 Visits: 9006
mike schreiner (5/9/2012)
How you fix it-

1.. Shut down SQL Services on SQL Backend.
2. Go to cmd prompt and Run as Administrator
5. Go to the Binn directory of the SQL Server instance. In this case it was d:\Program Files\Microsoft SQL Server\MSSQL10_50.AFVCSQLSERVER01\MSSQL\Binn
6. In the cmd prompt, type the following-
sqlservr -c -f -sAFVCSQLSERVER01

IF YOU DON'T have a SQL Server instance, just type sqlserver -c -f

KEEP THE CMD WINDOW OPEN!!!!!

7. Go to SQL Server Management Studio and click on the tempdb database.
8. Click on New Query

ALTER DATABASE tempdb MODIFY FILE
NAME = 'tempdev', SIZE = 100)
--Desired target size for the data file
ALTER DATABASE tempdb MODIFY FILE
(NAME = 'templog', SIZE = 100)
--Desired target size for the log file

9. Click on Execute. You will see the query completed successfully.
10. Go to the CMD prompt and do a CNTL-C. That will exit single user mode of SQL Server.
11. Go to services and start up the SQL Services. The files will now be 100 MB.

all done!!!


Mike, have you actually used this method yourself or did you get it from somewhere else?

Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Brandie Tarvin
Brandie Tarvin
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15298 Visits: 9006
Bhuvnesh (5/9/2012)
mike schreiner (5/9/2012)
2. Go to cmd prompt and Run as Administrator
5. Go to the Binn directory of the SQL Server instance. In this case it was d:\Program Files\Microsoft SQL Server\MSSQL10_50.AFVCSQLSERVER01\MSSQL\Binn
6. In the cmd prompt, type the following-
sqlservr -c -f -sAFVCSQLSERVER01

IF YOU DON'T have a SQL Server instance, just type sqlserver -c -f

KEEP THE CMD WINDOW OPEN!!!!!

Why we require this ?


I'm thinking it's because you're in single user mode and if you close the command prompt, you lose the query window you just opened. But I will admit that I'm just guessing.

Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
mike schreiner
mike schreiner
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 3
I just did this yesterday. I followed a microsoft knowledgebase article and it worked perfectly.
mike schreiner
mike schreiner
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 3
I had a 26 Gig tempdb.mdf file . I did everything exactly as i postted. After everything was done, the size was only 100mb.
lynns
lynns
SSC-Enthusiastic
SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)SSC-Enthusiastic (141 reputation)

Group: General Forum Members
Points: 141 Visits: 323
Restarting SQLServer works for me. We are using SQL Server 2005.
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