实验四总结报告.docxVIP

  • 5
  • 0
  • 约4.29千字
  • 约 15页
  • 2019-09-02 发布于江西
  • 举报
PAGE2 / NUMPAGES2 《数据库原理与应用》实验报告 实验名称: 实验四 班 级: 软件工程 学 号: 姓 名: 一、实验目的 (1)了解Oracle数据库中的用户管理,模式,权限管理和角色管理。 (2)掌握为用户分配权限的方法。 (3)了解为不同用户分配不同权限的目的及原因。 二、实验过程 1.用系统帐户sys登录数据库,分别创建数据库内部用户user_one和user_two,创建时自己为用户分配帐户口令。 create user user_one identified by 980916 default tablespace users temporary tablespace temp quota unlimited on users; create user user_two identified by 980916 default tablespace users temporary tablespace temp quota unlimited on users; 2.为了使两位用户登录数据库请为其授予相应的权限。 grant create session to user_one,user_two; 3.授予用户user_one在自己模式下创建表的权限,在任何模式下删除表的权限,授予用户user_two可以在任何模式下创建表的权限,查询任何模式下表中数据的权限和在任何模式下创建视图的权限。 grant create table,drop 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 date); 在user_two中建表B create table b( x number, y date); 在user_two中查询表A select * from user_one.a; 从user_one中删除表B drop 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、SPJ四张表导入到user_three模式下。 create user user_three identified by 980916 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_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);

文档评论(0)

1亿VIP精品文档

相关文档