Forum Discussion

ValerieKam's avatar
ValerieKam
Copper Contributor
Oct 07, 2022

Azure Copydata Error

I am trying to copy a table from one database to another via a Copy Data activity. I keep getting an error around 500 000 rows in. This is always the same error. 

 

The whole table is about 1 500 000 rows. The write batch size is 10 000. I attempted reducing it to 4000 but this did not help either. If anyone can assist with what could be causing this error. Or advise any other way I could copy this data without using a Copy Data activity.

 

Error:

Failure happened on 'Source' side. 'Type=System.IO.IOException,Message=Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.,Source=System,''Type=System.Net.Sockets.SocketException,Message=An existing connection was forcibly closed by the remote host,Source=System,'

1 Reply

  • Try this as workarounds:

     

    1. Enable KeepAlive on Source Connection

    If you're using a self-hosted integration runtime or connecting to MySQL/PostgreSQL:

    • Add Keepalive=15 or similar to the connection string.
    • This keeps the TCP connection alive and avoids idle disconnects.
    1. Partition the Copy Activity

    Instead of copying all 1.5M rows at once:

    • Use a ForEach loop with SQL partitioning.
    • Partition by date, ID range, or another logical slice.
    • Example: Copy 100K rows per partition using a query like:
    SELECT * FROM table WHERE ID BETWEEN 1 AND 100000

     

    1. Set CommandTimeout in Linked Service

     

    "connectVia": {
      "referenceName": "YourIntegrationRuntime",
      "type": "IntegrationRuntimeReference"
    },
    "typeProperties": {
      "connectionString": "...",
      "CommandTimeout": "1800"
    }

    This sets the timeout to 30 minutes. Adjust as needed.

Resources