数据库实验四报告_第1页
数据库实验四报告_第2页
数据库实验四报告_第3页
数据库实验四报告_第4页
数据库实验四报告_第5页
免费预览已结束,剩余4页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

数据库原理与应用实验报告实验名称:班 级:学 号:姓 名:一、实验目的(1)了解Oracle数据库中的用户管理,模式,权限管理和角色管理。(2)掌握为用户分配权限的方法。(3)了解为不同用户分配不同权限的目的及原因。二、实验过程1用系统帐户sys登录数据库,分别创建数据库内部用户user_one和user_two,创建时自己为用户分配帐户口令。语句:create user user_one identified by 123456 default tablespace users temporary tablespace temp quota unlimited on users;create user user_two identified by 123456 default tablespace users temporary tablespace temp quota unlimited on users;执行结果:2为了使两位用户登录数据库请为其授予相应的权限。语句:grant create session to user_one;grant create session to user_two;执行结果:3授予用户user_one在自己模式下创建表的权限,在任何模式下删除表的权限,授予用户user_two可以在任何模式下创建表的权限,查询任何模式下表中数据的权限和在任何模式下创建视图的权限。语句:grant create table,drop any table to user_one;grant create any table,create any view,select any table to user_two;执行结果:4分别用user_one和user_two登录,写出相应的SQL语句验证为其授予的权限。(如果建立的表中有主键约束,需要预先授予user_one和user_two用户create any index的权限。)语句:create table t1 (a varchar2(10);drop table heart.change_major;create table heart.t2(b varchar2(10);create view heart.abcasselect sc.sno,student.sname,ame,gradefrom student,sc,coursewhere student.sno=sc.sno and o=o and major=生物工程;select sc.sno,student.sname,ame,gradefrom student,sc,coursewhere student.sno=sc.sno and o=o and major=生物工程;执行结果:5用系统帐户sys登录数据库,创建用户user_three,将角色权限DBA授予用户user_three,并将S、P、J、SPJ四张表导入到user_three模式下。语句:create user user_three identified by 123456 default tablespace users temporary tablespace temp quota unlimited on users;grant dba to user_three;执行结果:6使用user_three登录,完成如下授权,在user_one和user_two用户下执行相应的SQL语句验证授权是否成功。(1)把对表S的INSERT权力授予用户user_one,并允许他再将此权限授予其他用户。语句:grant insert on s to user_onewith grant option;执行结果:(2)用户user_two对S,P,J三个表有SELECT和INSERT权力语句:grant select,insert on s to user_two;grant select,insert on p to user_two;grant select,insert on j to user_two;执行结果:(3)用户user_one对SPJ表有DELETE权力,对QTY字段具有UPDATE权力。语句:grant delete,update(qty) on spj to user_one;执行结果:(4)收回user_one对S表的插入权限。语句:revoke insert on s from user_one;执行结果:7把对用户user_two授予的所有权限收回,只保留登录权限。(系统权限和对象权限应该分别收回)语句:revoke create any table,create any view,select any table from user_two;执行结果:8用系统帐户sys登录数据库,创建用户user_four,将角色权限DBA授予此用户,在user_four的模式下导入Sudent、Course和SC表。语句:create user user_four identified by 123456 default tablespace users temporary tablespace temp quota unlimited on users;grant dba to user_four;执行结果:9使用user_four登录,创建角色STUDBA,将修改Student、Course、SC表结构的权限,插入、删除、修改和查询三张表中数据的权限授予角色STUDBA,将角色的权限授予user_one和user_two。语句:create role STUDBA;grant alter,insert,delete,update,select on course to studba;grant alter,insert,delete,update,select on student to studba;grant alter,insert,delete,update,select on sc to studba;grant studba to user_one,user_two;执行结果:10对于通过STUDBA角色授予的权限,在user_one和user_two用户下执行相应的SQL语句对权限进行验证。语句:alter table user_four.student

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论