我正在尝试创建一个副本数据库。请参阅以下查询:
SELECT CaptureDate, GenieVRMs.VRM, Camera, ShortName, Latitude, Longitude, ImageBlob, WeedDate, OverviewWeedDate, LastUpdated
FROM (select * from openquery (bof2, 'SELECT CaptureDate, Bof2PlateImage.VRM, Camera, ShortName, Latitude, Longitude, Bof2PlateImage.WeedDate, ''1900-01-01'' AS OverviewWeedDate,
''1900-01-01'' LastUpdated FROM bof2.Bof2PlateImage inner join BOF2.CAMERA on BOF2.Bof2PlateImage.CAMERA = BOF2.CAMERA.URN where rownum<1000000')) As BOF INNER JOIN GenieVRMs
ON BOF.VRM=GenieVRMs.VRM
有70451258行。我使用SSIS传输了1,000,000条记录,即上面是OLEDB源命令(Oracle数据库),目标是SQL数据库。我已经知道转移60,000,000行需要大约两个月的时间。我尝试了以下TSQL查询:
select * into CopyDatabase(
SELECT CaptureDate, GenieVRMs.VRM, Camera, ShortName, Latitude, Longitude, ImageBlob, WeedDate, OverviewWeedDate, LastUpdated
FROM (select * from openquery (bof2, 'SELECT CaptureDate, Bof2PlateImage.VRM, Camera, ShortName, Latitude, Longitude, ImageBlob, Bof2PlateImage.WeedDate, ''1900-01-01'' AS OverviewWeedDate,
''1900-01-01'' LastUpdated FROM bof2.Bof2PlateImage inner join BOF2.CAMERA on BOF2.Bof2PlateImage.CAMERA = BOF2.CAMERA.URN where rownum<1000000')) As BOF INNER JOIN GenieVRMs
ON BOF.VRM=GenieVRMs.VRM
) as CopyDatabase
结果再次表明创建复制数据库需要两个月的时间。
我相信这是由于图像(ImageBlob)。有什么办法可以在数据传输时压缩图像吗?
答案 0 :(得分:0)
您需要尝试使用BULK操作
INSERT ... SELECT * FROM OPENROWSET(BULK...)
请参阅https://msdn.microsoft.com/en-us/library/ms175915.aspx
使用OPENROWSET批量行集提供程序(SQL Server)批量导入大对象数据: https://msdn.microsoft.com/en-us/library/ms176001.aspx
但我会按照步骤