oracleodp.net-managed

ora-01017 with ODP.net and NTS as sysdba


I'm having trouble connecting to my oracle databases with NTS and ODP as sysdba (the goal is to use a lot of maintenance scripts without any passwords in it). I did some research without success, so here I come.

Here is the powershell code I use :

$srvOra = "oracle_server"
$port = 1521
$serviceName = "serviceName"

Add-Type -Path "C:\some_rep\Oracle.ManagedDataAccess.dll"  #version 4.121.2.0

$connectionString = "User Id=/;DBA Privilege=SYSDBA;Data Source=" + "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)" + "(HOST=$srvOra)(PORT=$port))(CONNECT_DATA=" + "(SERVICE_NAME=$serviceName)))"
$connection = New-Object Oracle.ManagedDataAccess.Client.OracleConnection($connectionString)
$connection.open()

And here are my results :

Facts :

Any help will be appreciated. Thanks for your time :)


Solution

  • I found the solution.

    The Oracle.ManagedDataAccess.dll version I had load was incorrect. So I copied correct version of dll from one of my oracle servers and It worked fine, as expected.