Without Administrative privilege, how would you install ODP.NET?
Note 784309.1 describes the required files if you have no Oracle client
- download XCOPY ODAC from Oracle .NET, Visual Studio, and VS Code ODAC Downloads for Oracle Database
- Copy the files Oracle.DataAccess.dll OraOps.dll orannzsbb.dll oraociei.dll oci.dll to your directory (ex: C:\ODAC)
- Add that directory to your PATH
- Create your sqlnet.ora and tnsnames.ora or use ezconnect string host:1521/service.example.com
That’s it. It even works with kerberos
sqlnet.ora
sqlnet.kerberos5_conf=C:\ODAC\krb5.conf sqlnet.kerberos5_cc_name=OSMSFT:// sqlnet.authentication_services=kerberos5pre sqlnet.kerberos5_conf_mit=true NAMES.DIRECTORY_PATH = (TNSNAMES) NAMES.DEFAULT_DOMAIN = example.com
tnsnames.ora
DB01.example.com=(DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=srv1.example.com)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=DB01.example.com)))
krb5.conf
[libdefaults]
default_realm = EXAMPLE.COM
[realms]
EXAMPLE.COM = {
kdc = dc1.example.com
}
[domain_realm]
.example.com = EXAMPLE.COM
example.com = EXAMPLE.COM
let’s try
cd C:\ODAC
${ENV:PATH}="C:\ODAC"
${ENV:TNS_ADMIN}="C:\ODAC"
[Reflection.Assembly]::LoadFile('C:\ODAC\Oracle.DataAccess.dll')
$conn = New-Object Oracle.DataAccess.Client.OracleConnection(
'User Id=/;Data Source=DB01')
$conn.open();
$com=$conn.CreateCommand();
$com.CommandText='select * from dual';
$com.ExecuteScalar();
$conn.close();
$conn.dispose()
X
PS: kerberos5pre is deprecated but kerberos5 doesn’t work with credential guard, there are a few unpublished bugs (33825536 and others)