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

来源:互联网 发布:知乎live可以事后看吗 编辑:程序博客网 时间:2024/06/07 20:31
--创建用户指定表空间并授权:create user testuser identified by testuserdefault 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和updategrant alert all table to username;--授予username用户alert任意表的权限

0 0
原创粉丝点击