Home > database >  Create a new user in Oracle DBMS with all the privileges
Create a new user in Oracle DBMS with all the privileges

Time:11-24

Is there is a command to give a user in Oracle DB 21c XE the same privileges as the sysdba or to create a new one with this privileges .

I looked online and fond this command

GRANT CREATE SESSION GRANT ANY PRIVILEGE TO aarab;

but i think it is not correct because oracle give me this error :

SQL> GRANT CREATE SESSION GRANT ANY PRIVILEGE TO aarab;
GRANT CREATE SESSION GRANT ANY PRIVILEGE TO aarab
      *
ERROR at line 1:
ORA-00990: missing or invalid privilege

NB : I created this new user using this tow commands :

alter session set "_ORACLE_SCRIPT"=true;

create user aarab identified by <>;

CodePudding user response:

If you want a new sysdba user in all the containers I believe this will work. (I don't work with containers in my job.)

[oracle@orcl21 ~]$ sqlplus / as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Nov 18 15:55:11 2022
Version 21.8.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1811939248 bytes
Fixed Size                  9686960 bytes
Variable Size             771751936 bytes
Database Buffers         1023410176 bytes
Redo Buffers                7090176 bytes
Database mounted.
Database opened.

SQL> create user c##newsysdba identified by newsysdba;

User created.

SQL> grant create session to c##newsysdba;

Grant succeeded.
   
SQL> grant sysdba to c##newsysdba container=all;

Grant succeeded.

SQL> exit
Disconnected from Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.8.0.0.0
[oracle@orcl21 ~]$ sqlplus c##newsysdba/newsysdba as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Nov 18 16:01:14 2022
Version 21.8.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.8.0.0.0

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

Hopefully this will work in 21c XE.

Bobby

  • Related