SQL Bulk Copy Timeout

Eddie Piater 1 Reputation point
2021-07-22T14:05:03.65+00:00

Afternoon

I am trying to copy data from Oracle DB to SQL DB, I have setup the script to connect to Oracle and retrieve the data but when I use the bul copy command I keep on getting timeout error, done alot searching and tried few suggestion but not works, here is my code what did I do wrong.

Thanks

$sqlconn = "server='SPO2018';database=SPFSQLData;trusted_connection=true";
$sqlbc = new-object system.data.sqlclient.Sqlbulkcopy($sqlconn);
$scon = New-Object System.Data.SqlClient.SqlConnection($sqlconn);
$sqlbc.DestinationTableName="dbo.SCHEMAOBJPR";
$cmd.Connection = $scon;
$cmd.CommandTimeout = 0;
$sqlbc.WriteToServer($dtbl);

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,812 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Seeya Xi-MSFT 16,471 Reputation points
    2021-07-23T03:22:06.977+00:00

    Hi @Eddie Piater ,

    You can refer to the PowerShell script in this link.
    If it doesn't work, please try this way: https://learn.microsoft.com/en-us/sql/ssma/oracle/migrating-oracle-data-into-sql-server-oracletosql?view=sql-server-ver15

    Best regards,
    Seeya


    If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar queries.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.