我一直在尝试使用以下代码将数据(80000行,105列)从Oracle复制到SQL Server:
OracleConnection oraCon = new OracleConnection(ORACLE_CONNECTION_STR);
oraCon.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = oraCon;
cmd.CommandText = packageName;
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter param1 = cmd.Parameters.Add(PARAM_YEAR_TERM, OracleDbType.Int32);
param1.Direction = ParameterDirection.Input;
param1.Value = yearTerm;
OracleParameter param2 = cmd.Parameters.Add(PARAM_RESULT, OracleDbType.RefCursor);
param2.Direction = ParameterDirection.Output;
OracleDataReader reader = cmd.ExecuteReader();
SqlConnection sqlCon = new SqlConnection(SQL_CONNECTION_STR);
sqlCon.Open();
SqlBulkCopy bulk = new SqlBulkCopy(sqlCon);
bulk.BulkCopyTimeout = 10000;
bulk.BatchSize = 5000;
bulk.DestinationTableName = string.Format("dbo.{0}", tableName);
bulk.WriteToServer(reader);
我更改了各种BatchSize
并尝试了但至少需要10分钟。你有什么想让它更快吗?