Home >Database >Mysql Tutorial >Oracle Flashback基础应用

Oracle Flashback基础应用

WBOY
WBOYOriginal
2016-06-07 16:47:301072browse

查看用户是否具有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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn