Reputation: 1
I am trying to create a role in an Oracle 11g database using the SQL Command Line, but I am receiving errors related to insufficient privileges. Specifically, I am trying to grant the "CREATE ANY ROLE" privilege to the user account, but I am receiving an "ORA-00911: invalid character" error.
Steps taken:
Potential solutions by CHAT GPT but I am beginner so that did not helped me out:
just want to give permissions to the my oracle 11g database 21F_9208 so that I can execute this statement to complete my assignment: GRANT SELECT, INSERT, UPDATE, DELETE ON admin TO superadmin;
This is role which need to be given permission to do the following things on the admin table
Upvotes: 0
Views: 256
Reputation: 143003
Only privileged users (such as SYS
, unless you created your own) can create new users.
It means that SYS
first has to
grant create role to "21F_9208";
(by the way, that's poorly chosen username; why did you set it that way? Now you have to qualify it using double quotes every time, as its name starts with a number. That is reason for error you got: "ORA-00911: invalid character
").
That user ("21F_9208"
) - apparently - owns table named admin
because you want to grant DML privileges (select, insert, ...) on it to newly created role, superadmin
.
Here's a walkthrough.
Creating new user:
SQL> show user
USER is "SYS"
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
SQL> create user "21F_9208" identified by demo
2 default tablespace users
3 quota unlimited on users
4 temporary tablespace temp;
User created.
Granting basic privileges (just to make this example work):
SQL> grant create session, create table, create role to "21F_9208";
Grant succeeded.
Connect as newly create user:
SQL> connect "21F_9208"/demo@pdb1
Connected.
Create table:
SQL> create table admin (id number);
Table created.
Create role:
SQL> create role superadmin;
Role created.
Grant privileges to role:
SQL> grant select, insert, update, delete on admin to superadmin;
Grant succeeded.
SQL>
Upvotes: 2