SQL Server 2008: Bulk Insert taking forever

2019-08-28 01:45发布

I have a txt file(tab delimited) which has almost 1200 records. I m doing a bulk insert operation to get the data from .txt file to a table- which(structure) is already created in the database. I don't know why bulk insert is taking forever. Any suggestions on where/what/how to check what's causing this operation to take forever? Thanks. I did it before as well and it used to work fine. Any reasons?

BULK INSERT DataFromatltemp
 FROM '\\abcd\Admin\temp\Copyatltemp07.txt'
 WITH
 (
  FIELDTERMINATOR = '\t',
  ROWTERMINATOR = '\n'
 )
GO

1条回答
Summer. ? 凉城
2楼-- · 2019-08-28 02:27

As almost everything related to RDBMS and performance, it depends on a series of variables, but there are some hints you can look first:

  1. database: assure your database is using simple recovery mode;
  2. target table: clear all constraints (including checks, foreign keys);
  3. target table: drop all indexes;
  4. target table: assure is's not locked by any other process;
  5. source file: assure is's not locked by any other process;

I hope this hints can be helpful.

查看更多
登录 后发表回答