{"id":416,"date":"2019-12-12T15:54:33","date_gmt":"2019-12-12T07:54:33","guid":{"rendered":"http:\/\/www.821121.com\/?p=416"},"modified":"2020-12-11T10:18:32","modified_gmt":"2020-12-11T02:18:32","slug":"12c%e6%96%b0%e7%89%b9%e6%80%a7%ef%bc%9amove-online-partition%e5%88%86%e5%8c%ba%e8%a1%a8%e5%9c%a8%e7%ba%bf%e8%bf%81%e7%a7%bb","status":"publish","type":"post","link":"http:\/\/www.821121.com\/?p=416","title":{"rendered":"12C\u65b0\u7279\u6027\uff1apartition move online \u5206\u533a\u8868\u5728\u7ebf\u8fc1\u79fb"},"content":{"rendered":"<h2>1\u3001\u521b\u5efa\u5206\u533a\u8868<\/h2>\n<pre><code class=\"language-sql\">SQL&gt; CREATE TABLE t_whs_p\n  2  (ID number, WNAME varchar2(10))\n  3  PARTITION BY RANGE (id)\n  4  (PARTITION p1 VALUES LESS THAN (10),\n  5  PARTITION p2 VALUES LESS THAN (20),\n  6  PARTITION p3 VALUES LESS THAN (30),\n  7  PARTITION p4 VALUES LESS THAN (40),\n  8  PARTITION p5 VALUES LESS THAN (50)\n  9  );\n\nTable created.<\/code><\/pre>\n<h2>2\u3001\u63d2\u5165\u6570\u636e<\/h2>\n<pre><code class=\"language-sql\">SQL&gt; begin\n  2  for i in 0 .. 49 loop\n  3  insert into t_whs_p values(i,&#039;whs&#039;);\n  4  end loop ;\n  5  commit;\n  6  end;\n  7  \/\n\nPL\/SQL procedure successfully completed.<\/code><\/pre>\n<h2>3\u3001\u521b\u5efa\u5168\u5c40\u7d22\u5f15<\/h2>\n<pre><code class=\"language-sql\">SQL&gt; create index i_whs_p on t_whs_p(id);\n\nIndex created.<\/code><\/pre>\n<p>\u67e5\u770b\u7d22\u5f15\u72b6\u6001<\/p>\n<pre><code class=\"language-sql\">SQL&gt; select index_name,status from user_indexes where index_name =&#039;I_WHS_P&#039;;\n\nINDEX_NAME\n--------------------------------------------------------------------------------\nSTATUS\n------------------------\nI_WHS_P\nVALID<\/code><\/pre>\n<h2>4\u3001\u5206\u533a\u8868move online<\/h2>\n<pre><code class=\"language-sql\">SQL&gt; ALTER TABLE t_whs_p move PARTITION p5 TABLESPACE users ONLINE;\nALTER TABLE t_whs_p move PARTITION p5 TABLESPACE users ONLINE\n            *\nERROR at line 1:\nORA-14809: schema does not support ONLINE MOVE PARTITION<\/code><\/pre>\n<p>\u62a5\u9519\uff0csys\u7528\u6237\u4e0d\u652f\u6301move online\u7684\u64cd\u4f5c\u3002\u6539\u7528\u666e\u901a\u7528\u6237\u6d4b\u8bd5<\/p>\n<pre><code class=\"language-sql\">[oracle@cat1 ~]$ sqlplus test\/test@PDB1_WHS\n\nSQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 2 15:45:36 2020\nVersion 19.3.0.0.0\n\nCopyright (c) 1982, 2019, Oracle.  All rights reserved.\n\nConnected to:\nOracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production\nVersion 19.3.0.0.0\n\nSQL&gt; CREATE TABLE t_whs_p                   \n  2  (ID number, WNAME varchar2(10))        \n  3  PARTITION BY RANGE (id)                \n  4  (PARTITION p1 VALUES LESS THAN (10),   \n  5  PARTITION p2 VALUES LESS THAN (20),    \n  6  PARTITION p3 VALUES LESS THAN (30),    \n  7  PARTITION p4 VALUES LESS THAN (40),    \n  8  PARTITION p5 VALUES LESS THAN (50)     \n  9  );                                     \n\nTable created.\n\nSQL&gt; begin                                \n  2  for i in 0 .. 49 loop                \n  3  insert into t_whs_p values(i,&#039;whs&#039;); \n  4  end loop ;                           \n  5  commit;                              \n  6  end;                                 \n  7  \/                                    \n\nPL\/SQL procedure successfully completed.\n\nSQL&gt; create index i_whs_p on t_whs_p(id);\n\nIndex created.\n\nSQL&gt; select index_name,status from user_indexes where index_name =&#039;I_WHS_P&#039;;\n\nINDEX_NAME\n--------------------------------------------------------------------------------\nSTATUS\n------------------------\nI_WHS_P\nVALID\n\nSQL&gt; ALTER TABLE t_whs_p move PARTITION p5 TABLESPACE users ONLINE;\n\nTable altered.\n\nSQL&gt; select index_name,status from user_indexes where index_name =&#039;I_WHS_P&#039;;\n\nINDEX_NAME\n--------------------------------------------------------------------------------\nSTATUS\n------------------------\nI_WHS_P\nVALID         &lt;---\u7d22\u5f15\u8fd8\u662f\u6b63\u5e38\u72b6\u6001<\/code><\/pre>\n<p>move online\u6d4b\u8bd5\u6210\u529f\u3002<\/p>\n<h2>5\u3001\u4e0d\u52a0online\u6d4b\u8bd5\uff1a<\/h2>\n<pre><code class=\"language-sql\">SQL&gt; ALTER TABLE t_whs_p move PARTITION p5 TABLESPACE users;\n\nTable altered.\n\nSQL&gt; select index_name,status from user_indexes where index_name =&#039;I_WHS_P&#039;;\n\nINDEX_NAME\n--------------------------------------------------------------------------------\nSTATUS\n------------------------\nI_WHS_P\nUNUSABLE     &lt;---\u7d22\u5f15\u975e\u6b63\u5e38\u72b6\u6001<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u521b\u5efa\u5206\u533a\u8868 SQL&gt; CREATE TA<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,39],"tags":[],"class_list":["post-416","post","type-post","status-publish","format-standard","hentry","category-oracle-12c","category-39"],"_links":{"self":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=416"}],"version-history":[{"count":2,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/416\/revisions"}],"predecessor-version":[{"id":418,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/416\/revisions\/418"}],"wp:attachment":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=416"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}