Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 tempdb

Author  Topic 

pmccann1
Posting Yak Master

107 Posts

Posted - 2006-12-04 : 09:27:46
is it ok to move the this from the c drive to another drive?

X002548
Not Just a Number

15586 Posts

Posted - 2006-12-04 : 09:29:54
Except fo the o/s, I don't have anything installed on a c drive



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

pmccann1
Posting Yak Master

107 Posts

Posted - 2006-12-04 : 09:34:48
i am not sure what is on the server c drive but when i try to run a query it says the tempdb is fully and it is in the c drive and when i checked there is very little space just wondering is it ok to move it
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-12-04 : 10:14:46
Yes, much better to move it in fact!

Kristen
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-12-04 : 10:18:39
From BOL

quote:

Optimizing tempdb Performance
General recommendations for the physical placement and database options set for the tempdb database include:

Allow the tempdb database to automatically expand as needed. This ensures that queries that generate larger than expected intermediate result sets stored in the tempdb database are not terminated before execution is complete.


Set the original size of the tempdb database files to a reasonable size to avoid the files from automatically expanding as more space is needed. If the tempdb database expands too frequently, performance can be affected.


Set the file growth increment percentage to a reasonable size to avoid the tempdb database files from growing by too small a value. If the file growth is too small compared to the amount of data being written to the tempdb database, then tempdb may need to constantly expand, thereby affecting performance.


Place the tempdb database on a fast I/O subsystem to ensure good performance. Stripe the tempdb database across multiple disks for better performance. Use filegroups to place the tempdb database on disks different from those used by user databases.




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-12-04 : 10:24:59
>> Allow the tempdb database to automatically expand as needed
Yeah right - good idea to fill up the disk.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-12-04 : 10:30:39
Let's see what 2k5 bol recommends



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-12-04 : 10:38:04
BOL 2k5 has more to say, but basically the same thing

quote:

To achieve optimal tempdb performance, we recommend the following configuration for tempdb in a production environment:

Set the recovery model of tempdb to SIMPLE. This model automatically reclaims log space to keep space requirements small.

For more information, see ALTER DATABASE (Transact-SQL) or How to: View or Change the Recovery Model of a Database (SQL Server Management Studio).


Allow for tempdb files to automatically grow as required. This allows for the file to grow until the disk is full.

Note:
If the production environment cannot tolerate the potential for application time-outs that may occur during autogrow operations, preallocate space to allow for the expected workload.



Set the file growth increment to a reasonable size to avoid the tempdb database files from growing by too small a value. If the file growth is too small, compared to the amount of data that is being written to tempdb, tempdb may have to constantly expand. This will affect performance. We recommend the following general guidelines for setting the FILEGROWTH increment for tempdb files.


tempdb file size FILEGROWTH increment
0 to 100 MB
10 MB

100 to 200 MB
20 MB

200 MB or more
10%*

* You may have to adjust this percentage based on the speed of the I/O subsystem on which the tempdb files are located. To avoid potential latch time-outs, we recommend limiting the autogrow operation to approximately two minutes. For example, if the I/O subsystem can initialize a file at 50 MB per second, the FILEGROWTH increment should be set to a maximum of 6 GB, regardless of the tempdb file size. If possible, use instant database file initialization to improve the performance of autogrow operations.


Preallocate space for all tempdb files by setting the file size to a value large enough to accommodate the typical workload in the environment. This prevents tempdb from expanding too frequently, which can affect performance. The tempdb database should be set to autogrow, but this should be used to increase disk space for unplanned exceptions.


Create as many files as needed to maximize disk bandwidth. Using multiple files reduces tempdb storage contention and yields significantly better scalability. However, do not create too many files because this can reduce performance and increase management overhead. As a general guideline, create one data file for each CPU on the server (accounting for any affinity mask settings) and then adjust the number of files up or down as necessary. Note that a dual-core CPU is considered to be two CPUs.


Make each data file the same size; this allows for optimal proportional-fill performance.


Put the tempdb database on a fast I/O subsystem. Use disk striping if there are many directly attached disks.


Put the tempdb database on disks that differ from those that are used by user databases.








Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

pmccann1
Posting Yak Master

107 Posts

Posted - 2006-12-04 : 10:55:59
the problem is the c drive is full i need to something with the database growing the file will not help that
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-12-04 : 11:06:39
So move it off the C: drive - or am I missing something?
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-12-04 : 11:07:19
hopw big is tempdb now, and how is you server configured?

And what else do you ave on the c drive?

What other disks do you have

Is this a production or dev box?

How many users



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

pmccann1
Posting Yak Master

107 Posts

Posted - 2006-12-04 : 11:11:31
Kristen you cant detach a system file, that was my first idea.

the problem is where i work i in charge of the sql someone else is in charge of the servers , they ahve set the c drive up with only 3gb and when installing other stuff have been stupid enough to use the c drive for everything.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-12-04 : 11:16:56
So your C: drive doesn't have enough space for TEMPDB, thus it needs to be moved.

If you are meaning to ask HOW you move it then the first item in a Google Search is this:

http://support.microsoft.com/kb/224071

Kristen
Go to Top of Page

pmccann1
Posting Yak Master

107 Posts

Posted - 2006-12-04 : 11:24:18
i know how to detach and attach db's but the tempdb is a system file and therefore wont let you
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-12-04 : 11:25:14
Well it sounds like you should get busy, and start migrating all of the user databases first

But do you know what books online is?

quote:

Updated: 14 April 2006

This topic describes how to move system databases in SQL Server 2005. Moving system databases may be useful in the following situations:

Failure recovery. For example, the database is in suspect mode or has shut down because of a hardware failure.


Planned relocation.


Relocation for scheduled disk maintenance.


The following procedures apply to moving database files within the same instance of SQL Server. To move a database to another instance of SQL Server or to another server, use the backup and restore or detach and attach operations.

The procedures in this topic require the logical name of the database files. To obtain the name, query the name column in the sys.master_files catalog view.

Important:
If you move a system database and subsequently rebuild the master database, you must move the system database again because the rebuild operation installs all system databases to their default location. For more information about rebuilding the master database, see "Rebuilding System Databases, Rebuilding the Registry" in How to: Install SQL Server 2005 from the Command Prompt.



Planned Relocation and Scheduled Disk Maintenance Procedure
To move a system database data or log file as part of a planned relocation or scheduled maintenance operation, follow these steps. This procedure applies to all system databases except the master and Resource databases.

For each file to be moved, run the following statement.

Copy Code
ALTER DATABASE database_name MODIFY FILE ( NAME = logical_name , FILENAME = 'new_path/os_file_name' )


Stop the instance of SQL Server or shut down the system to perform maintenance. For more information, see Stopping Services.


Move the file or files to the new location.


Restart the instance of SQL Server or the server. For more information, see Starting and Restarting Services.


Verify the file change by running the following query.

Copy Code
SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'<database_name>');






Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-12-04 : 11:30:22
"i know how to detach and attach db's but the tempdb is a system file and therefore wont let you"

I don't see anything in the article I pointed to about detach and attach for tempdb ...

Kristen
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-12-04 : 11:35:54
No..........you need to ALTER the database, change the location to a different drive, stop and restart, then delete the old files

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -