473,594 Members | 2,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to drop one of the tempdb files

Hi all, I have a tempdb that consists of 8 datafiles, tempdb_data_1 to
tempdb_data_8, each is 8GB. Now how can I drop 7 of them and leave
only tempdb_data_1? Can this be done? Thanks a lot.

Nov 23 '05 #1
3 14090
New MSSQL DBA (bo*******@gmai l.com) writes:
Hi all, I have a tempdb that consists of 8 datafiles, tempdb_data_1 to
tempdb_data_8, each is 8GB. Now how can I drop 7 of them and leave
only tempdb_data_1? Can this be done? Thanks a lot.


I have not tried it, but my naive guess is that you would do as for
any other database. That is first DBCC SHRINKFILE with EMPTYFILE, and
then ALTER DATABASE.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Nov 23 '05 #2
I've tried this:

use tempdb
go
dbcc shrinkfile(temp dev4, emptyfile)
go
alter database tempdb
remove file tempdev4
go
then it gives something like this:

Server: Msg 5042, Level 16, State 1, Line 1
The file 'tempdev4' cannot be removed because it is not empty.
File 'E:\Microsoft SQL Server\MSSQL\da ta\tempdev4.ndf ' modified in
sysaltfiles. Delete old file after restarting SQL Server.
Don't know what does this mean. Does it mean that the file will be
dropped after I restarted the server?

Nov 23 '05 #3
New MSSQL DBA (bo*******@gmai l.com) writes:
I've tried this:

use tempdb
go
dbcc shrinkfile(temp dev4, emptyfile)
go
alter database tempdb
remove file tempdev4
go
then it gives something like this:

Server: Msg 5042, Level 16, State 1, Line 1
The file 'tempdev4' cannot be removed because it is not empty.
File 'E:\Microsoft SQL Server\MSSQL\da ta\tempdev4.ndf ' modified in
sysaltfiles. Delete old file after restarting SQL Server.
Don't know what does this mean. Does it mean that the file will be
dropped after I restarted the server?


I don't know, but why not give it a try?

If this is a production machine, you may want to first play with a
test server, to see the effects of the commands.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3366
by: M A Srinivas | last post by:
Hello, I would like to know is it possible to disable drop database for sa or sysadmin. If saor sysadmin needs to drop the database , he/she may have to change status in one of the system tables (sysdatabases ?) and then only database can be dropped . This is to avoid dropping the database by mistake by sa. In books online under drop database System databases (msdb, master, model, tempdb) cannot be dropped
3
11862
by: Sean Lambert | last post by:
We had someone create an extra data file and log file for tempdb. So we currently have two data files and two log files. Is it possible to delete the newly created data and log files? If I just delete the physical files, I assume they'll get created as soon as SQL Server gets started back up. Any help would be great, since a single data and log file for tempdb is my goal. Thanks much.
3
8285
by: tom horner | last post by:
Something strange is happening to our SQL Server DB (2000). The tempdb transaction log file continues to grow (quite slowly) for no apparent reason. We have it in simple mode, and I have tried a manual checkpoint command and manual shrink (of the log file only). There are no unusual SQL's (large or small) going on. A "heavy hitter" would make it grow fast, not 10 MB every 30 minutes or so. This server has been in production for over a...
2
3718
by: Warren Wright | last post by:
Hi All, First, where can I get some questions of this sort answered? Preferably, are there good books or online guides that I can consult for these types of answers when necessary? 1. How do I know, when executing a query from Query Analyzer or otherwise, how many temporary tables will be needed, and how big they will be? 2. Where will those temporary tables be created? Always in tempdb?
0
1898
by: Rob | last post by:
Hello, I've a couple of questions on setting up my lovely new server... I've decided on R1 (2*36GB) for the OS, R1 (2*73GB) primarily for the Log Files and R5 (5*73GB) for the Data files. I was wondering if I could increase performance by partitioning off/ creating a new volume on my log array and placing on there the tempdb and possibly another volume for the indexes.ndf. Any ideas on whether its OK to have other volumes use the same...
2
4017
by: Ryan | last post by:
Just a quicky about temporarary tables. If using QA, when you create a temporary table, it gets dropped if you close the query. Otherwise you need to state 'DROP TABLE myTable' so that you can re-run the query without the table being there. Sometimes, you can have quite lengthy SQL statements (in a series) with various drop table sections throughout the query. Ideally you would put these all at the end, but sometimes you will need to...
8
12753
by: arijitchatterjee123 | last post by:
Hi Group, I am facing a problem regarding locking. I have created a Stored Procedure in my Database. In this Stored Procedure Temprary Tables get created and after that values are inserted in these tables.But this Stored Procedure is called from Java Portal. When then Stored Procedure execute from Java end new transaction begins. So all these temporary tables are created in tempDB and locking the entire Database. So at the same time if...
1
7219
by: SQL Server | last post by:
Hi, The tempdb file on one of our servers grew very large and used all available disk space. This is SQL Server 2000 SP4. I have installed hotfix version 8.00.2187. I opened a profiler trace but can't still get to the root of the problem. Any help will be appreciated. Egbon *** Sent via Developersdex http://www.developersdex.com ***
0
1755
by: VIPS | last post by:
On Apr 3, 7:29 am, "Krisnamourt via SQLMonster.com" <u21487@uwe> wrote: REGARDING TEMP DB SIZE: -For a small db server that does about 10-20 GB of logging per day, I would recommend having a size that does not go through AUTO_GROW. i.e ensure that the size of tempdb is big enough that it will hold the whole days work.
0
7954
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8259
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8016
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8244
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6669
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5836
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5415
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3871
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1487
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.