How do i produce a oracle database programmatically in ADO.Internet along with a schema for this with userId + password in order to go to my non-favorite tool the sql oracle developer tool where I simply produce a connection entering:

  • connectionstring title
  • UserId(schema)
  • password

I have tried it with SQL before but never attempted with ADO.Internet ...

string connectionString = "...";
string oracleDataPath = "C:\\PATH_TO_ORADATA\\";

string username = "NEW_USER";
string password = "NEW_PWD";
string schema = "NEW_SCHEMA";

using (OracleConnection conn = new OracleConnection(connectionString))
{
    conn.Open();
    OracleCommand cmd = conn.CreateCommand();
    cmd.CommandText = "CREATE TABLESPACE \"" + schema + "\" DATAFILE '" + oracleDataPath + schema + ".DBF' SIZE 10M AUTOEXTEND ON NEXT 1M";
    cmd.ExecuteNonQuery();
    cmd.CommandText = "CREATE USER \"" + username + "\" IDENTIFIED BY \"" + password + "\" DEFAULT TABLESPACE \"" + schema + "\" TEMPORARY TABLESPACE TEMP";
    cmd.ExecuteNonQuery();
    cmd.CommandText = "GRANT CONNECT TO \"" + username + "\"";
    cmd.ExecuteNonQuery();
    cmd.CommandText = "ALTER USER \"" + username + "\" QUOTA UNLIMITED ON \"" + schema + "\"";
    cmd.ExecuteNonQuery();
}

Make use of the ADMIN/DBA account around the connection string.
Set oracleDataPath using the path where your Oracle keeps its documents.

Tell me whether it works :-)