导出误截断(truncate)的表
当表被TRUNCATE后,数据仍然存在于表空间中,可以通过GDUL恢复。具体步骤如下:
1
查看表所在的表空间,分区表可以用FULL选项查看
GDUL> desc andy.t_test
终端输出
object_id: 108775, dataobj#: 112379, cluster tab#: 0 segment header: (ts#: 7, rfile#: 5, block#: 562) …
2
扫描表空间
GDUL> scan tablespace 7
终端输出
start scan tablespace 7... scan tablespace completed
说明:如果磁盘性能较好,且表空间下有多个数据文件,可以采用并行方式:
GDUL> scan tablespace 7 parallel 10
3
导出truncated的行
以下仅演示truncate后无新数据进来的情况:
GDUL> untrunc table andy.t_test
终端输出
2016-02-18 15:04:03...untruncating table T_TEST 99998 rows unloaded.
