图书馆管理系统《Oracle数据库技术》综合设计报告书

上传人:2127513****773577... 文档编号:67038956 上传时间:2022-03-30 格式:DOC 页数:22 大小:430.50KB
返回 下载 相关 举报
图书馆管理系统《Oracle数据库技术》综合设计报告书_第1页
第1页 / 共22页
图书馆管理系统《Oracle数据库技术》综合设计报告书_第2页
第2页 / 共22页
图书馆管理系统《Oracle数据库技术》综合设计报告书_第3页
第3页 / 共22页
点击查看更多>>
资源描述
精选优质文档-倾情为你奉上Oracle数据库技术Oracle综合设计实验报告选 题: 图书管理信息系统 班 级: 学 号: 姓 名: 填写日期: 2010 年 12月25日一、 系统功能说明随着社会的发展,人们对知识的需求也不断的增长。在这种形式下,人们就要不断的学习,不断的给自己充电,而图书馆就自然而然地在人们的生活中占据了一定的位置,如何科学的管理图书馆不但关系到读者求知的方便程度,也关系到图书馆的发展。图书馆作为一种信息资源的集散地,用户借阅资料繁多,包含很多的信息数据的管理。现今,有很多的图书馆都是初步开始使用,有些甚至尚未使用计算机进行信息管理。数据信息处理工作量大,容易出错;用于数据繁多,容易丢失,且不易查找。总的来说,缺乏系统,规范的信息管理手段。尽管有的图书馆有计算机,但是尚未用于信息管理,没有发挥它的效力,资源闲置比较突出。因此一个好的图书馆管理系统是非常重要的。1登录模块 用户登录:用户在登陆页面登陆,登陆成功进入系统。管理员登陆:用于管理员的登陆,在后台登陆页面登陆,登陆成功进入系统。 图书管理员与系统管理员后台功能不一样。查询用户表,对应用户名、密码正确则进入系统,对应用户名密码不正确则显示相应信息2图书管理模块对图书进行添加、查询、修改、删除、添加。将输入的图书信息添加到数据库图书表中,以方便进行各种查询及更新操作,根据输入的图书名称或作者,查询数据库图书表中的相应记录并显示相应图书信息,更新数据库图书表中对应记录并显示更新后的图书信息,删除数据库图书表中对应记录。3副本信息模块 对图书的副本信息进行添加、修改、删除。将输入的图书副本信息添加到副本表中,并分配一个独立的中南码根据输入的中南码或国际标准图书编码,查询图书副本表,显示副本信息更新副本表的数据库、删除副本表中所对应的图书信息、修改副本表中错误的信息并更新数据库。4. 用户管理模块对用户进行添加、删除、修改。将输入的用户信息添加到用户表中,并分配一个独立的用户号根据输入的用户名的姓名或生日,查询用户表,显示用户信息更新用户表的数据库、删除用户表中所对应的、修改用户中错误的信息并更新数据库。 二、 数据库分析与设计:2.1数据库的概念设计 图书管理信息系统ER图2.2 数据库的逻辑设计 图书(国际标准图书编码,书名,出版社名,作者名,作者号,中南码) 图书副本(副本编号,国际标准图书编码) 作者(作者号,作者名) 分类目录(中南码,目录名) 写书(国际标准图书编码,作者号) 出版社(出版社名,地址) 用户(用户编号,用户名,密码,权限,生日,邮箱,联系电话,籍贯)2.3数据库的物理设计 1.以表单的形式给出数据库中的具体表的结构以及字段的说明 表2-1 Books表字段数据类型数据长度能否为空中文名备注ISBNChar20否国际标准图书编码主码TitleChar30是书名PubnameChar30是出版者名AuthorChar30是作者名AuthornoNumber30是作者号ZNCodeNumber30是中南分校码 表2-2 Copies表字段数据类型数据长度能否为空中文名备注CopyNoNumber10否副本编号主码ISBNChar20是国际标准图书编码 表2-3 Authors表字段数据类型数据长度能否为空中文名备注AuthorNoNumber10否作者号主码AuthorNameChar20是作者名 表2-4 Categories表字段数据类型数据长度能否为空中文名备注ZNCodeNumber20否中南分校码主码CateNameChar20是目录名表2-5 Writers表字段数据类型数据长度能否为空中文名备注ISBNChar20否国际标准图书编码主码AuthorNoNumber20否作者号主码表2-6 Publishers表字段数据类型数据长度能否为空中文名备注PubNameChar30否出版者名主码AddressChar50是地址表2-7 Users表字段数据类型数据长度能否为空中文名备注UsersNoNumber12否用户编号主码UserNameChar20否用户名UserPwdChar20否用户密码QuanxianNumber20否权限BirthdayDate否用户生日EmailChar30是用户的邮箱TelChar20是用户的联系电话AddressChar20是籍贯2.数据库的索引(1)在Books表中的书名创建索引。(2)为Users表中的姓名创建索引。(3)为Copies表中的副本编号创建索引。3.数据库的视图(1)创建视图“cx_books”,要求查看书籍的国际标准图书编码,书名,出版社名,中南分校编码,作者名,作者号。(2)创建视图“ cx_zj”,要求各用户只能查找作家出版社的书籍名称,作者,副本编号。(3)创建视图“cx_anni”,要求查看作者为安妮宝贝所有的书籍信息的视图。4.文件位置数据库中数据文件,控制文件,日志文件,参数文件的存取路径D:Oracle数据文件D:Oracle控制文件D:Oracle日志文件D:Oracle参数文件三、 数据库实现3.1表空间表空间的创建(注意:数据表空间和索引表空间分别建立在不同磁盘上)/创建数据表空间 SQL create tablespace data 2 logging 3 datafile D:Oracleproduct10.2.0oradatalibrarydata01.dbf 4 size 50m 5 reuse autoextend off;表空间已创建。/创建索引表空间SQL create tablespace indx 2 datafile F:Oracleproduct10.2.0oradatalibraryindx01.dbf 3 size 32m 4 reuse autoextend on next 1280k 5 minimum extent 128k 6 default storage 7 (initial 128k next 128k minextents 1 maxextents 4096 pctincrease 0);表空间已创建。3.2 数据表1.数据表的创建,注意要有表中的约束的定义,以及表间的约束的定义。 (1)创建Books表SQL create table Books2 (isbn char(20) not null primary key,3 title char(30),4 pubname char(30),5 author char(30),6 authorno number(30),7 zncode number(30);表已创建。(2)创建Copies表SQL create table copies2 (copyno number(10) not null primary key,3 isbn char(20)4 constraint fk_copyno foreign key(isbn) references books(isbn);表已创建。(3)创建Authors表SQL create table Authors2 (authorno number(10) not null primary key,3 authorname char(20);表已创建。(4)创建Categories表SQL create table Categories2 (zncode number(20)not null primary key,3 catename char(20);表已创建。(5)创建Writers表SQL create table Writers2 (isbn char(20)not null,3 authorno number(20)not null,4 constraint pk_writers primary key(isbn,authorno);表已创建。(6)创建Publishers表SQL create table Publishers2 (pubname char(30)not null primary key,3 address char(50);表已创建。(7)创建Users表SQL create table Users2 (UserName char(20) not null,3 UserPwd char(20) not null,4 UserNo number(12) primary key,5 Birth date not null, 6 Quanxian number(20),7 Email char(30),8 TEL char(20),9 Address char(20);表已创建。2.表中数据的插入(每张表中至少要有10条数据)(1)Books表insert into Books(ISBN,Title,PubName,ZNCode,author,authorno) values(A0001,草样年华,长江文艺出版社,1,孙睿,1);Insert intoBooks(ISBN,Title,PubName,ZNCode,author,authorno)values(A0002,莲花,武汉大学出版社,2,安妮宝贝,2);Insert intoBooks(ISBN,Title,PubName,ZNCode,author,authorno) values(A0003,小王子,作家出版社,3,黄葒,3);Insert intoBooks(ISBN,Title,PubName,ZNCode,author,authorno)values(A0004,彼岸花,北京大学出版社,4,安妮宝贝,2);Insert intoBooks(ISBN,Title,PubName,ZNCode,author,authorno) values(A0005,二三事,武汉大学出版社,5,安妮宝贝,2);Insert intoBooks(ISBN,Title,PubName,ZNCode,author,authorno) values(A0006,霜冷长河,作家出版社,6,余秋雨,4);Insert intoBooks(ISBN,Title,PubName,ZNCode,author,authorno)values(A0007,笛声何处,作家出版社,7,余秋雨,4);insert into Books(ISBN,Title,PubName,ZNCode,author,authorno) values(A0008,梦里花落知多少,长江文艺出版社,8,郭敬明,5);insert into Books(ISBN,Title,PubName,ZNCode,author,authorno) values(A0009,小时代,长江文艺出版社,9,郭敬明,5);insert into Books(ISBN,Title,PubName,ZNCode,author,authorno) values(A00010,三重门,作家出版社,10,韩寒,6);(2)Copies表insert into copies(copyno,isbn) values(1001,A0001);insert into copies(copyno,isbn) values(1002,A0002);insert into copies(copyno,isbn) values(1003,A0003);insert into copies(copyno,isbn) values(1004,A0004);insert into copies(copyno,isbn) values(1005,A0005);insert into copies(copyno,isbn) values(1006,A0006);insert into copies(copyno,isbn) values(1007,A0007);insert into copies(copyno,isbn) values(1008,A0008);insert into copies(copyno,isbn) values(1009,A0009);insert into copies(copyno,isbn) values(10010,A00010);(3)Users表 insert into Users(UserName,UserPwd,UserNo,Birth,QuanXian,Email,TEL,Address) Values(冯美,123, 1,1,TO_DATE(1986-09-01,YYYY-MM-DD),hubei);Insert into Users(UserName,UserPwd,UserNo,Birth,QuanXian,Email,TEL,Address) values(王灿,456,2,2,TO_DATE(1998-10-09,YYYY-MM-DD),hubei);Insert intoUsers(UserName,UserPwd,UserNo,Birth,QuanXian,Email,TEL,Address) values(杨攀,789,3,2,TO_DATE(1984-10-01,YYYY-MM-DD),hubei);Insert intoUsers(UserName,UserPwd,UserNo,Birth,QuanXian,Email,TEL,Address) values(张楠楠,111,4,2,TO_DATE(1978-02-09,YYYY-MM-DD),hubei);Insert intoUsers(UserName,UserPwd,UserNo,Birth,QuanXian,Email,TEL,Address) values(王子莫,222,5,2,TO_DATE(1989-01-09,YYYY-MM-DD),hubei);Insert intoUsers(UserName,UserPwd,UserNo,Birth,QuanXian,Email,TEL,Address) values(李丽,333,6,2,TO_DATE(1989-01-09,YYYY-MM-DD),hubei);Insert intoUsers(UserName,UserPwd,UserNo,Birth,QuanXian,Email,TEL,Address) values(张婷,444,7,2,TO_DATE(1988-05-09,YYYY-MM-DD),hubei);Insert intoUsers(UserName,UserPwd,UserNo,Birth,QuanXian,Email,TEL,Address) values(王维,555,8,2,TO_DATE(1986-07-19,YYYY-MM-DD),hubei);Insert intoUsers(UserName,UserPwd,UserNo,Birth,QuanXian,Email,TEL,Address) values(刘晓林,666,9,2,TO_DATE(1989-11-16,YYYY-MM-DD),hubei);Insert intoUsers(UserName,UserPwd,UserNo,Birth,QuanXian,Email,TEL,Address) values(罗莎,777,10,2,TO_DATE(1989-12-12,YYYY-MM-DD),hubei);3.数据的修改和删除 (1)数据的修改 将用户为9的用户的联系电话修改为update Usersset TEL= where userno=9; (2)数据的删除将用户罗莎删除delete from Users where username=罗莎;3.3索引和视图1索引的创建(1)在Books表中的书名创建索引。SQL create index Books_ title _idx2 on Books(title);索引已创建。(2)为Users表的姓名创建索引。SQL create index Users_username_idx 2 on Users(username); 索引已创建。(3)为副本表中的副本编号创建索引SQL create index Copies_copyno_idx2 on Copies(copyno);索引已创建。2.视图的创建 (1)创建视图“cx_books”,要求查看图书的国际标准图书编码,书名,出版社名,中南分校编码,作者名,作者号。SQL create or replace view cx_books2 as3 select ISBN,Title,PubName,ZNCode,author,authorno4 from Books;视图已创建。(2)创建视图“ cx_zj”,要求各用户只能查找作家出版社的图书名称,作者,副本编号。SQL create or replace view cx_zj2 as 3 select title,author,copyno4 from Books,Copies 5 where Copies.isbn=Books.isbn and PubName=作家出版社;视图已创建。(3)创建视图“cx_anni”,要求查看作者为安妮宝贝所有的图书信息的视图。SQL create or replace view cx_anni2 as3 select *4 from Books5 where author=安妮宝贝;视图已创建。3.数据的查询(要求做基础数据的查询,做视图的查询,查询要和系统的功能联系起来)(1)查询图书表中作者号为2的作者所有作品的书名和出版社。(2)查找所有姓王的用户的编号,姓名,联系电话,地址。(3)查找由作家出版社出版的所有图书的副本编号。 3.4 PL/SQL程序块(至少2个程序块)1.存储过程的定义添加书籍信息的存储过程BooksAddSQL create or replace procedure BooksAdd 2 (isbn in char,title in char,pubname in char, 3 author in char,authorno in char,zncode in char) 4 as 5 begin 6 insert into Books 7 values(isbn,title,pubname,author,authorno,zncode); 8 end BooksAdd;/过程已创建。2.函数的定义总计所有作者的数量SQL create or replace function count 2 (cnum in char) 3 return number 4 as 5 cnt number; 6 begin 7 select count(author) into cnt8 from Books; 9 return(cnt); 10 end count; /函数已创建。3.触发器的定义删除Books书籍信息表中的一条记录,删除记录isbn的字段值在Copies副本信息表中对应的记录SQL create or replace trigger BooksDelete 2 after delete on Books for each row 3 begin 4 delete from Copies 5 where isbn=:OLD.isbn; 6 end BooksDelete; 7 /触发器已创建。3.4.1 用户权限授予Reader:grant select on books to reader;grant select on publishers to reader;grant select on authors to reader;grant select on copies to reader;grant select on writers to reader;grant select on categories to reader;3.4.2登陆模块管理员界面模块读者主界面模块登陆:declarecursor login (tuser Users.UserName%type,tpwd Users.UserPwd%type)isselect * from Userswhere UserName=tuser and UserPwd=tpwd;loginrow login%rowtype;beginopen login(:login.tuser,:login.tpwd);fetch login into loginrow;if login%found thengo_block(main);message(登录成功!);commit;:login.tuser:=; :login.tpwd:=; :global.quanxian:=loginrow.quanxian; :global.userno:=loginrow.userno; :global.punish:=0;elsemessage(对不起,用户名或密码错误,请重新输入!);commit; :login.tuser:=;:login.tpwd:=;end if;close login;end;退出:declare alert_button number;beginalert_button:=show_alert(exit_form);if alert_button=ALERT_BUTTON1 thenEXIT_FORM;elsebell;end if ;end;3.4.3修改出版信息declarecursor u(bnoo publishers.pubname%type) is select * from publishers where pubname=bnoo;u1 u%rowtype;alert_button number;a number;beginopen u(:publisher.pubname);fetch u into u1;-select count(*) into a from books where ISBN=:booksmana.ISBN;if u%found thenalert_button:=show_alert(alter);fetch u into u1; if alert_button=ALERT_BUTTON1 thenupdate publishers set pubname=:publisher.pubname,address=:publisher.address; message(修改成功!); commit; end if;elsemessage(没有此书,无法修改!);end if;commit;close u;end;3.4.4修改副本信息declarecursor u(bnoo copies.copyno%type) is select * from copies where copyno=bnoo;u1 u%rowtype;alert_button number;a number;beginopen u(:copies.copyno);fetch u into u1;select count(*) into a from books where ISBN=:booksmana.ISBN;if u%found thenalert_button:=show_alert(alter);fetch u into u1; if alert_button=ALERT_BUTTON1 thenupdate copies set copyno=:copies.copyno,isbn=:copies.isbn; message(修改成功!); commit; end if;elsemessage(没有此书,无法修改!);end if;commit;close u;end;3.4.5图书副本信息查询declare cursor b is select * from copies;bs b%rowtype;v_count binary_integer;begin select count(rowid) into v_count from copies; open b; if(:global.punish=0) then message(已经到达第一页!);commit; else :global.punish:=:global.punish-1; for i in 0.(:global.punish) loop fetch b into bs;:booksmana.copyno:=bs.copyno; :booksmana.isbn:=bs.isbn; end loop; end if; close b;end;declare cursor b is select * from copies;bs b%rowtype;v_count binary_integer;begin select count(rowid) into v_count from copies; open b; if(:global.punish=v_count) then message(已经到达最后一页!);commit; else :global.punish:=:global.punish+1; for i in 0.(:global.punish) loop fetch b into bs;:booksmana.copyno:=bs.copyno; :booksmana.isbn:=bs.isbn; end loop; end if; close b;end;3.4.6用户信息管理模块用户信息查看:declarecursor u is select * from users; admrow u%rowtype;v_count binary_integer;begin select count(rowid) into v_count from users; open u; if(:global.punish=0) then message(已经到达第一条!);commit;else :global.punish:=:global.punish-1; for i in 0.(:global.punish) loop fetch u into admrow;:adminmana.userno:=admrow.userno;:adminmana.username:=admrow.username;:adminmana.userpwd:=admrow.userpwd;:adminmana.quanxian:=admrow.quanxian;:adminmana.birth:=admrow.birth;:adminmana.email:=admrow.email;:adminmana.address:=admrow.address;:adminmana.tel:=admrow.tel; end loop; message(:global.punish);close u;end if;end;declarecursor u is select * from users; admrow u%rowtype;v_count binary_integer;begin select count(rowid) into v_count from users; open u; if(:global.punish=v_count) then message(已经到达最后一条!);commit;else :global.punish:=:global.punish+1; for i in 0.(:global.punish) loop fetch u into admrow;:adminmana.userno:=admrow.userno;:adminmana.username:=admrow.username;:adminmana.userpwd:=admrow.userpwd;:adminmana.quanxian:=admrow.quanxian;:adminmana.birth:=admrow.birth;:adminmana.email:=admrow.email;:adminmana.address:=admrow.address;:adminmana.tel:=admrow.tel; end loop; message(:global.punish);close u;end if;end;添加用户:declarea number;alert_button number;beginselect count(*) into a from users where userno=:adminmana.userno;if a!=0 thenmessage(该用户已存在.请重新输入注册用户信息!);commit;elsealert_button:=show_alert(ZHUCE);if alert_button=ALERT_BUTTON1 theninsert into users(UserName,UserPwd,UserNo,QuanXian,Birth,Email,TEL,Address)values(:adminmana.username,:adminmana.userpwd,:adminmana.userno:2,:adminmana.birth,:adminmana.email,:adminmana.tel,:adminmana.address); message(注册成功); commit;elsebell;end if ; end if; end;删除用户:declarepc number(8);cursor u(uno users.userno%type) is select * from users where userno=uno;u1 u%rowtype;alert_button number;beginopen u(:adminmana.userno);fetch u into u1;if u%found thenalert_button:=show_alert(delete); if alert_button=ALERT_BUTTON1 thenpc:=:adminmana.userno;delete from users where userno=pc; message(删除成功); else bell; end if;elsemessage(没有此用户);end if;commit;close u;end;修改用户信息:declarepc number(8);cursor u(uno users.userno%type) is select * from users where userno=uno;u1 u%rowtype;alert_button number;a number; beginopen u(:adminmana.userno);fetch u into u1;select count(*) into a from users where userno=:adminmana.userno;if u%found thenalert_button:=show_alert(alter);fetch u into u1; if alert_button=ALERT_BUTTON1 thenpc:=:adminmana.userno;update users set username=:adminmana.username,userpwd=:adminmana.userpwd,birth=:adminmana.birth,address=:adminmana.address,tel=:adminmana.tel,email=:adminmana.email where userno=pc; message(修改成功!); else bell; end if;elsemessage(修改失败!);end if;commit;close u;end;重置::ADMINMANA.userno:=;:ADMINMANA.username:=;:ADMINMANA.userpwd:=;:ADMINMANA.address:=;:ADMINMANA.email:=;:ADMINMANA.tel:=;四、 心得体会这次课程设计我选的题目是图书管理信息系统,目的是将我们这一学年学习的Oracle理论知识用于实践,将分散的知识点有机地统一结合起来尽量开发出一个相对完善的系统。熟练掌握数据库的备份、恢复,掌握游标(包括隐式游标和显示游标)、菜单、警告等的使用,掌握页面布局等所学知识。这次课程设计不像以前的课程设计那样是团体合作完成,而是要自己一个人完成,所以个人工作量相对大了很多。我这次过程中,遇到了很多问题,对书本知识不熟悉,很多学习过的知识都基本遗忘,所以不得一边设计系统一边重新温习课本。在温习过程中我发现理论和实践是有很大差别的,有些东西理论上感觉已经掌握但是实际一操作就会有错误出现,对于某些知识不知道该怎样运用在系统中,也不清楚该系统怎样布局,需要用到些什么。不过后来,通过查阅资料,并在其他同学和老师的帮助下基本解决了这些问题。通过这次课程设计,我把理论知识应用到了实际编程中,熟练掌握了库表的创建,游标、警告、各种布局工具的使用,掌握了数据库的逻辑备份,学会了编写代码实现程序,还学到了很多平时不了解的知识。在此次课程设计中,我懂得了团队力量的伟大,不知道的知识同学之间可以相互探讨、也可以请教老师,我们能够从老师那里学到很多知识。这次的系统设计为我毕业后适应适应工作打下了基础,了解到团队合作、文档编写、口头与书面表达的重要性。并在设计实践中,我提高了自学能力,提高了今后参与开发稍大规模实际软件项目和探索未知领域知识的能力和自信心,学到了很多书本里没有的知识。再次体会到实践对理论知识的提高有不可忽视的作用,并且在实践过程中遇到困难要积极思考、勇于解决,不要轻言放弃!通过这次课程设计我是受益匪浅,不仅所学知识更加牢固,而且更深刻地了解到了课程设计对于我们的重要性。五、 参考书目Oracle实用教程第二版Oracle10g数据库入门与实践数据库系统原理与应用第二版专心-专注-专业
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 教学培训


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!