当前位置:Gxlcms > mysql > OracleFlashback基础应用

OracleFlashback基础应用

时间:2021-07-01 10:21:17 帮助过:27人阅读

查看用户是否具有Flashback权限 select * from session_privs where privilege like

查看用户是否具有Flashback权限
select * from session_privs where privilege like 'FLASHBACK%';

授予用户Flashback权限
grant flashback any table to test;

恢复刚才删除的一条数据
alter database add supplemental log data;
delete from dept where dname='IT';
commit;
select * from dept where dname='IT';

查看操作,并使用undo_sql恢复
select t.start_timestamp,t.commit_timestamp,t.logon_user,t.operation,t.table_name,t.table_owner,t.undo_sql from flashback_transaction_query t where table_name='DEPT';

基于时间段恢复
update dept set dname='china';
select * from dept;
commit;

开启对应表的行移动,并使用基于时间段的闪回(10分钟)
alter table dept enable row movement;
flashback table dept to timestamp to_timestamp(sysdate-10/(24*60));

恢复删除的表
drop table dept;
flashback table dept to before drop;

查看回收站
select * from user_recyclebin order by droptime desc;

linux

人气教程排行