ITPub博客

首页 > 数据库 > > 脚本是提高工作效率的好助手

脚本是提高工作效率的好助手

作者:Abraham林老师 时间:2021-08-03 16:30:39 0 删除 编辑


创建用户

SQL> create user test identified by oracle
2 ;

User created.

SQL> grant connect,resource to test;

Grant succeeded.

SQL> grant create table to test;

Grant succeeded.

SQL> grant unlimited tablespace to test;

Grant succeeded.

下面通过一个脚本查询用户的角色以及角色对应的系统或对象权限,和用户的系统或对象权限。


SQL> select
lpad(' ', 2*level) || granted_role "User, his roles and privileges"
from
(
select null grantee, username granted_role from dba_users
where username =upper('TEST')
union
select grantee, granted_role
from dba_role_privs
union
select grantee, privilege
from dba_sys_privs
)
start with grantee is null
connect by grantee = prior granted_role;
2 3 4 5 6 7 8 9 10 11 12 13 14 15
User, his roles and privileges
--------------------------------------------------------------------------------
TEST
CONNECT                            <<<<<<角色
   CREATE SESSION
   SET CONTAINER
CREATE TABLE                   <<<<<<对象权限
RESOURCE                          <<<<<<角色
  CREATE CLUSTER
  CREATE INDEXTYPE
  CREATE OPERATOR
  CREATE PROCEDURE
  CREATE SEQUENCE
  CREATE TABLE
  CREATE TRIGGER
  CREATE TYPE
  SODA_APP
UNLIMITED TABLESPACE    <<<<<系统权限

16 rows selected.


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31540773/viewspace-3157497/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2018-07-18

  • 博文量
    169
  • 访问量
    1543