时间:2021-07-01 10:21:17 帮助过:5人阅读
了解实例恢复:
检查点(CKPT)进程
CKPT负责:
•使用检查点信息更新数据文件头
•使用检查点信息更新控制文件
•在完全检查点发送DBWn信号
SGA
数据库
缓冲区缓存
进程
数据库写入程序进程
数据文件
CKPT
检查点进程
控制文件
Understanding Instance Recovery:
Redo Log Files and Log Writer Redo log files:
• Record changes to the database
• Should be multiplexed to protect against loss
Log Writer (LGWR) writes:
• At commit
• When one-third full
• Every three seconds
• Before DBWn writes
• Before clean shutdowns
了解实例恢复:
重做日志文件和日志写入程序重做日志文件:
•记录对数据库的更改
•应多路复用以防止丢失
日志写入程序(LGWR)写入:
•承诺时
•满三分之一时
•每三秒
•在DBWn写入之前
•清洁停机前
SGA
Redo log buffer
Log Writer
LGWR 日志写进程
Redo log 可设置不同磁盘,实现多路复制,实现最大可修复性
group 1
Redo log
group 2
Redo log
group 3
SGA
重做日志缓冲区
日志编写器
LGWR
重做日志
第一组
重做日志
第2组
重做日志
第3组
Understanding Instance Recovery
Automatic instance or crash recovery:
• Is caused by attempts to open a database whose files are not synchronized on shutdown
• Uses information stored in redo log groups to synchronize files
• Involves two distinct operations:
– Rolling forward: Redo log changes (both committed and uncommitted) are applied to data files.
– Rolling back: Changes that are made but not committed are returned to their original state.
了解实例恢复
自动实例或崩溃恢复:
•由于试图打开一个数据库而导致,该数据库的文件在关闭时不同步
•使用存储在重做日志组中的信息来同步文件
•涉及两个不同的操作:
–前滚:重做日志更改(已提交和未提交)应用于数据文件。
–回滚:已进行但未提交的更改将返回到其原始状态。
SQL> show user
USER is "HR"
SQL> create table instance_test as select * from employees;
Table created.
SQL> drop table instance_test;
Table dropped.
* drop操作会删除所有的数据以及表结构
* delete操作会删除数据,但会保留表结构,并且在之后需要时可以回滚数据。此外,delete操作还可以加一些其它的where条件,比如删除确定的记录。
SQL> create table instance_test tablespace inventory as select * from employees; 创建一个instance_test表,表中添加数据从employees
Table created.
SQL> insert into instance_test select * from instance_test; 自行复制
107 rows created.
SQL> select count(*) from instance_test; 查看表中有多少行
COUNT(*)
----------
214
SQL> insert into instance_test select * from instance_test; 反复复制自己,就会导致空间占满,从而无法添加
SQL> rollback;
Rollback complete. 未提交之前如果服务器坏了,之前的复制操作会存储在undo表空间中,系统会自动rollback
假设没有手动执行上面的rollback命令
可查看app/diag/rdbms/orcl/orcl/trace下的alert文件 linux命令 tail -f alert_orcl.log 查看表空间错误提示
SQL> shut abort 模拟数据库异常关闭
SQL> start up 此时数据库会执行实例失败修复
Phases of Instance Recovery
1. Instance startup (data files are out of sync)
2. Roll forward (redo)
3. Committed and uncommitted data in files
4. Database opened
5. Roll back (undo)
6. Committed data in files
实例恢复阶段
1实例启动(数据文件不同步)
2前滚(重做)
3文件中已提交和未提交的数据
4数据库已打开
5回滚(撤消)
6文件中提交的数据
Tuning Instance Recovery
• During instance recovery, the transactions between the checkpoint position and the end of redo log must be applied to data files.
• You tune instance recovery by controlling the difference between the checkpoint position and the end of redo log.
调整实例恢复
•实例恢复时,检查点位置和重做日志结束之间的事务必须应用于数据文件。
•通过控制检查点位置和重做日志结束之间的差异来优化实例恢复
Using the MTTR Advisor
• Specify the desired time in seconds or minutes.
• The default value is 0 (disabled).
• The maximum value is 3,600 seconds (one hour).
使用MTTR顾问
•以秒或分钟为单位指定所需时间。
•默认值为0(禁用)。
•最大值为3600秒(一小时)。
Media Failure
Typical Causes
Failure of disk drive
Failure of disk controller
Deletion or corruption of a file needed for database operation
Possible Solutions
1. Restore the affected file from backup.
2. Inform the database about a new file location (if necessary).
3. Recover the file by applying redo information (if necessary).
媒体故障
典型原因
磁盘驱动器故障
磁盘控制器故障
删除或损坏数据库操作所需的文件
可能的解决方案
1从备份还原受影响的文件。
2通知数据库一个新的文件位置(如果需要)。
3通过应用重做信息(如果需要)恢复文件。
Comparing Complete and Incomplete Recovery
Recovery can have two kinds of scope:
• Complete recovery: Brings the database or tablespace up to the present, including all committed data changes made to the point in time when the recovery was requested
• Incomplete or point-in-time recovery (PITR): Brings the database or tablespace up to a specified point in time in the past, before the recovery operation was requested
比较完全恢复和不完全恢复
恢复可以有两种范围:
•完全恢复:使数据库或表空间保持当前状态,包括在请求恢复时对时间点所做的所有已提交的数据更改
•不完整或时间点恢复(PITR):在请求恢复操作之前,将数据库或表空间提升到指定的时间点
Oracle Data Protection Solutions Oracle数据保护解决方案
Backup and
Recovery Objective
Physical data protection
Logical data protection
Recovery analysis
Recovery Time
Hours/Days
Minutes/Hours
Minimize time for problem identification and recovery planning
Oracle Solution
Recovery Manager ,Oracle Secure Backup 重要数据库恢复工具
Objective (RTO)
Flashback Technologies
Data Recovery Advisor
Disaster Recovery Objective
Physical data protection
Recovery Time Objective (RTO)
Seconds/Minutes
Oracle Solution
Data Guard,Active Data Guard
备份和
恢复目标
物理数据保护
逻辑数据保护
回收率分析
恢复时间
小时/天
分钟/小时
最小化问题识别和恢复计划的时间
Oracle解决方案
恢复管理器,Oracle安全备份
目标(RTO)
闪回技术
数据恢复顾问
灾难恢复目标
物理数据保护
恢复时间目标(RTO)
秒/分
Oracle解决方案
数据保护,主动数据保护
Statement failure is never by design and always requires the DBA to address the issue.
语句失败从来不是故意的,总是需要DBA来解决这个问题。 错的
Summary
In this lesson, you should have learned how to:
• Identify the types of failure that can occur in an Oracle database
• Describe instance recovery
• Describe complete and incomplete recovery
摘要
在本课中,您应该学习如何:
•确定Oracle数据库中可能发生的故障类型
•描述实例恢复
•描述完全和不完全恢复
oracle 03-11 备份恢复概念
标签:check sign lis command osi 数据库操作 merge enable recover