Page 1 of 1

Import data, performance

Posted: Wed 25 Nov 2015 12:46
by kamen
Hello.

We use for import of data array binding. Is there any faster method?

Simplified code - only one column:

Code: Select all

void Import(IDbConnection connection, object[] data)
{
  OracleParameter parameter = new OracleParameter();
  parameter.Value = data;
  parameter.ArrayLength = data.Length;
  string commandText = "INSERT INTO TBL (COL) VALUES (:BIND0)";
  using (IDbCommand command = connection.CreateCommand())
  {
    command.CommandText = commandText;
    command.Parameters.Add(parameter);
    command.ExecuteArray(data.Length);
  }
}
Regards,
Petr.

Re: Import data, performance

Posted: Wed 25 Nov 2015 15:43
by Shalex
The fastest way to load data into Oracle is usage of the OracleLoader class: https://www.devart.com/dotconnect/oracl ... oader.html.

Re: Import data, performance

Posted: Thu 26 Nov 2015 13:40
by kamen
And what about case, when table TBL has a trigger defined on it? I received error: ORA-26086: direct path does not support triggers.

Documentation states, that OracleLoader doesn't support triggers. Then only DML arrays can be used. Right?

Re: Import data, performance

Posted: Fri 27 Nov 2015 14:28
by Pinturiccio
Yes, triggers are not supported in OracleLoader when direct path loading is used. As you supposed, you need to use DML Arrays in your case. For more information, please refer to https://www.devart.com/dotconnect/oracl ... yBind.html

You can also execute the following command:

Code: Select all

ALTER TABLE TableName DISABLE ALL TRIGGERS;
then use OracleLoader with direct path and after this execute the following command:

Code: Select all

ALTER TABLE TableName ENABLE ALL TRIGGERS;