Oracle and PowerShell - Connection String with SYSDBA

  • From: "Hoff, Brad" <BHoff@xxxxxxxx>
  • To: "oracle-l@xxxxxxxxxxxxx" <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 10 Feb 2011 17:59:04 -0600

I am trying to write a powershell script to get some information from one of my 
Oracle instances on a regular basis.  The script works great when I run it with 
low privilege, but I am trying to figure out how to run the script as SYSDBA.

When I use a connection string like the one shown on this website: 
http://www.connectionstrings.com/oracle
Data Source=urOracle;User Id=urUsername;Password=urPassword;DBA 
Privilege=SYSDBA;
I get the following error in PowerShell:
$connectionString = "Data Source=MYDB;User Id=sys;Password=xyz;DBA 
Privilege=SYSDBA;"
[System.Reflection.Assembly]::LoadWithPartialName("System.Data.OracleClient")
$connection = New-Object 
System.Data.OracleClient.OracleConnection($connectionString)
New-Object : Exception calling ".ctor" with "1" argument(s): "Keyword not 
supported: 'dba privilege'."

What is the correct syntax for elevated privileges in Oracle through PowerShell?


Thanks,
Brad Hoff
Lead Database Administrator
Microsoft SQL and Oracle
Tenaska Power Services

Other related posts:

  • » Oracle and PowerShell - Connection String with SYSDBA - Hoff, Brad