数据恢复经典文章
(1)show parameter db_recovery;查看oracle闪回恢复目标和恢复区大小
SQL> show parameter db_recovery;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/flash_recovery_area
db_recovery_file_dest_size big integer 2G
(2)show parameter db_flash;查看oracle支持的闪回恢复时长(默认为分钟)
SQL> show parameter db_flash
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target integer 1440
(3)修改oracle支持闪回恢复的时长
SQL> alter system set db_flashback_retention_target=1800 scope=both;
System altered
(4)启用flashback功能
SQL> startup mount
SQL> alter database flashback on;
Database altered.
(5)停止flashback功能
SQL> startup mount
SQL> alter database flashback off;
Database altered.
(6)所有有恢复相关的文件都可以放在闪回区
SQL> select file_type from v$flash_recovery_area_usage;
FILE_TYPE
------------
CONTROLFILE
ONLINELOG
ARCHIVELOG
BACKUPPIECE
IMAGECOPY
FLASHBACKLOG
6 rows selected.
(7)恢复数据表实例一则
SQL> delete from t1;
63 rows deleted.
获取当前的SCN:
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
473229
select count(*) from t1 as of scn 473221;(通过不断尝试丢失数据的scn号,最后发现是在473221这个scn号中丢失的)
insert into t1 select * from t1 as of scn 473221;
(8)查看已经使用的flash空间
SQL> select sum(percent_space_used)*3/100 from v$flash_recovery_area_usage;
SUM(PERCENT_SPACE_USED)*3/100
-----------------------------
.0114
(9)显示回收站中被drop的表(recyclebin相当于windows中的回收站)。
show parameter recyclebin;
如果想不在回收站中留下被删除的表,则直接执行如下语句即可。
drop table emp3 purge;
阅读(2196) | 评论(0) | 转发(0) |