您的位置:首页 > 数据库 > Oracle

Oracle数据库创建、删除用户及用户授权

2016-09-22 11:19 337 查看
--创建用户指定表空间并授权:
create user testuser identified by testuser
default tablespace tests_data;
alter user testuseraccount unlock;
grant connect,resource to testuser;--给用户所有权限
--查询所有用户
select * from dba_users;
select * from all_users;
select * from user_users;
--删除用户
drop user [username] cascade;
--一个用户的默认表空间只能有一个,但是你可以试下用下面的语句为其授权在别的表空间中创建对像:
alter user username quota 0||unlimited on tablespace_name;
alter user username quota unlimited on tablespaceA;
alter user username quota unlimited on tablespaceB;
--或者放开所有表空间
grant unlimited tablespace to username;
--或者索性给所有权限
grant resource,connect,dba to username;
--关于用户具体权限授权
grant create session to username;--授予username用户创建session的权限,即登陆权限
grant unlimited tablespace to username;--授予username用户使用表空间的权限
grant create table to username;--授予创建表的权限
grante drop table to username;--授予删除表的权限
grant insert table to username;--插入表的权限
grant update table to username;--修改表的权限
grant all to public;--这条比较重要,授予所有权限(all)给所有用户(public)
--oralce对权限管理比较严谨,普通用户之间也是默认不能互相访问的,需要互相授权
grant select on tablename to username;--授予username用户查看指定表的权限
grant drop on tablename to username;--授予删除表的权限
grant insert on tablename to username;--授予插入的权限
grant update on tablename to username;--授予修改表的权限
grant insert(id) on tablename to username;
grant update(id) on tablename to username;--授予对指定表特定字段的插入和修改权限,注意,只能是insert和update
grant alert all table to username;--授予username用户alert任意表的权限
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  oracle 创建 授权