閃回之 回收站、Flashback Drop (table、index、trigger等)
一: Flashback Drop 操作流程
模式一:drop table 後未新建同名表
SQL> create table flashdrop as select * from user_objects;
Table created.
SQL> create bitmap index ind_flashdrop on flashdrop(object_type);
Index created.
SQL> drop table flashdrop;
Table dropped.
--檢視 recyclebin 內的物件
SQL> select original_name,object_name,type,droptime from recyclebin;
ORIGINAL_NAME OBJECT_NAME TYPE DROPTIME
-------------------------------- ------------------------------ ------------------------- -------------------
IND_FLASHDROP BIN$ESs42vP2YC3gUw0ZZAqeww==$0 INDEX 2015-03-13:08:08:19
FLASHDROP BIN$ESs42vP3YC3gUw0ZZAqeww==$0 TABLE 2015-03-13:08:08:19
SQL> flashback table flashdrop to before drop;
Flashback complete.
SQL> select original_name,object_name,type,droptime from recyclebin;
no rows selected
--檢視索引名字
SQL> col column_name for a40
SQL> SELECT index_name, column_name, descend FROM user_ind_columns WHERE table_name = 'FLASHDROP';
INDEX_NAME COLUMN_NAME DESC
------------------------------ ---------------------------------------- ----
BIN$ESs42vP2YC3gUw0ZZAqeww==$0 OBJECT_TYPE ASC
--索引改為原來的名字 (說明 閃回表 後,即使未給索引重新命名,執行計劃依然可以走索引)
SQL> alter index "BIN$ESs42vP2YC3gUw0ZZAqeww==$0" rename to IND_FLASHDROP;
Index altered.
--檢視是否成功改名
SQL> SELECT index_name, column_name, descend FROM user_ind_columns WHERE table_name = 'FLASHDROP';
INDEX_NAME COLUMN_NAME DESC
------------------------------ ---------------------------------------- ----
IND_FLASHDROP OBJECT_TYPE ASC
SQL> select count(*) from flashdrop;
COUNT(*)
----------
11
補充:
--檢視錶約束名
select CONSTRAINT_NAME,TABLE_NAME, COLUMN_NAME from user_cons_columns where TABLE_NAME='FLASHDROP';
模式二:drop table 後新建同名表
SQL> drop table flashdrop;
Table dropped.
SQL> create table flashdrop as select * from user_objects;
Table created.
SQL> select original_name,object_name,type,droptime from recyclebin;
ORIGINAL_NAME OBJECT_NAME TYPE DROPTIME
-------------------------------- ------------------------------ ------------------------- -------------------
IND_FLASHDROP BIN$ESs42vP4YC3gUw0ZZAqeww==$0 INDEX 2015-03-13:08:25:37
FLASHDROP BIN$ESs42vP5YC3gUw0ZZAqeww==$0 TABLE 2015-03-13:08:25:37
SQL> flashback table flashdrop to before drop;
flashback table flashdrop to before drop
*
ERROR at line 1:
ORA-38312: original name is used by an existing object
SQL> flashback table flashdrop to before drop rename to flashtable;
Flashback complete.
SQL> select original_name,object_name,type,droptime from recyclebin;
no rows selected
SQL> select count(*) from flashtable;
COUNT(*)
----------
11
模式三:drop table 後新建同名表,再 drop 新同名表
SQL> select count(*) from flashdrop;
COUNT(*)
----------
13
SQL> drop table flashdrop;
Table dropped.
SQL> create table flashdrop as select * from user_objects;
Table created.
SQL> insert into flashdrop(object_name) values('andy');
1 row created.
SQL> select count(*) from flashdrop;
COUNT(*)
----------
14
SQL> drop table flashdrop;
Table dropped.
SQL> select original_name,object_name,type,droptime from recyclebin;
ORIGINAL_NAME OBJECT_NAME TYPE DROPTIME
-------------------------------- ------------------------------ ------------------------- -------------------
FLASHDROP BIN$ESs42vP9YC3gUw0ZZAqeww==$0 TABLE 2015-03-13:08:42:21
FLASHDROP BIN$ESs42vP+YC3gUw0ZZAqeww==$0 TABLE 2015-03-13:08:56:16
SQL> select count(*) from "BIN$ESs42vP9YC3gUw0ZZAqeww==$0";
COUNT(*)
----------
13
SQL> select count(*) from "BIN$ESs42vP+YC3gUw0ZZAqeww==$0";
COUNT(*)
----------
14
SQL> flashback table "BIN$ESs42vP+YC3gUw0ZZAqeww==$0" to before drop;
Flashback complete.
SQL> select count(*) from flashdrop;
COUNT(*)
----------
14
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31383567/viewspace-2132366/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Flashback Drop閃回刪除功能實踐(基於回收站)
- 【Flashback】Flashback Drop閃回刪除功能實踐
- Flashback Drop閃回刪除功能實踐
- 【Flashback】使用Flashback Drop技術閃回被DROP表的指定版本資料
- 閃回之 Flashback Query (dml表、過程、函式、包等)、Flashback version Query函式
- Oracle回收站及flashback drop(上)Oracle
- Oracle回收站及flashback drop(下)Oracle
- flashback drop/query/table/database/archiveDatabaseHive
- 【FLASHBACK】Oracle閃回及回收站相關語句參考Oracle
- Oracle10g 回收站及徹底刪除table : drop table xx purge 以及flashbackOracle
- [閃回特性之閃回版本查詢]Flashback Version Query
- oracle 閃回 flashbackOracle
- flashback技術之---flashback drop
- FlashBack總結之閃回資料庫與閃回刪除資料庫
- Flashback閃回技術
- 【閃回特性之閃回事務查詢】Flashback Transaction Query
- oracle flashback特性(1.2)--閃回查詢之As of scnOracle
- flashback總結三之Flashback_DROP
- flashback query閃回資料
- Flashback Query閃回查詢
- Oracle 閃回特性(FLASHBACK DATABASE)OracleDatabase
- flashback技術之---flashback table
- oracle flashback特性(1.1)--閃回查詢之As of timestampOracle
- oracle flashback特性(1.4)--閃回查詢之Transaction queryOracle
- [Flashback]Flashback Database閃回資料庫實驗Database資料庫
- Flashback Database 閃回資料庫Database資料庫
- 【Mysql】mysql閃回flashback-5.7MySql
- Oracle10g 回收站及徹底刪除table : drop table xx purge 以及drop flashOracle
- 【Flashback】Flashback Database閃回資料庫功能實驗Database資料庫
- 【Flashback】啟用Flashback Database閃回資料庫功能Database資料庫
- 【Flashback】Flashback Database閃回資料庫功能實踐Database資料庫
- oracle flashback特性(1.5)--閃回查詢之制約因素Oracle
- Backup And Recovery User's Guide-使用閃回刪除來回退DROP TABLE操作GUIIDE
- oracle flashback特性(2.1)--Flashback Table之RECYCLEBINOracle
- 利用flashback閃回表和資料
- Oracle閃回技術--Flashback Version QueryOracle
- flashback閃回技術應用解析
- 開啟oracle的flashback閃回功能Oracle