Search code examples
oracle-databaseodp.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 :

  • from multiple servers (2008r2, 2012r2, 2016 windows servers) with only the odp dll, I receive an ORA-01017 error : invalid username/password;
  • from multiple servers with oracle client installed, I receive the same error
  • from an oracle server to another oracle server, the connection is successful *_*

Facts :

  • oracle databases are 12.1.0.2.0 std, servers are 2012R2 and sqlnet.ora only contain the following lign :

    SQLNET.AUTHENTICATION_SERVICES = (NTS)

  • My account is member of ora_dba group on each database server.

  • Fips algorithm is disabled.

  • Connection from any computer with oracle components works with sqlplus /@some_entry as sysdba.

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.