首页 > Linux操作系统 > Linux操作系统 > Flashback database 和flash recovery area的关系(收藏)

Flashback database 和flash recovery area的关系(收藏)

原创 Linux操作系统 作者:zzhen163 时间:2008-12-12 16:36:46 0 删除 编辑
Flashback database 和flash recovery area的关系?

Flashback Database uses its own logging mechanism, creating flashback
logs which are stored in the flash recovery area. You can only use
Flashback Database if flashback logs are available. Therefore, you
must set up your database in advance to create flashback logs if you
want to take advantage of this feature.To enable Flashback Database, you set up a flash recovery area, and set a flashback retention target, to specify how far back into the
past you want to be able to restore your database with Flashback
Database.From that time on, at regular intervals, the database copies images
of each altered block in every datafile into the flashback logs.
These block images can later be reused to reconstruct the datafile
contents as of any moment at which logs were captured.When a database is restored to its state at some past target time using Flashback Database, each block changed since that time is
restored from the copy of the block in the flashback logs most
immediately prior to the desired target time. The redo log is then
used to re-apply changes since the time that block was copied to the
flashback logs.

2.  如何启用flashback database?

SQL>select flashback_on from v$database;
SQL>show parameter db_recovery_file_dest
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /data5/flash_recovery_area
db_recovery_file_dest_size           big integer 10G
SQL >show parameter db_flashback_retention_target
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target        integer     60
SQL>alter system set db_flashback_retention_target=1440;
System altered.
4.重新启动数据库到Mount状态,启动flashback database选项。
  shutdown immediate;
 startup mount ; 
shutdown immediate;
startup mount exclusive;
alter system set db_flashback_retention_target=1440;
alter system set db_recovery_file_dest='/u01/app/oracle/flash_recovery_area';
alter system set db_recovery_size=15G;

SQL >shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>startup mount;
ORACLE instance started.

Total System Global Area  314572800 bytes
Fixed Size                  1301704 bytes
Variable Size             261890872 bytes
Database Buffers           50331648 bytes
Redo Buffers                1048576 bytes
Database mounted.
SQL>alter database flashback on;
Database altered.

SQL >alter database open;

Database altered.

5.flashback database:
(1) 关闭数据库并启动到mount状态
shutdown immediate;
startup mount ;
(2) flashback database
flashback database to timestamp/scn...;
(3) open resetlogs
alter database open resetlogs;

6、监控flashback log area:
(1) 监控flashback log空间占用情况
select retention_target, flashback_size,estimated_flashback_size from v$flashback_database_log;
(2) 监控过去24小时内每小时flashback日志、redo日志及data block读写量
select to_char(end_time,'yyyy-mm-dd hh:miAM') end_timestamp,flashback_data, db_data, redo_data from v$flashback_database_stat;
(3) 监控flash recovery area情况
select name, space_limit max_size, space_used used, space_reclaimable obsolete,number_of_files num_files from v$recovery_file_dest;

 3.如何设置flash recovery area,涉及到那些参数?

(3).db_flashback_retention_target:指定数据库可以回退的时间,单位为分钟,默认1440分钟,也就是一天。当然,实际上可回退的时间还决定于闪回恢复区的大小,因为里面保存了回退所需要的flash log。所以这个参数要和db_recovery_file_dest_size配合修改。
alter system set db_flashback_retention_target=1440;
alter system set db_recovery_file_dest='/u01/app/oracle/flash_recovery_area';
alter system set db_recovery_size=15G; 

来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量