实验四总结报告

上传人:cl****1 文档编号:433126156 上传时间:2023-08-08 格式:DOC 页数:16 大小:1,000.50KB
返回 下载 相关 举报
实验四总结报告_第1页
第1页 / 共16页
实验四总结报告_第2页
第2页 / 共16页
实验四总结报告_第3页
第3页 / 共16页
实验四总结报告_第4页
第4页 / 共16页
实验四总结报告_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《实验四总结报告》由会员分享,可在线阅读,更多相关《实验四总结报告(16页珍藏版)》请在金锄头文库上搜索。

1、数据库原理与应用实验报告实验名称:实验四班级:软件工程学号:姓名:一、实验目的( 1)了解 Oracle 数据库中的用户管理,模式,权限管理和角色管理。( 2)掌握为用户分配权限的方法。( 3)了解为不同用户分配不同权限的目的及原因。二、实验过程1用系统帐户 sys登录数据库,分别创建数据库内部用户 user_one 和 user_two,创建时自己为用户分配帐户口令。create user user_oneidentified by 980916default tablespace userstemporary tablespace tempquota unlimited on users;

2、create user user_twoidentified by 980916default tablespace userstemporary tablespace tempquota unlimited on users;2为了使两位用户登录数据库请为其授予相应的权限。grant create session to user_one,user_two;3授予用户 user_one 在自己模式下创建表的权限, 在任何模式下删除表的权限,授予用户 user_two 可以在任何模式下创建表的权限,查询任何模式下表中数据的权限和在任何模式下创建视图的权限。grant create table,d

3、rop any table to user_one;grant create any table,select any table,create any view to user_two;4分别用 user_one 和 user_two 登录,写出相应的 SQL语句验证为其授予的权限。(如果建立的表中有主键约束, 需要预先授予 user_one 和 user_two 用户 create any index 的权限。)grant create any index to user_one,user_two;在 user_one 中建表 A create table a(x number,y dat

4、e);在 user_two 中建表 B create table b(x number,y date);在 user_two 中查询表 A select * from user_one.a;从 user_one 中删除表 Bdrop table user_two.b;在 user_two 中查询表 B Select * from b;在 user_two 中建立视图 VIEW_A create view view_a(x,y)as select x,y from b;5用系统帐户sys 登录数据库,创建用户user_three,将角色权限DBA 授予用户 user_three,并将 S、P、J

5、、 SPJ四张表导入到 user_three 模式下。create user user_threeidentified by 980916default tablespace userstemporary tablespace tempquota unlimited on users;grant dba to user_three;6使用 user_three 登录,完成如下授权,在 user_one 和 user_two 用户下执行相应的 SQL语句验证授权是否成功。( 1)把对表 S的 INSERT权力授予用户 user_one,并允许他再将此权限授予其他用户。grant insert o

6、n s to user_one with grant option;在 user_one 中插入数据insert into user_three.s(sno,sname,city,sphone)values(1,a,湖北 ,null);commit;grant insert on user_three.s to user_two;在 user_two 中插入数据insert into user_three.s(sno,sname,city,sphone)values(2,b,湖北 ,null);commit;( 2)用户 user_two 对 S,P,J 三个表有 SELECT和 INSERT

7、权力 grant select,insert on s to user_two;grant select,insert on p to user_two; grant select,insert on j to user_two;从 user_two 中查询表 S select * from user_three.s;从 user_two 中给表 S插入数据insert into user_three.s(sno,sname,city,sphone)values(3,c,湖北 ,null);commit;( 3)用户 user_one 对 SPJ表有 DELETE权力,对 QTY字段具有 UP

8、DATE权力。 grant delete,update(qty) on spj to user_one;在 user_one 中删除 sno 为 s1 的数据delete from user_three.spj where sno=S1;commit;在 user_one 中将 sno 为 s2 的数据的 qty 改为 0update user_three.spj set qty=0 where sno=S2;commit;( 4)收回 user_one 对 S表的插入权限。 revoke insert on s from user_one;尝试在 user_one 中插入数据insert i

9、nto user_three.s(sno,sname,city,sphone)values(3,d,湖北 ,null);commit;7把对用户 user_two 授予的所有权限收回,只保留登录权限。 (系统权限和对象权限应该分别收回)revoke select,insert on s from user_two;revoke select,insert on p from user_two;revoke select,insert on j from user_two;revoke create any index,create any table,create any view,select any table from user_two;尝试在 user_two 中创建表 Ccreate table c(x number,y date);8用系统帐户 sys登录数据库,创建用户 user_four,将角色权限 DBA授予此用户,在 user_four 的模式下导入 Sudent、Course和 SC表。create user user_fouridentified by 980916default tablespace userstemporary tablespace tempquota unlimited on users;grant dba to user_four;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 资格认证/考试 > 自考

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号