开启数据库闪回功能
1、闪回功能必须,设置数据库为归档 SQL> select log_mode from v$database; LOG_MODE ------------------------ NOARCHIVELOG SQL> shutdown immediate; SQL> startup mount; 设置闪回区位置和大小 SQL> show parameter db_recovery NAME TYPE VALUE ---------- --------- ----------- db_recovery_file_dest string +ORAARCH db_recovery_file_dest_size big integer 2G SQL> alter system set db_recovery_file_dest_size=4G; NAME TYPE VALUE ---------- --------- ----------- db_recovery_file_dest_size big integer 4G SQL> alter database archivelog; SQL> alter database open; 2、设置闪回保留目标时间,默认是一天(和db_recovery_file_dest_size设置有关)单位是秒 SQL> show parameter retention_target NAME TYPE VALUE ------------------------------------ ---------------------- ------------------------------ db_flashback_retention_target integer 1440 3、开启闪回功能 SQL> shutdown immediate SQL> alter database flashback on; SQL> alter database open; SQL> select flashback_on from v$database; FLASHBACK_ON ------------------------------------ YES 4、查看闪回相关视图 SQL> select retention_target,flashback_size,oldest_flashback_time from v$flashback_database_log; RETENTION_TARGET FLASHBACK_SIZE OLDEST_FLASHBA ---------------- -------------- -------------- 1440 8192000 22-9月 -15 查看开启闪回付出的代价单位字节 SQL> select end_time,flashback_data,db_data,redo_data from v$flashback_database_stat; END_TIME FLASHBACK_DATA DB_DATA REDO_DATA -------------- -------------- ---------- ---------- 22-9月 -15 8192 0 0 开启flashback功能后OS回多一个rvwr进程 [oracle@localhost ~]$ ps -ef|grep rvwr oracle 30058 1 0 20:01 ? 00:00:00 ora_rvwr_mydb
坚持,专注