Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 550
  • Last Modified:

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());
                  }
            }
      }
}
0
Stella Pauley
Asked:
Stella Pauley
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
You could try something like:

   OracleCommand comm = new OracleCommand("CONNECT user/password AS sysdba; shutdown immediate;");

This is how you would do it through iSQLPlus, not sure if it will work through a command object though.
0
 
Stella PauleyAuthor Commented:
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
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now