如何增加 bcp 批处理负载?

How to increase bcp batch load?

有没有办法增加发送到 sql server/sec 的行数?

我有超过 700 万条记录(1.5 GB 文件),将所有记录从 bcp 文件导入 sql 服务器 table 大约需要 30 分钟。

有没有办法将其增加到每次发送 10k 甚至 100000 行? 我 运行 遇到了 bcp 的一些问题,直到我最终解决了它们,但每次我不得不调试这些问题时,我都不得不等待半小时,这令人沮丧。此外,我们可能需要一遍又一遍地加载,因此了解未来 bcp 加载的更快方法会很有帮助。

这里有一些统计数据:

7217765 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total     : 1765235 Average : (4088.84 rows per sec.)

bcp文件在网络驱动器上,table DDL如下:

CREATE TABLE [dbo].[Historical_Fact](
    [Style Code] [varchar](100) NULL,
    [Trim Code] [varchar](100) NULL,
    [Country] [varchar](100) NULL,
    [Org] [varchar](100) NULL,
    [Prod Code] [varchar](100) NULL,
    [Report Year] [varchar](100) NULL,
    [Scen] [varchar](100) NULL,
    [Volume] [decimal](25, 10) NULL,
    [EBIT] [decimal](25, 10) NULL,
    [NSR] [decimal](25, 10) NULL,
    [Measures] [varchar](100) NULL,
    [Values] [decimal](25, 10) NULL
) ON [PRIMARY]

来自docs

-b batch_size

Specifies the number of rows per batch of imported data. Each batch is imported and logged as a separate transaction that imports the whole batch before being committed. By default, all the rows in the data file are imported as one batch. To distribute the rows among multiple batches, specify a batch_size that is smaller than the number of rows in the data file. If the transaction for any batch fails, only insertions from the current batch are rolled back. Batches already imported by committed transactions are unaffected by a later failure.