I try to create this procedure (as a system), which takes 2 parameters, username and password, and create a user according to them:
create or replace procedure procedure_create_client
( user_name IN varchar2 , u_password IN varchar2 ) IS
tmp_query varchar(150);
user_name_upper varchar(30) := UPPER(user_name) ;
BEGIN
tmp_query := 'create user C##' || user_name_upper || ' identified by ' || u_password ;
EXECUTE IMMEDIATE ( tmp_query );
tmp_query := 'grant create session to ' || user_name_upper ;
EXECUTE IMMEDIATE ( tmp_query );
END ;
The problem is, when I try to execute this procedure (as a system), I got this error:
Error report: ORA-01031: insufficient privileges ORA-06512: at "SYSTEM.PROCEDURE_CREATE_CLIENT", line 9 ORA-06512: at line 1 01031. 00000 - "insufficient privileges" *Cause: An attempt was made to change the current username or password without the appropriate privilege. This error also occurs if attempting to install a database without the necessary operating system privileges. When Trusted Oracle is configure in DBMS MAC, this error may occur if the user was granted the necessary privilege at a higher label than the current login. *Action: Ask the database administrator to perform the operation or grant the required privileges. For Trusted Oracle users getting this error although granted the the appropriate privilege at a higher label, ask the database administrator to regrant the privilege at the appropriate label.