SoFunction
Updated on 2025-04-07

Oracle query method for users to have all system permissions

Oracle query method for users to have all system permissions

Updated: December 27, 2024 09:21:36 Author: Data Pi
This article mainly introduces that Oracle query users have all system permissions. This article introduces you very detailed through the example code. Interested friends can take a look.

Oracle query user has all system permissions

SQL> desc dba_sys_privs;   Query the system permissions owned by the object
 Name                                     Null?    Type
 ---------------------------------------- -------- ---------------------------
 GRANTEE                                  NOT NULL VARCHAR2(30)
 PRIVILEGE                                NOT NULL VARCHAR2(40)
 ADMIN_OPTION                                      VARCHAR2(3)
SQL> select * from dba_sys_privs where grantee='HR';
GRANTEE                        PRIVILEGE                                ADM
------------------------------ ---------------------------------------- ---
HR                             UNLIMITED TABLESPACE                     NO
HR                             CREATE SESSION                           NO
HR                             CREATE TABLE                             NO
SQL> desc dba_role_privs;
 Name                                     Null?    Type
 ---------------------------------------- -------- ---------------------------
 USERNAME                                          VARCHAR2(30)
 GRANTED_ROLE                                      VARCHAR2(30)
 ADMIN_OPTION                                      VARCHAR2(3)
 DEFAULT_ROLE                                      VARCHAR2(3)
 OS_GRANTED                                        VARCHAR2(3)
SQL> select * from dba_role_privs where grantee='HR';The role owned by the object
GRANTEE                        GRANTED_ROLE                   ADM DEF
------------------------------ ------------------------------ --- ---
HR                             RESOURCE                       NO  YES
SQL> select * from role_sys_privs where ROLE='RESOURCE';  Find permissions through roles
ROLE                           PRIVILEGE                                ADM
------------------------------ ---------------------------------------- ---
RESOURCE                       CREATE TRIGGER                           NO
RESOURCE                       CREATE SEQUENCE                          NO
RESOURCE                       CREATE TYPE                              NO
RESOURCE                       CREATE PROCEDURE                         NO
RESOURCE                       CREATE CLUSTER                           NO
RESOURCE                       CREATE OPERATOR                          NO
RESOURCE                       CREATE INDEXTYPE                         NO
RESOURCE                       CREATE TABLE                             NO
SQL>  select a.granted_role,,
     From dba_role_privs a,role_sys_privs b ,dba_sys_privs c
   Where a.granted_role= and = and ='HR
RESOURCE        CREATE SEQUENCE      UNLIMITED TABLESPACE
RESOURCE        CREATE INDEXTYPE     CREATE SESSION
--Looks beautiful,But this is the same value to return the result,1=1=1   3*8=24tRecord
select a.granted_role,, from dba_role_privs
a join role_sys_privs b on a.granted_role= join dba_sys_privs
c on = and ='HR';  --No effect can be achieved;
--a  Find roles owned by users
select * from dba_role_privs  grantee granted_role
-b  Find permissions you have by role
select * from role_sys_privs    1-2 role  granted_role
-c Find system permissions you have through users
select * from dba_sys_privs  1-3 grantee 
--Ideas1+2=2 => 2+3=total
select * from (select , from
 dba_role_privs a join role_sys_privs b on a.granted_role=
  union
   select , from dba_sys_privs c)
    where grantee='HR';
--The same as above--whereCondition execution faster
select , from
 dba_role_privs a join role_sys_privs b 
    on a.granted_role= where grantee='HR'
  union 
   select , from dba_sys_privs c where grantee='HR';
significance:Some permissions are not granted separately through roles、Or grant permissions separately:It is better to find out what permissions users have through collections
 ****Replenish:
--What is object permissions,Design specific permissions for a certain object;
grant select on  to hr;
Query has permissions to specific objects;
select * from dba_tab_privs where grantee='HR';
HR         SYS        YANG       SYS        WRITE      NO  NO
HR         SYS        YANG       SYS        READ       NO  NO
HR         SYS        DBMS_STATS SYS        EXECUTE    NO  NO
HR         SCOTT      DEPT       SCOTT      SELECT     NO  NO
Recycle: revoke execute on sys.DBMS_STATS from hr;

This is the article about Oracle querying users with all system permissions. For more information about Oracle querying users with all permissions, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!

  • Oracle
  • user
  • have
  • Permissions

Related Articles

  • How Oracle gets the current time of the database system

    This article mainly introduces how Oracle obtains the current time issue of the database system. It has good reference value and hopes it will be helpful to everyone. If there are any mistakes or no complete considerations, I hope you will be very grateful for your advice
    2022-12-12
  • Introduction to Oracle text functions

    Oracle database provides many functions for us to use. The Oracle functions introduced below are text functions. If you are interested in this aspect, you might as well take a look.
    2015-08-08
  • Detailed explanation of the creation and use of Oracle database dbLink

    This article mainly introduces a detailed explanation of the creation and use of Oracle database dbLink. Oracle's database link dbLink is a function that allows communication and data exchange between two different database instances. It allows you to access objects and data in another database in one database. Friends who need it can refer to it.
    2023-08-08
  • Oracle 10g DBA cannot log in solution

    Many times, after installing Oracle10g, log in to the Windows authentication window pop-up at http://kcsqlbi:5560/isqlplus/dba. Even if you enter any account, you cannot log in.
    2009-05-05
  • oracle uses to_date to query the first day of the week

    In the development of the project, a function that searches for the first day of the week is difficult to find a solution after searching for N for a long time. Just write one yourself and use it first. The code is as follows a_week format 'YYYIW'. For example, '200801' means the first week of 2008.
    2014-01-01
  • oracle initialization parameter settings

    oracle initialization parameter settings...
    2007-03-03
  • Only one duplicate data is left in Oracle

    This article mainly introduces that only one duplicate data is retained in Oracle, which has good reference value and hopes to be helpful to everyone. If there are any mistakes or no complete considerations, I hope you will be very grateful for your advice
    2023-02-02
  • Solve the problem of physical memory checking and shortage of temporary temp space during Oracle installation

    I believe many friends have encountered physical memory checking and shortage of temporary temp space during Oracle installation. Let’s share with you the specific solutions below. Interested friends can refer to it.
    2013-07-07
  • Oracle Session Daily Statistics Function Implementation

    The customer has recently had such a need. He wants to count the number of active sessions in Oracle database and record them. He can use the method of comparing historical active sessions to achieve a rough estimate of the overall user concurrency of the system. This article will share with you the specific implementation method. Interested friends will take a look.
    2022-02-02
  • Detailed explanation of Oracle table partition

    This article explains in detail the method of Oracle table partitioning, and the article introduces it in detail through sample code. It has certain reference value for everyone's study or work. Friends who need it can refer to it.
    2022-05-05

Latest Comments