February 7, 2011 at 5:21 am
Hi Masters
I am getting headache with this issue ; I have a job which ran over night and in the process it runs the procedure below. Last night it failed with the message "Could not allocate a new page for database 'TEMPDB' because of insufficient disk space in filegroup 'DEFAULT'. I have tried all different options to bcp and otherways but still unable to get over. Any help will be much appericiated. TempDB fills up all my disk space but that was not the case till yesterday.
Script ran as below
SET @fields1 = ''
SELECT @fields1 = @fields1 + 'CAST((CASE WHEN SUM(CAST(['+COLUMN_NAME+'] AS INT))>0 THEN 1 ELSE 0 END) AS TINYINT) AS ['+COLUMN_NAME+'],'
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME = 'EventCodes'
AND COLUMN_NAME NOT IN ('UNIQUE_ID', 'DataSource_ID', 'CH', 'CodeType', 'Code', 'CodeValue', 'CleanValue', 'MeasureDate', 'Gcenie_Status', 'Gcenie_Time', 'SPID', 'EvalValue')
ORDER BY COLUMN_NAME
set @fields1 = SUBSTRING(@fields1,1,LEN(@fields1)-1)
-- new code - did work except for some shared DB sites
set @mysql = 'SELECT DataSource_ID, CH , ' + @fields1 + '
INTO EventCodesCriteria
FROM EventCodes
GROUP BY DataSource_ID, CH'
Thanks much
February 7, 2011 at 6:35 am
When tempdb runs out of disk space, you have to discover what filled the disk:
1) Tempdb itself. It could have been filled by temporary tables or internal objects.
2) Some other database. You get the message on tempdb, but the disk could have run out of space beacause of another database.
3) Some other process (other from SQL Server). Quite unlikely if your server stores SQL Server data only. I would check anyway.
If tempdb grows enormously and you're not using temporary tables, some query is probably allocating internal objects for hashes, spools and the like. If this is the case, you can use this query to identify the offending query (while it is running).
http://www.sqlservercentral.com/scripts/tempdb/72007/
Hope this helps.
Gianluca
-- Gianluca Sartori
February 7, 2011 at 9:32 am
Thanks Gianluca
Ran your query along with the script and
its coming back as
Internal object MB Space=43374.125000
Internal Object dealloc MB Space=0.437500
Any advice.
Thanks Again
February 7, 2011 at 9:47 am
Ok, so looks like you filled your tempdb with internal objects.
Can you post the execution plan? It should be included in the query I suggested.
-- Gianluca Sartori
February 7, 2011 at 9:50 am
wouldn't this occur if the indexes were being rebuilt with the option SORT_IN_TEMPDB?
Lowell
February 7, 2011 at 9:59 am
Lowell (2/7/2011)
wouldn't this occur if the indexes were being rebuilt with the option SORT_IN_TEMPDB?
Then you would see 'ALTER INDEX ...' as command in the tempdb usage query.
-- Gianluca Sartori
February 7, 2011 at 10:04 am
Thanks Lowell
but I am doing it as below
WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [INDEXES]
ImI
February 7, 2011 at 4:25 pm
imlive (2/7/2011)
Hi MastersI am getting headache with this issue ; I have a job which ran over night and in the process it runs the procedure below. Last night it failed with the message "Could not allocate a new page for database 'TEMPDB' because of insufficient disk space in filegroup 'DEFAULT'. I have tried all different options to bcp and otherways but still unable to get over. Any help will be much appericiated. TempDB fills up all my disk space but that was not the case till yesterday.
Script ran as below
SET @fields1 = ''
SELECT @fields1 = @fields1 + 'CAST((CASE WHEN SUM(CAST(['+COLUMN_NAME+'] AS INT))>0 THEN 1 ELSE 0 END) AS TINYINT) AS ['+COLUMN_NAME+'],'
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME = 'EventCodes'
AND COLUMN_NAME NOT IN ('UNIQUE_ID', 'DataSource_ID', 'CH', 'CodeType', 'Code', 'CodeValue', 'CleanValue', 'MeasureDate', 'Gcenie_Status', 'Gcenie_Time', 'SPID', 'EvalValue')
ORDER BY COLUMN_NAME
set @fields1 = SUBSTRING(@fields1,1,LEN(@fields1)-1)
-- new code - did work except for some shared DB sites
set @mysql = 'SELECT DataSource_ID, CH , ' + @fields1 + '
INTO EventCodesCriteria
FROM EventCodes
GROUP BY DataSource_ID, CH'
Thanks much
Where is the rest of the code? All I see here is something to build the select-list. What we need to see ins the FROM/ON/ and WHERE clauses.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 10, 2011 at 10:26 am
Thanks for you advice.
It's resolved now. I have to re-ran the process. It was the indexes which were causing the problem so I have to drop the indexes and resolved the issue .
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply