Oracle
 sql >> Teknologi Basis Data >  >> RDS >> Oracle

Bagaimana cara memeriksa hak istimewa (DDL, DML, DCL) pada objek yang ditugaskan ke Skema, Peran di Oracle Database?

Sedikit singkat tentang awalan tampilan kamus data:

ALL_    -Describes PUBLIC Object grants.
USER_   -Describes current user Object grants.
DBA_    -Describes all object grants in the database.

Informasi tampilan yang berguna:

ROLE_ROLE_PRIVS     -describes the roles granted to other roles. 
ROLE_SYS_PRIVS      -describes system privileges granted to roles.
ROLE_TAB_PRIVS      -describes table privileges granted to roles. 
DBA_ROLE_PRIVS      -describes the roles granted to all users and roles in the database.
DBA_SYS_PRIVS       -describes system privileges granted to users and roles.
DBA_TAB_PRIVS       -describes all object grants in the database.
DBA_COL_PRIVS       -describes all column object grants in the database.

Untuk mengetahui lebih banyak tentang PRIVS dilihat kunjungi di sini .

Permintaan:

-Tentang status pengguna/skema

select username,account_status, created from dba_users where username in ('SCOTT');

-Periksa peran yang ditetapkan untuk peran dan skema

select * from DBA_ROLE_PRIVS where grantee in ('SCOTT','RESOURCE');

-Periksa hak istimewa peran

select * from ROLE_ROLE_PRIVS where role in ('RESOURCE','CONNECT');    
select * from ROLE_TAB_PRIVS  where role in ('RESOURCE','CONNECT');
select * from ROLE_SYS_PRIVS  where role in ('RESOURCE','CONNECT');

Pseudo Code:
select 'grant '||privilege||' to ROLE_SLAVE;' from ROLE_SYS_PRIVS where role in ('RESOURCE','CONNECT');
select 'grant '||privilege||' to ROLE_SLAVE;' from ROLE_TAB_PRIVS where role in ('RESOURCE','CONNECT');

-Periksa hak istimewa objek yang diberikan untuk skema

select * from DBA_SYS_PRIVS where grantee in ('SCOTT');
select * from DBA_TAB_PRIVS where grantee in ('SCOTT');
select * from DBA_COL_PRIVS where grantee in ('SCOTT');

Pseudo Code: 
select 'grant '||privilege||' to SCOTT_SLAVE;' from DBA_SYS_PRIVS where grantee in ('SCOTT');
select 'grant '||privilege||' on '||owner||'.'||table_name||' to SCOTT_SLAVE;' from DBA_TAB_PRIVS where grantee in ('SCOTT');
select 'grant '||privilege||' ('||column_name||') '||' on '||owner||'.'||table_name||' to SCOTT_SLAVE;' from DBA_COL_PRIVS where grantee in ('SCOTT');

Terima kasih!




  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. WSJDBCConnection tidak membungkus objek bertipe Oracle jdbc Connection

  2. SqlDeveloper:hapus daftar alias jaringan

  3. Memetakan bidang ORACLE TIMESTAMP(9) ke java.util.Date

  4. Ubah waktu 24 Jam menjadi 12 Jam plus indikasi AM/PM Oracle SQL

  5. SELECT * FROM TABLE(fungsi pipelined):dapatkah saya memastikan urutan baris dalam hasil?