Well, that's not a straightforward task. I don't speak C# so I'll comment only Oracle side of story.
New users are created by another, privileged user (i.e. the one that is granted CREATE USER privilege) - not every user is capable of doing it. For example, SYS is, but SYS is special and you shouldn't use it at all, but create another user and grant it privileges required to perform such actions (one option is to grant it DBA role).
Now, connected as that privileged user, you'd run a CREATE USER command which looks like this:
create user oliur --> this is username
identified by oliur_pw --> this is password
default tablespace users
temporary tablespace temp
profile default
quota unlimited on users;
List of available tablespaces is
select tablespace_name from dba_tablespaces;
Once you do that, you should grant some initial privileges to newly created user. Otherwise, he won't be able to do anything, not even connect to the database. That would be CREATE SESSION privilege. Some other privileges:
grant create session to oliur;
grant create table to oliur;
grant create procedure to oliur;
...
Perhaps you could create a stored procedure, which resides in the privileged user's schema. You'd pass username (as a parameter), and it would create user with that name. As of the password, you can set it to be the same as username, something constant, encrypted, etc. - it's up to you.
Note that such a procedure has to utilize dynamic SQL (EXECUTE IMMEDIATE) because otherwise you can't perform DDL from a procedure.
This is how it might look like:
create or replace procedure p_create_user (par_username in varchar2) is
begin
execute immediate ('create user ' || par_username ||
' identified by ' || par_username ||
' default tablespace user_data ' ||
' temporary tablespace temp' ||
' profile default' ||
' quota unlimited on user_data');
execute immediate ('grant create session to ' || par_username);
end;
/
In Oracle, call it like this:
begin
p_create_user('oliur');
end;
/
PL/SQL procedure successfully completed.
OK, let's connect as oliur:
SQL> connect oliur/oliur@kc11g
Connected.
Cool, success! Can we do something else?
SQL> create table test (id number);
create table test (id number)
*
ERROR at line 1:
ORA-01031: insufficient privileges
Nope, missing privileges to do that.
Now, as of C# part of the story, you just have to figure out how to call an Oracle procedure, but I hope that this is way simpler task than the above.