Hello,
I wrote the following Powershell Script (this is only part of it) to Update certain Rows in a table.
It seems that i cannot pass an array to the Oracle Command Execute Reader.
When im updating about 200.000 rows through single Queries and ExecuteReader() function in a loop, does Oracle commit at the end of the ExecuteReader() Method or when the connection is closed?
I guess when a commit is done after every executed Query the DB will have a hard time.
Anyone have a clue?
thx
# Load Oracle Assembly
$LoadOracle = [Reflection.Assembly]::LoadFile("C:\app\client\PR070921\product\12.1.0\client_1\odp.net\bin\2.x\Oracle.DataAccess.dll")
# Connect to Oracle
$SQLConnString = "User Id=$DBUsername;Password=$DBPassword;Data Source=$source"
$SQLConnection = New-Object Oracle.DataAccess.Client.OracleConnection($SQLConnString)
$SQLConnection.Open()
foreach ($line3 in $ImportInDB)
{
$SQLQuery = "update " + $DBTable + " set"
$SQLQuery += " BUKRS='" + $line3.BUKRS
$SQLQuery += "', KUNDE='Test"# + $line3.KUNDE
$SQLQuery += "' where NAME='" + $line3.NAME + "'"
# IMPORT TO DATABASE
try{
$SQLCommand = New-Object Oracle.DataAccess.Client.OracleCommand($SQLQuery,$SQLConnection)
$SQLReader = $SQLCommand.ExecuteReader()
}
catch{
write_log ($_)
}
}
$SQLConnection.Close()