Register
Home   Ask Question Discuss Purchase Submit Events Give Solutions Share News
Automobiles Beauty & Styles Business Computers & Internet Sports Travel Consumer Electronics Education Entertainment & Music Family Society & Culture Food & Drinks Health
Computer Networking
Hardware
Internet
Programming & Design
Security
Software
Other - Computers
How to Remove tempdb files
-->

Issue:

The tempdb currently has two additional mdf data files, tempdev1, tempdev2

I'm running the following command

ALTER DATABASE tempdb REMOVE FILE tempdev2

And while I expect to see the message

Msg 5042, Level 16, State 1, Line 1

The file ‘tempdev2' cannot be removed because it is not empty.

Solution:

I found that restarting the SQL instance name and then immediately running the below query removed the data file

USE tempdb;
GO
DBCC SHRINKFILE('tempdev1', EMPTYFILE)
GO
USE master;
GO
ALTER DATABASE tempdb
REMOVE FILE tempdev1;

--
Bookmark and Share
Related Posts
Comments
Add Comment
Name*
Email*
Comment*
Hot Categories: Family Celebrities General Health Care Friends Security Community Service Software Other - Business & Finance
Contact Us About Us Privacy Policy Copyright Sitemap