1.使用SYSDBA身份连接到数据库
sqlplus /nolog
conn / as sysdba;
2.创建用户账户USERA,其口令为orcl,默认表空间为USERS,临时表空间为TEMP,对表空间的配额限制为10MB
create user usera identified by orcl
default tablespace users
temporary tablespace temp
quota 10M on users;
3.向用户授予连接数据库系统的权限和角色RESOURCE权限
grant create session to usera;
grant resource to usera;
4.向用户授予对对象'SCOTT.EMP'的select,delete和update权限,并以用户USERA连接到数据库,查询SCOTT.EMP的表
grant select, delete, update on scott.emp to usera;
grant select, delete, update on usera;
conn usera/orcl;
select * form scott.emp;
5.撤销向用户USERA授予的系统权限,向用户授予CONNECT角色
conn / as sysdba;
revoke create session from usrea;
grant connect to usera;
6.创建一个角色ROLE1,授予其具有CREATE VIEW,CREATE PROCEDURE,CREATE TRIGGER的权限
create role role1;
grant create view, create procedure, create trigger to role1;
7.将创建的角色ROLE1授权给USERA
grant role1 to usera;
8.撤销USERA中的CREATE VIEW权限
revoke create view from role1;