实验目的: 1、理解用户与模式的概念,掌握oracle中用户管理的基本方法 2、理解系统权限、对象权限的概念,掌握分配权限的方法 3、理解角色的概念,掌握角色的应用方法 实验内容: 一、用户

撰写人——软件二班——陈喜平
一、用户管理与应用

1、查看用户与模式

show USER;

在这里插入图片描述
2、创建用户

sqlplus sys/oracle123@orcl as sysdba

CREATE USER t16436220 IDENTIFIED BY t16436220;

在这里插入图片描述

3、给予新用户基本权限 create session , resource, create any table

GRANT CREATE session to t16436220;
GRANT resource to t16436220;
GRANT create any table to t16436220;

在这里插入图片描述
4、调整用户的密码、锁定状态、配额等

-- --调整密码
ALTER USER s16436266 IDENTIFIED BY 771003110;

-- --上锁
ALTER USER s16436220 ACCOUNT LOCK;

-- --解锁
ALTER USER s16436220 ACCOUNT UNLOCK;

在这里插入图片描述

-- --调整配额
ALTER USER s16436266
default tablespace sysaux
quota 10M on sysaux;

在这里插入图片描述

5、删除用户!!

DROP USER s16436266 cascade;

prompt DROP ROLE s16436266;
DROP ROLE s16436266;
prompt CREATE ROLE s16436266;
CREATE ROLE s16436266;
prompt GRANT CREATE SESSION TO s16436266;
GRANT CREAT TABLE TO s16436266;

在这里插入图片描述
二、权限管理与应用

系统权限system privilege

对象权限object privilege on objectName

1、授予或回收系统权限

GRANT select on scott.emp to s16436220;
revoke select on scott.emp from s16436220;

在这里插入图片描述

2、授予或回收对象权限

GRANT select on scott.emp to system;
revoke select on scott.emp from system;

在这里插入图片描述

三、角色管理与应用

role 一系列权限的命名集合,目的是简化权限管理的复杂性

1、创建角色

create role yw;

在这里插入图片描述
2、将各类权限放入角色

GRANT create session,resource,create any table to yw;

在这里插入图片描述
3、将角色授予某用户

create user s16436266 identified by s16436266;
grant yw to s16436266;

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_41518597/article/details/84033309
今日推荐