Oracle Flashback Database
Oracle Flashback Database
- Ensure that the prerequisites described in Prerequisites of Flashback Database are met.
To use the FLASHBACK DATABASE command to return your database contents to points in time within the flashback window, your database must have been previously configured for flashback logging as described in "Overview of Flashback Database_ Restore Points and Guaranteed Restore Points". To return the database to a guaranteed restore point, you must have previously defined a guaranteed restore point as described in "Using Normal and Guaranteed Restore Points". Flashback Database works by undoing changes to the data files that exist at the moment that you run the command. Note the following important prerequisites: No current data files are lost or damaged. You can only use FLASHBACK DATABASE to rewind changes to a data file made by an Oracle database, not to repair media failures. You are not trying to recover from accidental deletion of data files, undo a shrink data file operation, or undo a change to the database name. You are not trying to use FLASHBACK DATABASE to return to a point in time before the restore or re-creation of a control file. If the database control file is restored from backup or re-created, then all accumulated flashback log information is discarded. You are not trying to use FLASHBACK DATABASE to undo a compatibility change.
Prerequisites
- Connect SQL*Plus to the target database and determine the desired SCN, restore point, or point in time for the
FLASHBACKDATABASEcommand.Obtain the earliest SCN in the flashback database window as follows:
SELECT OLDEST_FLASHBACK_SCN, OLDEST_FLASHBACK_TIME
FROM V$FLASHBACK_DATABASE_LOG;The most recent SCN that can be reached with Flashback Database is the current SCN of the database. The following query returns the current SCN:
SELECT CURRENT_SCN
FROM V$DATABASE;You can query available guaranteed restore points as follows (sample output included):
SELECT NAME, SCN, TIME, DATABASE_INCARNATION#,
GUARANTEE_FLASHBACK_DATABASE
FROM V$RESTORE_POINT
WHERE GUARANTEE_FLASHBACK_DATABASE='YES'; NAME SCN TIME DATABASE_INCARNATION# GUA
--------------- ---------- --------------------- --------------------- ---
BEFORE_CHANGES 5753126 04-MAR-12 12.39.45 AM 2 YES - Shut down the database consistently, ensure that it is not opened by any instance, and then mount it:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT; - Repeat the query in Step 2 of this procedure.
Some flashback logging data is generated when the database is shut down. If flashback logs were deleted due to space pressure in the fast recovery area, then your target SCN may not be reachable.
- Start RMAN and connect to the target database.
- Run the
SHOWcommand to see which channels are preconfigured.During the flashback operation, RMAN may need to restore archived redo logs from backup. Enter the following command to see whether channels are configured (sample output is included):
SHOW ALL; RMAN configuration parameters for database with db_unique_name PROD1 are:
.
.
.
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS "SBT_LIBRARY=/usr/local/oracle/backup/lib/libobk.so";If the necessary devices and channels are configured, then no action is necessary. Otherwise, use the
CONFIGUREcommand to configure automatic channels, or includeALLOCATE CHANNELcommands within aRUNblock. - Run the RMAN
FLASHBACK DATABASEcommand.You can specify the target time by using a form of the command shown in the following examples:
FLASHBACK DATABASE TO SCN 46963; FLASHBACK DATABASE
TO RESTORE POINT BEFORE_CHANGES; FLASHBACK DATABASE TO TIME
"TO_DATE('09/20/12','MM/DD/YY')";When the
FLASHBACKDATABASEcommand completes, the database is left mounted and recovered to the specified target time. - Open the database read-only in SQL*Plus and run some queries to verify the database contents.
Open the database read-only as follows:
ALTER DATABASE OPEN READ ONLY;
If you are satisfied with the state of the database, then end the procedure with Step 9. If you are not satisfied with the state of the database, skip to Step 10.
- If you are satisfied with the results, then perform either of the following mutually exclusive actions:
Make the database available for updates by opening the database with the
RESETLOGSoption. If the database is currently open read-only, then execute the following commands in SQL*Plus:SHUTDOWN IMMEDIATE
STARTUP MOUNT
ALTER DATABASE OPEN RESETLOGS;Use Oracle Data Pump Export to make a logical backup of the objects whose state was corrupted. Afterward, use RMAN to recover the database to the present time:
RECOVER DATABASE;
This step undoes the effect of the Flashback Database by reapplying all changes in the redo logs to the database, returning it to the most recent SCN.
After reopening the database read/write, you can import the exported objects with the Data Pump Import utility. See Oracle Database Utilities to learn how to use Data Pump.
- If you find that you used the wrong restore point, time, or SCN for the flashback, then mount the database and perform one of the following mutually exclusive options:
If your chosen target time was not far enough in the past, then use another
FLASHBACKDATABASEcommand to rewind the database further back in time:FLASHBACK DATABASE TO SCN 42963; #earlier than current SCN
If you chose a target SCN that is too far in the past, then use
RECOVERDATABASEUNTILto wind the database forward in time to the desired SCN:RECOVER DATABASE UNTIL SCN 56963; #later than current SCN
If you want to completely undo the effect of the
FLASHBACKDATABASEcommand, then you can perform complete recovery of the database by using theRECOVERDATABASEcommand without anUNTILclause orSET UNTILcommand:RECOVER DATABASE;
The
RECOVER DATABASEcommand reapplies all changes to the database, returning it to the most recent SCN.
Oracle Flashback Database的更多相关文章
- ORACLE FLASHBACK DATABASE 知识整理
1.知识储备 1) 只有SYSDBA有权执行,闪回前一定要记录当前SCN 2) 需要停机,并要求处于ARCHIVELOG模式中 3) 闪回日志不能被复用和归档,是自动管理的.RVWR ...
- oracle flashback
一.Flashback闪回技术概述:当Oracle数据库发生逻辑错误时,必须使用flashback技术,实现快速和方便的恢复数据.对于人为错误,要确定受到错误事务影响的对象或者记录是非常困难的.使用f ...
- 跨数据文件删除flashback database
Oracle flashback database的使用有一些限制,其中最主要的是flashback database不支持跨数据文件删除闪回和不支持跨数据文件shrink闪回.对于已经删除的数据文件 ...
- Oracle 闪回特性(FLASHBACK DATABASE)
--===================================== -- Oracle 闪回特性(FLASHBACK DATABASE) --======================= ...
- Oracle 闪回归档(Flashback Database)
cmd --管理员身份打开 sqlplus / as sysdba --管理数据库 shu immediate; --独占方式开始 startup mount --修改日期模式 alter datab ...
- Oracle Flashback 闪回
Oracle 的闪回技术是一种数据恢复技术,仅能对用户逻辑错误进行恢复, 闪回针对的是提交commit的事务,没有提交的事务,使用rollback 1.闪回版本查询 Flashback Version ...
- Oracle Flashback Technologies - 估算不同时间段闪回日志的产生量
Oracle Flashback Technologies - 估算不同时间段闪回日志的产生量 v$flashback_database_stat监控闪回数据的i/o开销的统计信息,根据之前的系统负载 ...
- Oracle Flashback Technologies - 闪回数据库
Oracle Flashback Technologies - 闪回数据库 根据指定的SCN,使用rman闪回数据库 #查看可以闪回到多久前 SQL> select * from v$flash ...
- Oracle Flashback Technologies (总)
Oracle Flashback Technologies Oracle 9i中增加了闪回查询技术,闪回查询为数据库提供了一种简单.强大.完全无干扰从人为错误中恢复的机制.通过闪回查询,用户可以查看过 ...
随机推荐
- 使用mysql的source批量导入多个sql文件
需求: 有一个文件,文件里面包含100多个sql文件,想要把这些sql文件都导入到mysql中 做法: 使用 mysql 的 source 可以将文件导入到 mysql 中,但是一次只能导入一个 sq ...
- application详解
Application对象是HttpApplicationState类的一个实例,Application状态是整个应用程序全局的.本文主要详细介绍Application对象的用法. 一.全局应用程序类 ...
- Chrome开发者工具详解(四)之Elements、Console、Sources面板
Elements面板 实时编辑DOM节点和CSS样式 双击DOM树视图里面的节点,可以实时编辑标签属性,修改的效果会立刻反应在浏览器里 点击右侧Style面板,可以实时修改CSS的属性值,这里面的所有 ...
- 【学习总结】快速上手Linux玩转典型应用-目录
内容链接 慕课网:快速上手Linux玩转典型应用 目录 第1章-课程介绍 第2章-linux简介 第3章-CentOS的安装 第4章-准备工作 第5章-远程连接SSH专题 第6章-linux常用命令讲 ...
- Postgresql重安装报错The database cluster initialisation failed.
之前安装过PostgreSQL-9.6.5,卸载后,重装PostgreSQL-9.1.3版本,报错. 清除注册表,删除postgres账户,清除垃圾后,再次安装仍然报错. 最后改变默认安装路径,神奇的 ...
- mysql常见函数及其用例
函数调用:select 函数名(实参列表) [from 表]; 函数分类: 1.单行函数 如 concat.length.ifnull等. 2.分组函数 功能:做统计使用,又称为统计函数.聚合函数.组 ...
- NOTIFY - 生成一个通知
SYNOPSIS NOTIFY name DESCRIPTION 描述 NOTIFY 命令向当前数据库中所有执行过 LISTEN name, 正在监听特定通知条件的前端应用发送一个通知事件. 传递给前 ...
- L3-002 特殊堆栈 (30 分)
大家都知道“堆栈”是一种“先进后出”的线性结构,基本操作有“入栈”(将新元素插入栈顶)和“出栈”(将栈顶元素的值返回并从堆栈中将其删除).现请你实现一种特殊的堆栈,它多了一种操作叫“查中值”,即返回堆 ...
- bzoj4530 [Bjoi2014]大融合 子树信息 LCT
题目传送门 https://lydsy.com/JudgeOnline/problem.php?id=4530/ 题解 想要求出一条边的负载那么就是要求出一个点为根的时候的另一个点的子树大小. 又因为 ...
- 题解 P3166 【[CQOI2014]数三角形】
做完之后看了看题解,怎么一篇和我思路一样的也没有...我好慌啊qwq(所以一定是窝太弱了看不懂dalao的思路) 好吧窝的方法确实很奇怪: 核心代码只有3行 输入 循环 输出 一气呵成 是题解中的豪杰 ...