SqlBulcopy WriteToServer method takes too long vb.net

0

When creating an object of the class sqlBulkCopy and sending the method writeToServer , passing it as parameter a OracleDataReader this delay more than 15 minutes, the number of rows that I want to copy are close to 140000, I have already checked the table to which I want to make the copy and does not have triggers , index , constraints .

Imports Oracle.ManagedDataAccess.Client
Dim odbReader As OracleDataReader = Nothing 
 odbReader = funOracle_ExecQuery_RDR(lConnOra, strQuery, False, "", strMsgErr)

try
{
bulkCopy.BatchSize = 32768 
bulkCopy.BulkCopyTimeout = 0
bulkCopy.NotifyAfter = 16384
bulkCopy.WriteToServer(odbReader)
}catch(Exception e)
{
 Console.WriteLine(ex.Message)
}
    
asked by kanon488 26.10.2017 в 01:36
source

1 answer

-1

USE IT SO ... KeepIdentity

SqlBulkCopyOptions.KeepIdentity

using (SqlBulkCopy sbc = new SqlBulkCopy(this.GetConnectionString(), SqlBulkCopyOptions.KeepIdentity))
{
sbc.BatchSize = 10000;
sbc.ColumnMappings.Add("COL1", "TO_COL1");
sbc.ColumnMappings.Add("COL2", "TO_COL2");
sbc.ColumnMappings.Add("COL_N", "TO_COLN");
// Finally write to server
sbc.WriteToServer(dt);
sbc.Close();
}

Greetings.

    
answered by 10.08.2018 в 17:18