Oracle Database 权限与角色管理

授予用户系统权限
SQL> grant create table,create sequence,create view to tpcc;
Grant succeeded.

查询授予用户的系统权限
SQL> col grantee for a20
SQL> col privilege for a30
SQL> col admin_option for a15
SQL> select * from dba_sys_privs where grantee ='TPCC';
GRANTEE              PRIVILEGE                      ADMIN_OPTION
-------------------- ------------------------------ ---------------
TPCC                 CREATE TABLE                   NO
TPCC                 UNLIMITED TABLESPACE           NO
TPCC                 CREATE VIEW                    NO
TPCC                 ALTER SESSION                  NO

撤销授予用户的系统权限
SQL> revoke create sequence from tpcc;
Revoke succeeded.

查询授予用户的系统权限
SQL> select * from dba_sys_privs where grantee ='TPCC';
GRANTEE         PRIVILEGE                      ADMIN_OPTION
--------------- ------------------------------ ---------------
TPCC            CREATE TABLE                   NO
TPCC            UNLIMITED TABLESPACE           NO
TPCC            CREATE VIEW                    NO
TPCC            ALTER SESSION                  NO

授予用户对象权限
SQL> grant select on scott.emp to tpcc;
Grant succeeded.

SQL> col owner for a20
SQL> col table_name for a20
SQL> col grantee for a15
SQL> col grantor for a15
SQL> col privilege for a30
SQL> select grantee,owner,table_name,grantor,privilege from dba_tab_privs where grantee = 'TPCC';
GRANTEE         OWNER                TABLE_NAME           GRANTOR         PRIVILEGE
--------------- -------------------- -------------------- --------------- ------------------------------
TPCC            SYS                  DBMS_LOCK            SYS             EXECUTE
TPCC            SCOTT                EMP                  SCOTT           SELECT

撤销授予用户的对象权限
SQL> revoke select on scott.emp from tpcc;
Revoke succeeded.

SQL> select grantee,owner,table_name,grantor,privilege from dba_tab_privs where grantee = 'TPCC';

GRANTEE         OWNER                TABLE_NAME           GRANTOR         PRIVILEGE
--------------- -------------------- -------------------- --------------- ------------------------------
TPCC            SYS                  DBMS_LOCK            SYS             EXECUTE


猜你喜欢

转载自blog.51cto.com/13598811/2135644