![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I keep getting the following error message when I run a serie of SQL commands: Server: Msg 9002, Level 17, State 6, Line 15 The log file for database 'tempdb' is full. Back up the transaction log for the database to free up some log space. I have tried "dump transaction tempdb with no_log" right before I run the SQL command. But that doesn't help. |
#3
| |||
| |||
|
|
One thing to check is the Collation of the tables involved. |
|
We had this problem occur on one of our systems and until we rebuilt the database with the right collation we'd have the same problem. |
|
Essentially I think what was happening in our case was the ENTIRE source tables would be copied into the tempdb and then "converted" to a matching collation, and then the join performed. (Since you can't do an accurate join on a mismatched collation since you have to determine for example if 'Joe' matches 'JOE'. Depending on the collation that may or may not match.) |
#4
| |||
| |||
|
|
One thing to check is the Collation of the tables involved. I will look into this. We had this problem occur on one of our systems and until we rebuilt the database with the right collation we'd have the same problem. How do you get the right collation when you rebuild your database? |
|
Essentially I think what was happening in our case was the ENTIRE source tables would be copied into the tempdb and then "converted" to a matching collation, and then the join performed. (Since you can't do an accurate join on a mismatched collation since you have to determine for example if 'Joe' matches 'JOE'. Depending on the collation that may or may not match.) If this is the case, I may need to change the query to reduce the number of intermediate temporary tables that the query generates. This is very strange because the same SQL statement worked fine before I move the database to the new server. I will see how this goes. |
|
Thanks. Jay Chan |
#5
| |||
| |||
|
|
The new server was probably installed with a different default collation. This is what bit us. |
#6
| |||
| |||
|
|
How do you get the right collation when you rebuild your database? Look up the syntax for CREATE DATABASE. |
|
Essentially I think what was happening in our case was the ENTIRE source tables would be copied into the tempdb and then "converted" to a matching collation, and then the join performed. (Since you can't do an accurate join on a mismatched collation since you have to determine for example if 'Joe' matches 'JOE'. Depending on the collation that may or may not match.) |
#7
| |||
| |||
|
|
Finally, we have fixed the problem after we have contacted Microsoft Tech Support. We need to auto-grow the transaction-log of tempdb by "10MB" instead of by "10%". If I understand this correctly, the transaction log of tempdb was initially set to 1MB (somehow I cannot change it through Enterprise Manager if I set it to grow by 10%), it would grow to only 1.1MB after it had grown by 10%. If the transaction log caused by the INSERT statement is over 1.1MB, the database server will give out that "Log file is full" message. Growing it by 10MB fixes the problem. Before I changed it to grow by 10MB, I could not change the initial size of the transaction log file of tempdb. It got stuck at 1MB. Strangely, after I changed it to grow by 10MB, I can change the initial size. |
#8
| |||
| |||
|
|
Jay Chan (jaykchan (AT) hotmail (DOT) com) writes: Moreover, according to the tech support, that "Log file is full" message is not an error message; that is just a warning message. I could have changed my script to ignore that warning message, and I would still be fine. I don't know if this is really true or not. But I will not risk this. Warning message? It has severity 17, so that is not a warning. Then again, SQL Server and error handling. |
|
In any case, I'm glad to hear that your case was resolved, and it was interesting to learn how it was resolved. -- Erland Sommarskog, SQL Server MVP, sommar (AT) algonet (DOT) se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |
#9
| |||
| |||
|
|
I believe the order of events is a log file is full, which generates the error and THEN an expansion of the DB. Which means the next insert may be fine. |
#10
| |||
| |||
|
|
When I read this I thought I maybe had learnt something new. Or maybe there was some misunderstanding on the way. In any case, I ran this on my server at home: select a.*, c.* into #explosion from Northwind..Orders a, Northwind..Orders b, pubs..authors c where 1 = 0 go exec sp_helpdb tempdb go insert #explosion select a.*, c.* from Northwind..Orders a, Northwind..Orders b, pubs..authors c go The initial size of tempdb was 25 MB, with 5120 KB for the log. When I killed the process from another window, the log for tempdb had grown to over 1 GB, so apparently the log can grow more than once during a statement. |
|
My guess why growing 10 MB at a time worked, is that even if you started with a small log, you eventually come to the situation when 10% was more than the remaining free space on the disk. By growing 10 MB at a time, you will not run out of disk, until you run out of disk if you understand what I mean. |
![]() |
| Thread Tools | |
| Display Modes | |
| |