ITPub博客

首页 > 数据库 > Oracle > 闪回数据库-- Doc ID 249319.1

闪回数据库-- Doc ID 249319.1

翻译 Oracle 作者:lovestanford 时间:2014-04-15 21:52:12 0 删除 编辑

本文介绍了如何配置数据库,使其能进行数据库闪回flashback database,
Flashback database
-----------------------------
- This a new feature introduced in 10g.
- Flashbacking a database means going back to a previous database state.
- The Flashback Database feature provides a way to quickly revert entire
Oracle database to the state it was in at a past point in time.
- This is different from traditional point in time recovery.
- A new background process RVWR introduced which is responsible for writing
flashback logs which stores pre-image(s) of data blocks
- One can use Flashback Database to back out changes that:
- Have resulted in logical data corruptions.
- Are a result of user error.
- This feature is not applicable for recovering the database in case of media
failure.
- The time required for flashbacking a database to a specific time in past is
DIRECTLY PROPORTIONAL to the number of changes made and not on the size
of the database.

How to Configure Flashback database
------------------------------------
Prerequisites 前提条件
--------------
a) Database must be in archivelog mode.
b) Last clean shutdown.
c) Enterprise and Personal Edition required

Configuration: -参数配置
---------------
Initialization Parameters required: -
a) DB_RECOVERY_FILE_DEST (dynamically modifiable) --> Physical location where RVWR background process
writes flashback logs.
b) DB_RECOVERY_FILE_DEST_SIZE (dynamically modifiable) --> Maximum size flashback logs can occupy in
DB_RECOVERY_FILE_DEST.
c) DB_FLASHBACK_RETENTION_TARGET (dynamically modifiable) --> upper limit in minutes on how far back
one can flashback the database.

After setting these parameters in parameter file(init.ora) or spfile.

Note:- Clean shutdown is mandatory.
修改上述参数之后,关闭数据库 shutdown immediate;然后

SQL> Startup mount;

SQL> Alter database flashback on;

SQL> Alter database open;

SQL> select flashback_on from v$database;
FLASHBACK_ON
------------
YES



To see the background process :-

$ ps -eaf | grep rvwr
oracle 10302 1 0 10:58:09 ? 0:00 ora_rvwr_db10g
oracle 22353 12428 1 13:31:16 pts/tL 0:00 grep rvwr



The above two output confirms that the datbase has its flashback feature ON.

如何闪回数据库,
可以指定 scn ,timestamp ,logseq
下面展示了如何进行闪回。
How to Flashback the database to the previous state on basis of :
----------------------------------------------------------------
a) SCN
b) Timestamp
c) Log Sequence Number

State 1 State 2
------- -------
| | >--------------- | |
| | flashback | |
------- -------
SCN=100 SCN=150

Timestamp=12-09-2003:10:00:00 Timestamp=12-09-2003:12:00:00

Log Sequence Number= 50 Log Sequence Number= 55

Using SCN :-
----------

SQL> shutdown immediate
SQL> startup mount
SQL> flashback database to SCN 100;

Flashback complete.

SQL> alter database open resetlogs;

Database altered.



Note:- This feature can be used with RMAN or Enterprise Manager also.

Using Timestamp :-
---------------

SQL> shutdown immediate
SQL> startup mount
SQL> flashback database to TIMESTAMP(sysdate - 2/24);

Flashback complete.

SQL> alter database open resetlogs;

Database altered.



Using Log sequence Number and RMAN
----------------------------------

RMAN> flashback database to sequence=50 thread=1;

RMAN> alter database open resetlogs;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21754115/viewspace-1142821/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-09-27

  • 博文量
    213
  • 访问量
    982959