数据库概论与技术数据恢复技术复习课程

上传人:yuzo****123 文档编号:141574966 上传时间:2020-08-10 格式:PPT 页数:119 大小:564KB
返回 下载 相关 举报
数据库概论与技术数据恢复技术复习课程_第1页
第1页 / 共119页
数据库概论与技术数据恢复技术复习课程_第2页
第2页 / 共119页
数据库概论与技术数据恢复技术复习课程_第3页
第3页 / 共119页
数据库概论与技术数据恢复技术复习课程_第4页
第4页 / 共119页
数据库概论与技术数据恢复技术复习课程_第5页
第5页 / 共119页
点击查看更多>>
资源描述

《数据库概论与技术数据恢复技术复习课程》由会员分享,可在线阅读,更多相关《数据库概论与技术数据恢复技术复习课程(119页珍藏版)》请在金锄头文库上搜索。

1、数 据 库 概 论 与 技 术数据恢复技术,汤 娜 中山大学计算机科学系 ,1 数据库恢复概述 2 故障的种类 3 数据存储结构 4 恢复的实现技术 5 恢复策略 6 具有检查点的恢复技术 7 数据库镜像 8 小结,数据库恢复技术,数据库恢复概述,数据库恢复概述,故障是不可避免的 计算机硬件故障 系统软件和应用软件的错误 操作员的失误 恶意的破坏 故障的影响 运行事务非正常中断,但不会破坏数据库 破坏数据库,数据库恢复概述(续),数据库管理系统对故障的对策 保证故障发生后,能把数据库中的数据从错误状态恢复到某种逻辑一致的状态 保证事务ACID DBMS提供恢复子系统 恢复技术是衡量系统优劣的重

2、要指标 恢复算法 正常事务处理时,采取措施保证有足够的数据用于故障恢复 故障发生后,将数据库内容恢复到某个保证数据库一致性、原子性及持久性的状态,故障的种类,3 故障的种类,事务故障 系统故障 介质故障,一、事务故障,什么是事务故障 某个事务在运行过程中由于种种原因未运行至正常终止点就夭折了 事务故障的常见原因 输入数据有误 运算溢出 违反了某些完整性限制 某些应用程序出错 并行事务发生死锁 。,事务故障的恢复,发生事务故障时,夭折的事务可能已把对数据库的部分修改写回磁盘 处理方法 预期故障: 通过在程序中加判断条件来实现。执行回滚(ROLLBACK)语句来撤销事务。 非预期的故障: 如由于死

3、锁、运算溢出而被迫撤销的事务等,由系统来撤销事务 事务故障的恢复的本质:撤消事务(UNDO),3 故障的种类,事务故障 系统故障 介质故障,二、系统故障,什么是系统故障 整个系统的正常运行突然被破坏 所有正在运行的事务都非正常终止 内存中数据库缓冲区的信息全部丢失 外部存储设备上的数据未受影响,系统故障的常见原因,操作系统或DBMS代码错误 操作员操作失误 特定类型的硬件错误(如CPU故障) 突然停电,系统故障的恢复,清除尚未完成的事务对数据库的所有修改 系统重新启动时,恢复程序要强行撤消(UNDO)所有未完成事务 将缓冲区中已完成事务提交的结果写入数据库 系统重新启动时,恢复程序需要重做(R

4、EDO)所有已提交的事务,3 故障的种类,事务故障 系统故障 介质故障,三、介质故障,硬件故障使存储在外存中的数据部分丢失或全部丢失 介质故障比前两类故障的可能性小得多,但破坏性大得多,介质故障的常见原因,硬件故障 磁盘损坏 磁头碰撞 操作系统的某种潜在错误 瞬时强磁场干扰,介质故障的恢复,装入数据库发生介质故障前某个时刻的数据副本 重做自此时始的所有成功事务,将这些事务已提交的结果重新记入数据库,数据存储结构,Storage Structure,Volatile storage: does not survive system crashes examples: main memory, c

5、ache memory Nonvolatile storage: survives system crashes examples: disk, tape, flash memory, non-volatile (battery backed up) RAM Stable storage: a mythical form of storage that survives all failures approximated by maintaining multiple copies on distinct nonvolatile media,Stable-Storage Implementat

6、ion,Maintain multiple copies of each block on separate disks raid 远程灾备copies can be at remote sites to protect against disasters such as fire or flooding. Failure during data transfer can still result in inconsistent copies: Block transfer can result in Successful completion Partial failure: destina

7、tion block has incorrect information Total failure: destination block was never updated,Stable-Storage Implementation,Protecting storage media from failure during data transfer (one solution): Execute output operation as follows (assuming two copies of each block): Write the information onto the fir

8、st physical block. When the first write successfully completes, write the same information onto the second physical block. The output is completed only after the second write successfully completes.,Stable-Storage Implementation (Cont.),Protecting storage media from failure during data transfer (con

9、t.): Copies of a block may differ due to failure during output operation. To recover from failure: First find inconsistent blocks: Expensive solution: Compare the two copies of every disk block. Better solution: Record in-progress disk writes on non-volatile storage (Non-volatile RAM or special area

10、 of disk). Use this information during recovery to find blocks that may be inconsistent, and only compare copies of these. Used in hardware RAID systems If either copy of an inconsistent block is detected to have an error (bad checksum), overwrite it by the other copy. If both have no error, but are

11、 different, overwrite the second block by the first block.,Data Access,Physical blocks are those blocks residing on the disk. Buffer blocks are the blocks residing temporarily in main memory. Block movements between disk and main memory are initiated through the following two operations: input(B) tr

12、ansfers the physical block B to main memory. output(B) transfers the buffer block B to the disk, and replaces the appropriate physical block there.,Data Access,Each transaction Ti has its private work-area in which local copies of all data items accessed and updated by it are kept. Tis local copy of

13、 a data item X is called xi. We assume, for simplicity, that each data item fits in, and is stored inside, a single block.,Data Access (Cont.),Transaction transfers data items between system buffer blocks and its private work-area using the following operations : read(X) assigns the value of data it

14、em X to the local variable xi. write(X) assigns the value of local variable xi to data item X in the buffer block. both these commands may necessitate the issue of an input(BX) instruction before the assignment, if the block BX in which X resides is not already in memory. Transactions Perform read(X

15、) while accessing X for the first time; All subsequent accesses are to the local copy. After last access, transaction executes write(X). output(BX) need not immediately follow write(X). System can perform the output operation when it deems fit.,Example of Data Access,x,Y,A,B,x1,y1,buffer,Buffer Bloc

16、k A,Buffer Block B,input(A),output(B),read(X),write(Y),disk,work area of T1,work area of T2,memory,x2,恢复的实现技术,恢复操作的基本原理,恢复操作的基本原理:冗余 利用存储在系统其它地方的冗余数据来重建数据库中已被破坏或不正确的那部分数据 恢复的实现技术:复杂 一个大型数据库产品,恢复子系统的代码要占全部代码的10%以上,4 恢复的实现技术,恢复机制涉及的关键问题 1. 如何建立冗余数据 数据转储(backup) 登录日志文件(logging) 2. 如何利用这些冗余数据实施数据库恢复,4.1 数据转储(备份),一、什么是转储 二、转储的用途 三、转储方法,一、什么是转储,转储是指DBA将整个数据库复制到磁带或另一个磁盘上保存起来的过程。 这些备用的数据文本称为后备副本或后援副本。,二、转储方法,1静态转储与动态转储 2海量转储与增量转储 3转储方法小结,1静态转储,在系统中无运行事务时进行转储 转储

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

当前位置:首页 > 中学教育 > 教学课件 > 高中课件

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