如题所述
æ¹æ³ä¸ï¼
1.æå¼Flashåå¨çæé
ALTER TABLE tableName ENABLE row movement ;
2.æ表è¿åå°æå®æ¶é´ç¹
flashback table tableName to timestamp to_timestamp('2018-03-16 10:40:00','yyyy-mm-dd hh24:mi:ss');
åé¢çåæ°ä¸ºè¦è¿åçæ¶é´ç¹
æ¹æ³äºï¼
å©ç¨ORacleçå¿«ç §è¿è¡æ¥æ¾æ个æ¶é´ç¹çæ°æ®
s e l e c t * from tableName AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '100' MINUTE)
æ
s e l e c t * from tableName as of timestamp to_timestamp('2018-03-16 11:40:00','YYYY-MM-DD HH24:MI:SS');
è¿æ ·å¯ä»¥æ¥è¯¢å°æå®çæ¶é´æ®µçæ°æ®ï¼åææ¥è¯¢å°çæ°æ®å¤å¶å°åæ¥ç表ä¸ã
æ¹æ³ä¸ï¼
å é¤è¡¨åï¼å¯ä»¥éç¨å¦ä¸æä½ï¼å¨ æ¥è¯¢è¡¨user_recyclebinæè¿æä½è¿ç表å称ï¼ç¶åç¨éªåï¼åªè½ç¨äº10Gå以ä¸çæ¬ï¼ã
s e l e c t * from user_recyclebin;
FLASHBACK TABLE TABLE_NAME TO BEFORE DROP;
å¦ææ¯å äºæä¿®æ¹éé¢çæ°æ®ï¼å¯ä»¥å 建ç«ä¸ä¸ªå¿«è¡¨å°å é¤ä¿®æ¹ä¹åç¶æçæ°æ®æ¾åå°è¿ä¸ªè¡¨ä¸ï¼
CREATE TABLE QUICK_TABLE AS SELECT * FROM TABLE_NAME AS OF TIMESTAMP SYSTEM-1/24 (ä¸å°æ¶åç)ï¼åå»çæ¶é´å¯ä»¥èªå·±å®ã
æ¹æ³åï¼
SCNæä¾äºOracleçå é¨æ¶éæºå¶ï¼å¯è¢«çä½é»è¾æ¶éï¼è¿å¯¹äºæ¢å¤æä½æ¯è³å ³éè¦ç
注éï¼Oracle ä» æ ¹æ® SCN æ§è¡æ¢å¤ã
å®å®ä¹äºæ°æ®åºå¨æ个确åæ¶å»æ交ççæ¬ãå¨äºç©æ交æ¶ï¼å®è¢«èµäºä¸ä¸ªå¯ä¸çæ 示äºç©çSCN ãä¸äºäººè®¤ä¸º SCN æ¯æï¼ System Commit Number ï¼èé常 SCN å¨æ交æ¶æååï¼æ以å¾å¤æ åµä¸ï¼è¿ä¸¤ä¸ªåè¯ç»å¸¸è¢«äº¤æ¿ä½¿ç¨ã
究ç«æ¯åªä¸ªè¯å ¶å®å¯¹æ们æ¥è¯´å¹¶ä¸æ¯æéè¦çï¼éè¦çæ¯æ们ç¥é SCN æ¯ Oracle å é¨çæ¶éæºå¶ï¼ Oracle éè¿ SCN æ¥ç»´æ¤æ°æ®åºçä¸è´æ§ï¼å¹¶éè¿SCN å®æ½ Oracle è³å ³éè¦çæ¢å¤æºå¶ã
1.æå¼Flashåå¨çæé
ALTER TABLE tableName ENABLE row movement ;
2.æ表è¿åå°æå®æ¶é´ç¹
flashback table tableName to timestamp to_timestamp('2018-03-16 10:40:00','yyyy-mm-dd hh24:mi:ss');
åé¢çåæ°ä¸ºè¦è¿åçæ¶é´ç¹
æ¹æ³äºï¼
å©ç¨ORacleçå¿«ç §è¿è¡æ¥æ¾æ个æ¶é´ç¹çæ°æ®
s e l e c t * from tableName AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '100' MINUTE)
æ
s e l e c t * from tableName as of timestamp to_timestamp('2018-03-16 11:40:00','YYYY-MM-DD HH24:MI:SS');
è¿æ ·å¯ä»¥æ¥è¯¢å°æå®çæ¶é´æ®µçæ°æ®ï¼åææ¥è¯¢å°çæ°æ®å¤å¶å°åæ¥ç表ä¸ã
æ¹æ³ä¸ï¼
å é¤è¡¨åï¼å¯ä»¥éç¨å¦ä¸æä½ï¼å¨ æ¥è¯¢è¡¨user_recyclebinæè¿æä½è¿ç表å称ï¼ç¶åç¨éªåï¼åªè½ç¨äº10Gå以ä¸çæ¬ï¼ã
s e l e c t * from user_recyclebin;
FLASHBACK TABLE TABLE_NAME TO BEFORE DROP;
å¦ææ¯å äºæä¿®æ¹éé¢çæ°æ®ï¼å¯ä»¥å 建ç«ä¸ä¸ªå¿«è¡¨å°å é¤ä¿®æ¹ä¹åç¶æçæ°æ®æ¾åå°è¿ä¸ªè¡¨ä¸ï¼
CREATE TABLE QUICK_TABLE AS SELECT * FROM TABLE_NAME AS OF TIMESTAMP SYSTEM-1/24 (ä¸å°æ¶åç)ï¼åå»çæ¶é´å¯ä»¥èªå·±å®ã
æ¹æ³åï¼
SCNæä¾äºOracleçå é¨æ¶éæºå¶ï¼å¯è¢«çä½é»è¾æ¶éï¼è¿å¯¹äºæ¢å¤æä½æ¯è³å ³éè¦ç
注éï¼Oracle ä» æ ¹æ® SCN æ§è¡æ¢å¤ã
å®å®ä¹äºæ°æ®åºå¨æ个确åæ¶å»æ交ççæ¬ãå¨äºç©æ交æ¶ï¼å®è¢«èµäºä¸ä¸ªå¯ä¸çæ 示äºç©çSCN ãä¸äºäººè®¤ä¸º SCN æ¯æï¼ System Commit Number ï¼èé常 SCN å¨æ交æ¶æååï¼æ以å¾å¤æ åµä¸ï¼è¿ä¸¤ä¸ªåè¯ç»å¸¸è¢«äº¤æ¿ä½¿ç¨ã
究ç«æ¯åªä¸ªè¯å ¶å®å¯¹æ们æ¥è¯´å¹¶ä¸æ¯æéè¦çï¼éè¦çæ¯æ们ç¥é SCN æ¯ Oracle å é¨çæ¶éæºå¶ï¼ Oracle éè¿ SCN æ¥ç»´æ¤æ°æ®åºçä¸è´æ§ï¼å¹¶éè¿SCN å®æ½ Oracle è³å ³éè¦çæ¢å¤æºå¶ã
温馨提示:答案为网友推荐,仅供参考