{"id":1289,"date":"2019-06-21T09:03:52","date_gmt":"2019-06-21T01:03:52","guid":{"rendered":"http:\/\/www.hefeiyu.com\/?p=1289"},"modified":"2019-06-21T09:03:52","modified_gmt":"2019-06-21T01:03:52","slug":"oracle%e6%95%b0%e6%8d%ae%e5%ba%93%e8%af%af%e5%88%a0%e7%9a%84%e8%a1%a8%e4%bb%a5%e5%8f%8a%e8%a1%a8%e4%b8%ad%e8%ae%b0%e5%bd%95%e7%9a%84%e6%81%a2%e5%a4%8d","status":"publish","type":"post","link":"https:\/\/www.hefeiyu.com\/?p=1289","title":{"rendered":"oracle\u6570\u636e\u5e93\u8bef\u5220\u7684\u8868\u4ee5\u53ca\u8868\u4e2d\u8bb0\u5f55\u7684\u6062\u590d"},"content":{"rendered":"<p>\u4e00\u3001\u8868\u7684\u6062\u590d<br \/>\n\u5bf9\u8bef\u5220\u7684\u8868\uff0c\u53ea\u8981\u6ca1\u6709\u4f7f\u7528PURGE\u6c38\u4e45\u5220\u9664\u9009\u9879\uff0c\u90a3\u4e48\u4eceflash back\u533a\u6062\u590d\u56de\u6765\u5e0c\u671b\u662f\u633a\u5927\u7684\u3002\u4e00\u822c\u6b65\u9aa4\u6709\uff1a<br \/>\n1\u3001\u4eceflash back\u91cc\u67e5\u8be2\u88ab\u5220\u9664\u7684\u8868<br \/>\nselect * from recyclebin<br \/>\n2\u3001\u6267\u884c\u8868\u7684\u6062\u590d<br \/>\nflashback table tbName to before drop; \u8fd9\u91cc\u7684tbName\u4ee3\u8868\u4f60\u8981\u6062\u590d\u7684\u8868\u7684\u540d\u79f0\u3002<br \/>\n\u4e8c\u3001\u8868\u6570\u636e\u6062\u590d<br \/>\n\u5bf9\u8bef\u5220\u7684\u8868\u8bb0\u5f55\uff0c\u53ea\u8981\u6ca1\u6709truncate\u8bed\u53e5\uff0c\u5c31\u53ef\u4ee5\u6839\u636e\u4e8b\u52a1\u7684\u63d0\u4ea4\u65f6\u95f4\u8fdb\u884c\u9009\u62e9\u6062\u590d\uff0c\u4e00\u822c\u6b65\u9aa4\u6709\uff1a<br \/>\n1\u3001\u5148\u4eceflashback_transaction_query\u89c6\u56fe\u91cc\u67e5\u8be2\uff0c\u89c6\u56fe\u63d0\u4f9b\u4e86\u4f9b\u67e5\u8be2\u7528\u7684\u8868\u540d\u79f0\u3001\u4e8b\u52a1\u63d0\u4ea4\u65f6\u95f4\u3001UNDO_SQL\u7b49\u5b57\u6bb5\u3002<br \/>\n\u5982\uff1aselect * from flashback_transaction_query where table_name=&#8217;TEST&#8217;;<br \/>\n2\u3001\u6267\u884c\u8868\u8bb0\u5f55\u6062\u590d<br \/>\n\u4e00\u822c\u5148\u6839\u636e\u65f6\u95f4\u8fdb\u884c\u67e5\u8be2\uff0c\u67e5\u8be2\u8bed\u53e5\u6a21\u5f0f\u4e3a<br \/>\nselect * from tb as of timestamp to_timestamp(time,&#8217;yyyy-mm-dd hh24:mi:ss&#8217;); tb\u6307\u8868\u540d\u79f0\uff0ctime\u6307\u67d0\u4e2a\u65f6\u95f4\u70b9<br \/>\n\u5982select * from scott.test as of timestamp to_timestamp(&#8216;2009-12-11 20:53:57&#8242;,&#8217;yyyy-mm-dd hh24:mi:ss&#8217;);<br \/>\n\u82e5\u6709\u6570\u636e\uff0c\u6062\u590d\u6781\u4e3a\u7b80\u5355\u4e86\uff0c\u8bed\u53e5\u4e3a<br \/>\nflashback table tb to timestamp to_timestamp(time,&#8217;yyyy-mm-dd hh24:mi:ss&#8217;);<br \/>\n\u5982flashback table scott.test to timestamp to_timestamp(&#8216;2009-12-11 20:47:30&#8242;,&#8217;yyyy-mm-dd hh24:mi:ss&#8217;);<\/p>\n<p>\u6ce8\u610f:alter table testvarchar enable row movement;<br \/>\n\u8fd9\u4e2a\u547d\u4ee4\u7684\u4f5c\u7528\u662f\uff0c\u5141\u8bb8Oracle \u4fee\u6539\u5206\u914d\u7ed9\u884c\u7684rowid\u3002\u5728Oracle \u4e2d\uff0c\u63d2\u5165\u4e00\u884c\u65f6\u5c31\u4f1a\u4e3a\u5b83\u5206\u914d\u4e00\u4e2arowid\uff0c\u800c\u4e14\u8fd9\u4e00\u884c\u6c38\u8fdc\u62e5\u6709\u8fd9\u4e2arowid\u3002\u95ea\u56de\u8868\u5904\u7406\u4f1a\u5bf9EMP \u5b8c\u6210DELETE\uff0c\u5e76\u4e14\u91cd\u65b0\u63d2\u5165\u884c\uff0c\u8fd9\u6837\u5c31\u4f1a\u4e3a\u8fd9\u4e9b\u884c\u5206\u914d\u4e00\u4e2a\u65b0\u7684rowid\u3002\u8981\u652f\u6301\u95ea\u56de\u5c31\u5fc5\u987b\u5141\u8bb8Oracle \u6267\u884c\u8fd9\u4e2a\u64cd\u4f5c<\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/www.hefeiyu.com\">\u8d6b\u975e\u57df<\/a> &raquo; <a href=\"https:\/\/www.hefeiyu.com\/?p=1289\">oracle\u6570\u636e\u5e93\u8bef\u5220\u7684\u8868\u4ee5\u53ca\u8868\u4e2d\u8bb0\u5f55\u7684\u6062\u590d<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u8868\u7684\u6062\u590d \u5bf9\u8bef\u5220\u7684\u8868\uff0c\u53ea\u8981\u6ca1\u6709\u4f7f\u7528PURGE\u6c38\u4e45\u5220\u9664\u9009\u9879\uff0c\u90a3\u4e48\u4eceflash back\u533a\u6062\u590d\u56de\u6765\u5e0c\u671b\u662f\u633a\u5927\u7684\u3002\u4e00\u822c\u6b65\u9aa4\u6709\uff1a 1\u3001\u4eceflash back\u91cc\u67e5\u8be2\u88ab\u5220\u9664\u7684\u8868 select * from recyclebin 2\u3001\u6267\u884c\u8868\u7684\u6062\u590d flashb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[445,446,443],"class_list":["post-1289","post","type-post","status-publish","format-standard","hentry","category-unix","tag-flashback","tag-446","tag-443"],"_links":{"self":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/1289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1289"}],"version-history":[{"count":1,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/1289\/revisions"}],"predecessor-version":[{"id":1290,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/1289\/revisions\/1290"}],"wp:attachment":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}