Link to home
Create AccountLog in
Avatar of Stella Pauley
Stella Pauley

asked on

Need to add sysdba specifier to Oracle connection

Hello, I need to log on as a sysdba to execute the  "shutdown immediate" command.

Here is what I have thus far:

using System;
      using System.Data.OracleClient;
 
      public class OkShutdown
      {
            public OkShutdown()
            {
            }
   
            static string ConnectString = "";
            public static void Main(string[] parms)
            {
                  try
                  {
                        ConnectString = "Server=DBserver;User ID=" + parms[0] + ";Password=" + parms[1] + ";Integrated Security=no;";
                        OracleConnection conn = new OracleConnection(ConnectString);
                        OracleCommand comm = new OracleCommand("shutdown immediate",conn);
                        conn.Open();
                        comm.ExecuteNonQuery();
                        conn.Close();
                  }
                  catch (Exception e)
                  {
                        Console.WriteLine("Error:");
                        Console.WriteLine(e.ToString());
                  }
            }
      }
}
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Stella Pauley
Stella Pauley

ASKER

I will try this instead:

ConnectString = "Server=DBServer;User ID=SYS; Password=password;DBA Privelege=SYSDBA; Integrated Security=no;";

I am not sure how to configure the connect string in the scenario you provided.


Thanks