{"id":13,"date":"2015-11-21T14:16:51","date_gmt":"2015-11-21T06:16:51","guid":{"rendered":"http:\/\/101.200.238.115\/lisq\/?p=13"},"modified":"2015-11-21T15:51:14","modified_gmt":"2015-11-21T07:51:14","slug":"%e8%a1%8c%e7%9a%84%e9%93%be%e6%8e%a5%e4%b8%8e%e8%a1%8c%e7%9a%84%e8%bf%81%e7%a7%bb","status":"publish","type":"post","link":"https:\/\/www.lisq.net\/?p=13","title":{"rendered":"\u884c\u7684\u94fe\u63a5\u4e0e\u884c\u7684\u8fc1\u79fb"},"content":{"rendered":"<p>\u884c\u7684\u94fe\u63a5:\u662f\u8868\u7ed3\u6784\u8bbe\u8ba1\u95ee\u9898(\u8868\u592a\u5bbd)\uff01\u4e0d\u53ef\u6d88\u9664\uff01\u5c06\u8868\u5782\u76f4\u5206\u5272\uff01<\/p>\n<p>\u884c\u7684\u8fc1\u79fb:insert<\/p>\n<p>char(20) &#8211;&gt;<\/p>\n<p>drop table t purge;<br \/>\ncreate table t (x varchar2(20));<\/p>\n<p>begin<br \/>\nfor i in 1..1000 loop<br \/>\ninsert into t values (&#8216;A&#8217;);<br \/>\nend loop;<br \/>\ncommit;<br \/>\nend;<br \/>\n\/<\/p>\n<p>\u6536\u96c6\u5bf9\u8c61\u7684\u7edf\u8ba1\u4fe1\u606f:<br \/>\nanalyze table t compute statistics;<\/p>\n<p>\u67e5\u770b\u7edf\u8ba1\u4fe1\u606f:<br \/>\nselect TABLE_NAME,BLOCKS,EMPTY_BLOCKS,NUM_ROWS,AVG_ROW_LEN,CHAIN_CNT<br \/>\nfrom user_tables where table_name=&#8217;T&#8217;;<\/p>\n<p>TABLE_NAME BLOCKS EMPTY_BLOCKS NUM_ROWS AVG_ROW_LEN CHAIN_CNT<br \/>\n&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;-<br \/>\nT 5 3 1000 5 0 &#8211;\u6ca1\u6709\u8fc1\u79fb<\/p>\n<p>\u66f4\u65b0\u8868\u4ea7\u751f\u8fc1\u79fb:<br \/>\nupdate t set x=&#8217;AAAAAAAAAAAAAAAAAAAA&#8217;;<br \/>\ncommit;<\/p>\n<p>\u91cd\u65b0\u6536\u96c6\u5bf9\u8c61\u7684\u7edf\u8ba1\u4fe1\u606f:<br \/>\nanalyze table t compute statistics;<\/p>\n<p>select TABLE_NAME,BLOCKS,EMPTY_BLOCKS,NUM_ROWS,AVG_ROW_LEN,CHAIN_CNT from user_tables where table_name=&#8217;T&#8217;;<\/p>\n<p>TABLE_NAME BLOCKS EMPTY_BLOCKS NUM_ROWS AVG_ROW_LEN CHAIN_CNT<br \/>\n&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;-<br \/>\nT 13 3 1000 28 659&#8211;\u4ea7\u751f\u8fc1\u79fb<\/p>\n<p>\u6d88\u9664\u8fc1\u79fb:<br \/>\n1.exp &#8211;&gt; drop &#8211;&gt; imp<br \/>\n2.alter table t move; &#8211;&gt;\u7d22\u5f15\u5168\u5931\u6548&#8211;&gt;alter index xxxx rebuild;<br \/>\n3.\u627e\u5230\u8fc1\u79fb\u7684\u884c\u5bfc\u51fa\uff0c\u5220\u9664\uff0c\u5bfc\u5165<br \/>\n@?\/rdbms\/admin\/utlchain &#8211;&gt;create table chained_rows ();<\/p>\n<p>\u4f7f\u7528\u5206\u6790\u547d\u4ee4\u5c06\u4ea7\u751f\u8fc1\u79fb\u7684\u884c\u7684rowid\u63d2\u5165\u5230chained_rows\u8868:<br \/>\nanalyze table t list chained rows into chained_rows;<\/p>\n<p>create table tmp as select * from t where rowid in (select head_rowid from chained_rows);<br \/>\ndelete t where rowid in (select head_rowid from chained_rows);<br \/>\ninsert into t select * from tmp;<br \/>\ndrop table tmp purge;<br \/>\nanalyze table t compute statistics;<br \/>\nselect TABLE_NAME,BLOCKS,EMPTY_BLOCKS,NUM_ROWS,AVG_ROW_LEN,CHAIN_CNT<br \/>\nfrom user_tables where table_name=&#8217;T&#8217;;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u884c\u7684\u94fe\u63a5:\u662f\u8868\u7ed3\u6784\u8bbe\u8ba1\u95ee\u9898(\u8868\u592a\u5bbd)\uff01\u4e0d\u53ef\u6d88\u9664\uff01\u5c06\u8868\u5782\u76f4\u5206\u5272 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[6],"tags":[],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-6"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7zRbQ-d","_links":{"self":[{"href":"https:\/\/www.lisq.net\/index.php?rest_route=\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lisq.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lisq.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lisq.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lisq.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13"}],"version-history":[{"count":1,"href":"https:\/\/www.lisq.net\/index.php?rest_route=\/wp\/v2\/posts\/13\/revisions"}],"predecessor-version":[{"id":14,"href":"https:\/\/www.lisq.net\/index.php?rest_route=\/wp\/v2\/posts\/13\/revisions\/14"}],"wp:attachment":[{"href":"https:\/\/www.lisq.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lisq.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lisq.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}