用户、概要文件、权限和角色的应用实例
SQL>CREATE ROLE change identified by zhubajie;--建角色
sql>select * from dba_roles where role='CHANGE';
sql>grant select any table to change;
sql>select * from role_sys_privs where role='CHANGE';
SYS=>SQL>create user sudaji identified by szhouwang default tablespace pioneer_data --建用戶
temporary tablespace pioneer_temp
quota 38m on pioneer_data quota 28m on pioneer_indx
profile pioneer_prof;
sys>grant connect,resource,change to sudaji; --授权
sys>alter user sudaji default role all except change; --只将角色change改为sudaji用户的非默认角色
SQL> select d.username,d.default_tablespace,d.temporary_tablespace,d.profile ,d.created from dba_users d where d.default_tablespace like 'PI%'; --验证
SQL> select username,tablespace_name,bytes/1024/1024 mb,max_bytes/1024/1024 "MAX MB" FROM DBA_TS_QUOTAS WHERE USERNAME='SUDAJI';-- 验证磁盘上限
注意:作为数据库管理员,在执行任何命令后,最好亲自验证一下(如通过数据字典查询一下)