暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片

Oracle恢复被drop的表(recyclebin)

原创 末流DBA 云和恩墨 2022-11-19
1317

模拟表被drop的恢复(no purge)。

首先,确保回收站是打开的:

show parameter recyclebin;


回收站未打开,执行以下命令:

alter session set recyclebin=off;(会话级进行修改)


alter system set recyclebin=on deferred;(系统级别,对已连接的会话不受影响,系统级别需要加deferred)

1.创建测试表,索引

create table scott.test as select * from dba_objects; 

create index scott.ind_test_id on scott.test(object_id);

2.删除表,no purge

drop table scott.test;

3.查看回收站内容(当被drop表所在的表空间剩余容量紧张时,被drop表可能会被新的内容覆盖)。

select object_name,original_name,operation,type,ts_name,droptime from user_recyclebin;


4.通过flashback命令恢复被删除的表,用户只能查看自己的回收站。

flashback table "BIN$7dQ8bXlmQjLgVfdRNktiCQ==$0" to before drop rename to TEST;

表和索引都已恢复,回收站中无相关内容。

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论