---
title: "Oracle drop表、delete表 恢复操作"
author: "kaobian"
date: "2012-12-03T16:08:17Z"
tags: ["Oracle", "数据库"]
categories: ["数据库"]
slug: "oracle-drop-delete"
draft: false
lastmod: "2012-12-03T16:08:17Z"
id: 1740335
url: "https://kaobian.iteye.com/blog/1740335"
---

**分享这些经验只是为了给 曾经犯过 错误的同学一个 挽救的方法**

第一个问题：drop table，切记没有purge掉

                 恢复的方法是：

                 flashback table tableName to before drop \[ rename to newTableName]

解释：红字是关键字，\[] 代表可选项

 

第二个问题：delete from tableName

                 恢复方法是：

       先查询scn(system change number)号:

                select dbms\_flashback.get\_system\_change\_number from dual;

--需要用户有dbms\_flashback.get\_system\_change\_number 权限；

      根据查询的scn号，一点点往下减少，尝试那个号符合我们删除数据的时间点

                select * from tableName as of scn 13102359953430;

--笔者的13102359953430 是尝试出来的，通过sql查询的值为13102359953436，我一点一点尝试 才知道是这个值