sql >> データベース >  >> RDS >> Oracle

スキーマ、Oracleデータベースのロールに割り当てられたオブジェクトの権限(DDL、DML、DCL)を確認するにはどうすればよいですか?

    データディクショナリビューのプレフィックスについて簡単に説明します:

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

    役立つビュー情報:

    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.
    

    PRIVSについて詳しく知る ビューは、こちら にアクセスしてください。 。

    クエリ:

    -ユーザー/スキーマのステータスについて

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

    -役割とスキーマに割り当てられた役割を確認します

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

    -役割の権限を確認します

    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');
    

    -スキーマに対して付与されたオブジェクトの権限を確認します

    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');
    

    ありがとうございます!




    1. Java + Tomcat、データベース接続が停止していますか?

    2. 置換変数を使用してLINESIZEとPAGESIZEを設定するにはどうすればよいですか?

    3. Oracle DB10がインストールされているマシンでODP.NET11xcopyデプロイメントが機能しないのはなぜですか?

    4. VARCHARを主キーとして使用できますか?