oracle数据库为用户创建权限和取消授权
创建用户
create user username
identified by password
例:create user martin
identified by 123456
查询新用户是否添加成功
select username, account_status
from dba_users
where account_status = 'OPEN'
或
select username, account_status
from dba_users
where username = 'MARTIN'
查询数据库用户本身拥有权限
select * from session_privs
查询数据库用户本身拥有角色
select * from user_role_privs
查看某个角色拥有哪些权限 例:DBA角色
select * from dba_sys_privs where grantee='DBA'
对martin用户授权数据库连接权限
grant connect to martin
切换martin帐号查询本身的权限
对martin用户授权数据库某张表查询权限
例:增加dba_sys_privs查询权限
grant select on dba_sys_privs to martin
回收用户权限
例:回收martin用户dba_sys_privs表查询权限
revoke select on dba_sys_privs from martin
对martin用户授权数据库某张表查询、插入、删除、更新、权限
grant select,insert,delte,update on dba_sys_privs to martin
回收martin用户授权数据库某张表查询、插入、删除、更新、权限
revoke select,insert,delte,update on dba_sys_privs from martin
删除用户
drop user martin
或者
drop user martin cascade
---------------------------------------------------------------------------------------
在创建用户的时候如果直接给用户DBA权限,那么在B用户中可以直接查询A用户的表,但是在创建视图时就会报无权限,在这种情况下需要再在被访问的A用户里面去给予要访问该表的B用户授权。