none
Connect to Oracle as SYSDBA

    Question

  • ·         Hi,
    Does anyone know how to connect as SYSDBA via OracleConnection under .Net 3.5?

    Added System.Data.OracleClient as a project reference. 


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Data;
    using System.Data.OracleClient;
     
    string connectionStr = "user id=SYS;password=blablabla;Data source=TURTEST;";
     
    OracleConnection oraConn = new OracleConnection(connectionStr);
     
    oraConn.Open();




    This returns "ORA-28009: connection to sys should be as sysdba or sysoper" when trying to open the connection.
    Does anyone know how to connect as a priv'd user?

    Dave

    Monday, June 01, 2009 2:02 PM

Answers

  • You may only be able to do this with the Oracle's .NET provider. That provider does support a "DBA Privilege=SYSDBA" setting in your connection string.

    I don't believe that anything like this is available using the System.Data.OracleClient provider.
    • Marked as answer by Bin-ze Zhao Thursday, June 04, 2009 4:16 AM
    Tuesday, June 02, 2009 4:10 PM

All replies

  • You need a different connection string to be sent, in researching on the internet:

    username/password@instance as SYSDBA


    So try SYSDBA in the user.

    William Wegerson (www.OmegaCoder.Com)
    Monday, June 01, 2009 3:23 PM
    Moderator
  • Your example is a valid SQL Plus command but, as far as I can see, you can't specify the role (SYSDBA) from .Net.  

    SYSDBA and SYSOPER are roles not users so can't logon that way.  Even if you setup a user called SYSDBA you would still 
    need to identify the connection as a priv connection.  So in SQL Plus it would be conn sysdba/password as SYSDBA  


     
    Tuesday, June 02, 2009 7:52 AM
  • You may only be able to do this with the Oracle's .NET provider. That provider does support a "DBA Privilege=SYSDBA" setting in your connection string.

    I don't believe that anything like this is available using the System.Data.OracleClient provider.
    • Marked as answer by Bin-ze Zhao Thursday, June 04, 2009 4:16 AM
    Tuesday, June 02, 2009 4:10 PM