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(ConnectSt ring);
OracleCommand comm = new OracleCommand("shutdown immediate",conn);
conn.Open();
comm.ExecuteNonQuery();
conn.Close();
}
catch (Exception e)
{
Console.WriteLine("Error:" );
Console.WriteLine(e.ToStri ng());
}
}
}
}
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(ConnectSt
OracleCommand comm = new OracleCommand("shutdown immediate",conn);
conn.Open();
comm.ExecuteNonQuery();
conn.Close();
}
catch (Exception e)
{
Console.WriteLine("Error:"
Console.WriteLine(e.ToStri
}
}
}
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
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