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中增加了闪回查询技术,闪回查询为数据库提供了一种简单.强大.完全无干扰从人为错误中恢复的机制.通过闪回查询,用户可以查看过 ...
随机推荐
- 高级BASH
Bash介绍与入门 1,简介 Bash(GNU Bourne-Again Shell)是一个为GNU计划编写的Unix shell,它是许多Linux平台默认使用的shell shell是一个命令解释 ...
- Paper Reading_Database
最近(以及预感接下来的一年)会读很多很多的paper......不如开个帖子记录一下读paper心得 AI+DB A. Pavlo et al., Self-Driving Database Engi ...
- mysql中的substring()截取字符函数
substring(参数1,参数2,参数3),其中三个参数分别表示:参数1表示需要截取的字符串,参数2表示从字符串的那个位置开始截取(字符串下标从1开始),参数3表示要截取多少位,如果不写,表示截取从 ...
- 吴恩达深度学习:2.9逻辑回归梯度下降法(Logistic Regression Gradient descent)
1.回顾logistic回归,下式中a是逻辑回归的输出,y是样本的真值标签值 . (1)现在写出该样本的偏导数流程图.假设这个样本只有两个特征x1和x2, 为了计算z,我们需要输入参数w1.w2和b还 ...
- webpack收藏
收藏链接: https://www.jianshu.com/p/8ff8e71dcbc6
- 表格变色示例中发现的问题——attr()与prop()
在练习jQuery表格变色例子过程中,发现了一下几个问题: 在IEEdge浏览器中切换选中行会出现上一个表格行背景色被吃掉的情况: 在chrome中从上向下单击行中任意单元可以选中该行,而从下往上单击 ...
- Hive内部表,外部表和分区表
外部表和内部表的区别 内部表也称之为managed_table: 默认存储在/user/hive/warehouse下,也可以通过location指定: 删除表事,会删除表数据以及元数据: 外部表称之 ...
- MySQL事务提交与回滚
提交 为了演示效果,需要打开两个终端窗口,使用同一个数据库,操作同一张表 step1:连接 终端1:查询商品分类信息 select * from goods_cates; step2:增加数据 终端2 ...
- octave - 用于数值计算的高级交互式语言
SYNOPSIS 总览 octave [options] OPTIONS 选项 octave 全部命令行选项可以通过运行命令 octave --help 来查看. DESCRIPTION 描述 Oct ...
- Python自动化学习--元素定位
from selenium import webdriver import time driver = webdriver.Chrome() driver.get("https://www. ...