日期:2014-05-16 浏览次数:20404 次
SQL> select log_mode,open_mode,flashback_on from v$database; LOG_MODE OPEN_MODE FLASHBACK_ON ------------ ---------- ------------------ ARCHIVELOG READ WRITE NO --FLASHBACK_ON为NO,则表示闪回特性尚未启用 SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 1 Next log sequence to archive 2 Current log sequence 2 SQL> alter database flashback on; alter database flashback on * ERROR at line 1: ORA-38759: Database must be mounted by only one instance and not open. --可以看到如果要开启闪回,数据库需要启动到MOUNT状态才可以。
SQL> show parameter db_recovery NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_recovery_file_dest string /u01/app/oracle/flash_recovery _area db_recovery_file_dest_size big integer 2G
[co SQL> show parameter db_flashback --缺省为分钟,即小时 NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_flashback_retention_target integer 1440 SQL> alter system set db_flashback_retention_target=30; --设定保留时间为半小时
SQL> alter database flashback on; alter database flashback on * ERROR at line 1: ORA-38759: Database must be mounted by only one instance and not open. --一致性关闭数据库后,在mount状态下设置flashback SQL>startup mount exclusive; SQL> select status from v$instance; STATUS ------------ MOUNTED SQL> alter database flashback on; --开启闪回数据库功能 SQL> ho ps -ef | grep rvw --可以看到新增了后台进程rvwr oracle 3563 1 0 12:12 ? 00:00:00 ora_rvwr_orcl --下面查看闪回区分配的大小为大约M,闪回分钟以内的数据则需要M左右的空间 --注意列oldest_flashback_time说明了允许返回的最早的时间点 SQL> select oldest_flashback_scn old_flhbck_scn,oldest_flashback_time old_flhbck_tim, 2 retention_target rete_trgt,flashback_size/1024/1024 flhbck_siz, 3 estimated_flashback_size/1024/