?
Solved

The log file for database 'tempdb' is full. Back up the transaction log for the database to free up some log space

Posted on 2014-04-14
3
Medium Priority
?
4,488 Views
Last Modified: 2014-04-16
Can somebody give me a SP I can run weekly to get rid of this
thx

The log file for database 'tempdb' is full. Back up the transaction log for the database to free up some log space
0
Comment
Question by:JElster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 35

Expert Comment

by:Bembi
ID: 40000183
The tempDb is freed up when the server restarts. But if used in a too heavy way there are two solutions. Either to enlarge the size of tempDB or to work with several tempDBs (with the same size). Applications should freeup the tempDB themselves, but it depends what happens on the machine. Some large and heavy queries can force the tempDB to take a lot of space.

The other option is to - as stated - to backup the tempDB logs regularly, what frees up the logs. So if you have a backup software in place you may shorten the intervals for the tempDB. But this makes only sense, if the applications is not overruning it by its queries.
0
 
LVL 1

Author Comment

by:JElster
ID: 40000190
How do I enlarge it?
0
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 2000 total points
ID: 40000314
You can't back up tempdb, or its log file.  (And you can't have "several tempdbs"; you can, and should, have multiple tempdb data files, but never multiple log files, on any db (except in an emergency).)

You increase the log size with this command:

ALTER DATABASE tempdb
MODIFY FILE ( NAME = templog, SIZE = nnMB, FILEGROWTH = nnMB )

For example, if you want to go to 12GB, this would be the command:

ALTER DATABASE tempdb
MODIFY FILE ( NAME = templog, SIZE = 12000MB, FILEGROWTH = 100MB )


For performance reasons, you should check to see how many VLFs you have on tempdb.  If it's greater than ~200, you should recycle SQL when you can to reset the VLFs.

Or you can shrink the log file to a minimum size and then re-grow it without a recycle, but there is a tiny chance that could cause issues and force you to recycle SQL anyway.


If you don't have room on disk to grow tempdb log file, you have an emergency and could add a second log file for tempdb for SQL to use, then remove that log file later.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

752 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