Bulk Copy Utility Errors

This section describes errors for the Bulk Copy Utility (bcp).




Error 4801

Severity

20

Message text

Bulk_main: opentable on BULK INSERT table failed. Dbid=%d name=’%.*s’.

Explanation

Error 4801 is raised when you attempt to bulk copy data into a table, but bcp is unable to locate the target table.

Possible causes include:

Action

  1. Check the syntax of your bcp in command and the target table named in the command.

  2. Check that the target table exists, and that no other user is attempting to bulk copy to the table.

  3. If you are making a substantial change, such as loading a large number of tables, you may need to increase the number of open objects configuration parameter. See the System Administration Guide for details.

Versions in which this error is raised

All versions




Error 4806

Severity

16

Message text

You cannot run the non-logged version of bulk copy in this database. Please check with the DBO.

Explanation

This error occurs when the select/into bulkcopy option is set to false and you use “fast” bulk copy into a table that has no indexes.

NoteBy default, the select into/bulkcopy option in newly created databases is set to the same as that in model.

Action

You have the following options for recovering from this error.


Turn On select into/bulkcopy (all versions)

Use the sp_dboption stored procedure to set the select into/ bulkcopy option to true:

1> sp_dboption database_name, 
2> "select into/bulkcopy", true
3> go

1> use database_name 
2> go

1> checkpoint
2> go

Once a minimally logged operation such as “fast” bulk copy runs in the database, you are not allowed to dump the transaction log to a device, because unlogged changes are not recoverable. Instead, you should do a dump database as soon as possible to restore recoverability and allow transaction dumps to devices again.


Create an Index for the Table

Put an index on the table you are trying to copy into. This causes inserts to be logged.

When you copy into a table that has indexes, a slower version of bcp is automatically used. The slow version, which does log data inserts in the transaction log, can cause the transaction log to become very large. You may need to use dump transaction with truncate_only until you can perform a full database dump. If you must do this, you will lose the ability to recover up-to-the-minute changes in data in case of a media failure. You may also consider using smaller bcp batch sizes.

Versions in which this error is raised

All versions