我正在尝试通过 Oracle ODP.NET(版本 5 (11.2.0.3.20))使用 OracleBulkCopy 将 .NET 数据库传递到 Oracle:
// Copy table to Oracle
OracleBulkCopy bulkCopy = new OracleBulkCopy(cmdOra.Connection);
bulkCopy.DestinationTableName = "INBOUND_JOB_TMP";
bulkCopy.BatchSize = 10000;
bulkCopy.BulkCopyTimeout = 300;
bulkCopy.WriteToServer(dtJobs);
bulkCopy.Dispose();
bulkCopy = null;
这些作业是从 SQL Server 数据库中检索的:
SqlDataReader reader;
cmdSql.CommandTimeout = 120;
cmdSql.CommandType = CommandType.StoredProcedure;
cmdSql.CommandText = "DOWNLOAD_JOBS";
cmdSql.Parameters.Clear();
reader = cmdSql.ExecuteReader();
// Retrieve Job records
dtJobs = new DataTable();
if (reader.HasRows)
{
dtJobs.Load(reader);
}
else
Trace.WriteLine("No rows returned.");
传递的字段之一是签名字段:
SQL Server:
CREATE TABLE [dbo].[JOBS_DOWNLOAD](
[UniqueId] [int] IDENTITY(1,1) NOT NULL,
[MobileJobNo] [varchar](20) NOT NULL,
[MobileJobStatus] [varchar](1) NULL,
[TenantSignatureImage] [varbinary](max) NULL,
PRIMARY KEY CLUSTERED
(
[UniqueId] ASC
)
Oracle:
CREATE TABLE "DBA"."INBOUND_JOB_TMP"
("UNIQUE_ID" NUMBER(20,0),
"MOBILE_JOB_NO" VARCHAR2(20) NOT NULL ENABLE,
"TENANT_SIGNATURE" BLOB) ;
现在,当我运行此代码将数据行从 Sql Server 复制到 Oracle 时,它工作正常。签名图像被复制。
但是,如果签名图像的大小大于 4K 左右,我会收到以下错误消息:
Oracle.DataAccess.Client.OracleException was unhandled by user code
HResult=-2147467259
Message=Error in row '1' column '1'
ORA-39776: fatal Direct Path API error loading table DBA.INBOUND_JOB_TMP
ORA-00600: internal error code, arguments: [25029], [2147483647], [], [], [], [], [], [], [], [], [], []
Source=Oracle Data Provider for .NET
ErrorCode=-2147467259
DataSource=""
Number=-2754
Procedure=""
StackTrace:
at Oracle.DataAccess.Client.OracleBulkCopy.PerformBulkCopy()
at Oracle.DataAccess.Client.OracleBulkCopy.WriteDataSourceToServer()
at Oracle.DataAccess.Client.OracleBulkCopy.WriteToServer(DataTable table, DataRowState rowState)
at Oracle.DataAccess.Client.OracleBulkCopy.WriteToServer(DataTable table)
at JobDataSync.SyncTables.Jobs.PostJobs() in C:\Development\JobSyncService\JobDataSync\SyncTables\Jobs.cs:line 114
at JobDataSync.SyncTables.Jobs.Sync() in C:\Development\JobSyncService\JobDataSync\SyncTables\Jobs.cs:line 42
at JobDataSync.TransactionalDataSync.SyncData() in C:\Development\JobSyncService\JobDataSync\TransactionalDataSync.cs:line 73
at JobDataSyncConsole.DebugConsole.syncTimer_Elapsed(Object sender, ElapsedEventArgs e) in C:\Development\JobSyncService\JobDataSync\Console\DebugConsole.cs:line 74
at System.Timers.Timer.MyTimerCallback(Object state)
InnerException:
如果我回写到 SQL Server 表,则不存在此问题。
有什么想法有什么问题吗?
谢谢。