This is how tempdb looked like:
TempDB:
data: 12,393 MB;By 500 MB, Unlimited;G:\tempdb
data: 12,370 MB;By 500 MB, Unlimited;G:\tempdb
data: 11,731 MB;By 500 MB, Unlimited;G:\tempdb
data: 5,620 MB;By 500 MB, Unlimited;G:\tempdb
log: 7,240 MB;By 500 MB, Unlimited;G:\tempdb
then run below statement( the StmNote is 150GB size and 100GB data)
CREATE CLUSTERED INDEX [NR_RC__ST_ParentID] ON [StmNote] (ST_ParentID)
got below error:
Could not allocate space for object 'dbo.SORT temporary run storage: 141040196714496' in database 'ProdDB' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files
to the filegroup, or setting autogrowth on for existing files in the filegroup.
The statement has been terminated.
Then I increased the number of files like below and got same error
TempDB:
data: 20,393 MB; By 500 MB, Unlimited; G:\tempdb
data: 20,393 MB; By 500 MB, Unlimited; G:\tempdb
data: 20,393 MB; By 500 MB, Unlimited; G:\tempdb
data: 20,393 MB; By 500 MB, Unlimited; G:\tempdb
data: 20,393 MB; By 500 MB, Unlimited; G:\tempdb
data: 20,393 MB; By 500 MB, Unlimited; G:\tempdb
data: 20,393 MB; By 500 MB, Unlimited; G:\tempdb
data: 20,393 MB; By 500 MB, Unlimited; G:\tempdb
log : 7,240 MB; By 500 MB, Unlimited; G:\tempdb
then I move the temp db files to another drive F: which the main database locates
TempDB:
data: 16,384 MB;By 1,024 MB,Unlimited;F:\MSSQL12\Data_TempDB
data: 15,360 MB;By 1,024 MB,Unlimited;F:\MSSQL12\Data_TempDB
data: 15,360 MB;By 1,024 MB,Unlimited;F:\MSSQL12\Data_TempDB
data: 15,360 MB;By 1,024 MB,Unlimited;F:\MSSQL12\Data_TempDB
data: 15,360 MB;By 1,024 MB,Unlimited;F:\MSSQL12\Data_TempDB
data: 16,384 MB;By 1,024 MB,Unlimited;F:\MSSQL12\Data_TempDB
data: 16,384 MB;By 1,024 MB,Unlimited;F:\MSSQL12\Data_TempDB
data: 16,384 MB;By 1,024 MB,Unlimited;F:\MSSQL12\Data_TempDB
log: 4,096 MB;By 500 MB,Unlimited;L:\MSSQL12\Log_TempDB
And it is successful!
Does anyone have any idea why?