Dropping large clustered primary key fills up tempdb
Assuming you have a maintenance window that allows for a short period of downtime I would suggest using BCP to dump the table to a file. If space is an issue, compress the target folder in advance of the export.
bcp.exe "Database.dbo.OurTable" OUT "C:\Temp\bcp\OurTable.dat" -S ServerName -T -c -r "|¬|\n" -t "|¬|" /b 10000
DROP
your old table, CREATE
new with BIGINT
key, then import the data.
BULK INSERT
dbo.OurTable
FROM 'C:\Temp\bcp\OurTable.dat'
WITH
(
FIELDTERMINATOR = '|¬|',
ROWTERMINATOR = '|¬|\n',
BATCHSIZE = 10000,
ERRORFILE = 'C:\Temp\bcp\OurTable_error.txt'
)
The odd looking choice of delimiter |¬| is a typically safe combination that avoids collisions in text fields. So far anyway.
As you mention in the comments you can minimise growth of the log by switching to bulk-recovery. Given that you will have no other activity during this maintenance window you could switch to simple, run the process, switch back to full and take a full backup instead. Note that use of BATCHSIZE
in the example will create a separate transaction for each batch.