{"id":154585,"date":"2024-11-02T17:02:19","date_gmt":"2024-11-02T09:02:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/154585\/"},"modified":"2024-11-02T17:02:20","modified_gmt":"2024-11-02T09:02:20","slug":"%e5%b0%8d-oracle-%e6%95%b8%e6%93%9a%e5%ba%ab%e8%a1%a8%e5%a4%a7%e5%b0%8f%e7%9a%84%e4%bf%ae%e6%94%b9","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/154585\/","title":{"rendered":"\u5c0d Oracle \u6578\u64da\u5eab\u8868\u5927\u5c0f\u7684\u4fee\u6539"},"content":{"rendered":"<h1 id=\"%e5%b0%8d-oracle-%e6%95%b8%e6%93%9a%e5%ba%ab%e8%a1%a8%e5%a4%a7%e5%b0%8f%e7%9a%84%e4%bf%ae%e6%94%b9-GymrDalzXc\">\u5c0d Oracle \u6578\u64da\u5eab\u8868\u5927\u5c0f\u7684\u4fee\u6539<\/h1>\n<p>\u5728\u6578\u64da\u5eab\u7ba1\u7406\u4e2d\uff0c\u8868\u7684\u5927\u5c0f\u662f\u5f71\u97ff\u6027\u80fd\u548c\u5b58\u5132\u6548\u7387\u7684\u91cd\u8981\u56e0\u7d20\u3002Oracle \u6578\u64da\u5eab\u4f5c\u70ba\u4e00\u500b\u5f37\u5927\u7684\u95dc\u4fc2\u578b\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u63d0\u4f9b\u4e86\u591a\u7a2e\u65b9\u6cd5\u4f86\u4fee\u6539\u8868\u7684\u5927\u5c0f\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u5982\u4f55\u6709\u6548\u5730\u8abf\u6574 Oracle \u6578\u64da\u5eab\u8868\u7684\u5927\u5c0f\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u5be6\u7528\u7684\u793a\u4f8b\u548c\u5efa\u8b70\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%9c%80%e8%a6%81%e4%bf%ae%e6%94%b9%e8%a1%a8%e5%a4%a7%e5%b0%8f-GymrDalzXc\">\u70ba\u4ec0\u9ebc\u9700\u8981\u4fee\u6539\u8868\u5927\u5c0f<\/h2>\n<p>\u96a8\u8457\u6578\u64da\u7684\u589e\u9577\uff0c\u6578\u64da\u5eab\u8868\u7684\u5927\u5c0f\u53ef\u80fd\u6703\u8b8a\u5f97\u904e\u5927\uff0c\u9019\u6703\u5f71\u97ff\u67e5\u8a62\u6027\u80fd\u548c\u6578\u64da\u8655\u7406\u901f\u5ea6\u3002\u4fee\u6539\u8868\u7684\u5927\u5c0f\u53ef\u4ee5\u5e6b\u52a9\u512a\u5316\u6027\u80fd\uff0c\u6e1b\u5c11\u5b58\u5132\u7a7a\u9593\u7684\u6d6a\u8cbb\uff0c\u4e26\u63d0\u9ad8\u6578\u64da\u7684\u53ef\u7ba1\u7406\u6027\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u60c5\u6cc1\uff0c\u53ef\u80fd\u9700\u8981\u8abf\u6574\u8868\u7684\u5927\u5c0f\uff1a<\/p>\n<ul>\n<li>\u6578\u64da\u91cf\u589e\u52a0\uff0c\u5c0e\u81f4\u8868\u7684\u5927\u5c0f\u8d85\u904e\u9810\u671f\u3002<\/li>\n<li>\u9700\u8981\u522a\u9664\u4e0d\u518d\u4f7f\u7528\u7684\u6578\u64da\uff0c\u4ee5\u91cb\u653e\u7a7a\u9593\u3002<\/li>\n<li>\u9700\u8981\u91cd\u65b0\u7d44\u7e54\u6578\u64da\u4ee5\u63d0\u9ad8\u67e5\u8a62\u6027\u80fd\u3002<\/li>\n<\/ul>\n<h2 id=\"%e4%bf%ae%e6%94%b9%e8%a1%a8%e5%a4%a7%e5%b0%8f%e7%9a%84%e6%96%b9%e6%b3%95-GymrDalzXc\">\u4fee\u6539\u8868\u5927\u5c0f\u7684\u65b9\u6cd5<\/h2>\n<p>\u5728 Oracle \u6578\u64da\u5eab\u4e2d\uff0c\u4fee\u6539\u8868\u7684\u5927\u5c0f\u4e3b\u8981\u6709\u4ee5\u4e0b\u5e7e\u7a2e\u65b9\u6cd5\uff1a<\/p>\n<h3 id=\"1-%e5%88%aa%e9%99%a4%e4%b8%8d%e5%bf%85%e8%a6%81%e7%9a%84%e6%95%b8%e6%93%9a-GymrDalzXc\">1. \u522a\u9664\u4e0d\u5fc5\u8981\u7684\u6578\u64da<\/h3>\n<p>\u4f7f\u7528 SQL \u8a9e\u53e5\u522a\u9664\u4e0d\u518d\u9700\u8981\u7684\u6578\u64da\u662f\u6700\u76f4\u63a5\u7684\u65b9\u6cd5\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u793a\u4f8b\uff1a<\/p>\n<pre><code>DELETE FROM \u8868\u540d WHERE \u689d\u4ef6;<\/code><\/pre>\n<p>\u9019\u6a23\u53ef\u4ee5\u6e1b\u5c11\u8868\u7684\u5927\u5c0f\uff0c\u4f46\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u522a\u9664\u64cd\u4f5c\u6703\u5f71\u97ff\u6578\u64da\u7684\u5b8c\u6574\u6027\uff0c\u56e0\u6b64\u5728\u57f7\u884c\u4e4b\u524d\u61c9\u8a72\u505a\u597d\u5099\u4efd\u3002<\/p>\n<h3 id=\"2-%e4%bd%bf%e7%94%a8-truncate-%e5%91%bd%e4%bb%a4-GymrDalzXc\">2. \u4f7f\u7528 TRUNCATE \u547d\u4ee4<\/h3>\n<p>\u5982\u679c\u9700\u8981\u522a\u9664\u6574\u500b\u8868\u4e2d\u7684\u6240\u6709\u6578\u64da\uff0c\u53ef\u4ee5\u4f7f\u7528 TRUNCATE \u547d\u4ee4\u3002\u9019\u500b\u547d\u4ee4\u6bd4 DELETE \u66f4\u5feb\uff0c\u56e0\u70ba\u5b83\u4e0d\u6703\u8a18\u9304\u6bcf\u4e00\u884c\u7684\u522a\u9664\u64cd\u4f5c\uff1a<\/p>\n<pre><code>TRUNCATE TABLE \u8868\u540d;<\/code><\/pre>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cTRUNCATE \u6703\u6c38\u4e45\u522a\u9664\u6578\u64da\uff0c\u7121\u6cd5\u6062\u5fa9\u3002<\/p>\n<h3 id=\"3-%e8%aa%bf%e6%95%b4%e8%a1%a8%e7%9a%84%e5%ad%98%e5%84%b2%e5%8f%83%e6%95%b8-GymrDalzXc\">3. \u8abf\u6574\u8868\u7684\u5b58\u5132\u53c3\u6578<\/h3>\n<p>Oracle \u5141\u8a31\u7528\u6236\u8abf\u6574\u8868\u7684\u5b58\u5132\u53c3\u6578\uff0c\u4f8b\u5982 PCTFREE \u548c PCTUSED\uff0c\u9019\u4e9b\u53c3\u6578\u6703\u5f71\u97ff\u8868\u7684\u7a7a\u9593\u4f7f\u7528\u60c5\u6cc1\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u793a\u4f8b\uff1a<\/p>\n<pre><code>ALTER TABLE \u8868\u540d STORAGE (PCTFREE 10 PCTUSED 40);<\/code><\/pre>\n<p>\u9019\u6a23\u53ef\u4ee5\u512a\u5316\u8868\u7684\u5b58\u5132\u7a7a\u9593\uff0c\u6e1b\u5c11\u7a7a\u9593\u6d6a\u8cbb\u3002<\/p>\n<h3 id=\"4-%e4%bd%bf%e7%94%a8-partitioning-GymrDalzXc\">4. \u4f7f\u7528 PARTITIONING<\/h3>\n<p>\u5c0d\u65bc\u5927\u578b\u8868\uff0c\u4f7f\u7528\u5206\u5340\u6280\u8853\u53ef\u4ee5\u6709\u6548\u5730\u7ba1\u7406\u8868\u7684\u5927\u5c0f\u3002\u5206\u5340\u53ef\u4ee5\u6839\u64da\u67d0\u4e9b\u689d\u4ef6\u5c07\u8868\u5283\u5206\u70ba\u591a\u500b\u90e8\u5206\uff0c\u9019\u6a23\u53ef\u4ee5\u63d0\u9ad8\u67e5\u8a62\u6027\u80fd\u4e26\u7c21\u5316\u6578\u64da\u7ba1\u7406\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684\u5206\u5340\u793a\u4f8b\uff1a<\/p>\n<pre><code>CREATE TABLE \u8868\u540d (\n    \u52171 \u6578\u64da\u985e\u578b,\n    \u52172 \u6578\u64da\u985e\u578b\n) PARTITION BY RANGE (\u52171) (\n    PARTITION p1 VALUES LESS THAN (1000),\n    PARTITION p2 VALUES LESS THAN (2000)\n);<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-GymrDalzXc\">\u7e3d\u7d50<\/h2>\n<p>\u4fee\u6539 Oracle \u6578\u64da\u5eab\u8868\u7684\u5927\u5c0f\u662f\u4e00\u9805\u91cd\u8981\u7684\u7ba1\u7406\u4efb\u52d9\uff0c\u80fd\u5920\u5e6b\u52a9\u63d0\u9ad8\u6578\u64da\u5eab\u7684\u6027\u80fd\u548c\u6548\u7387\u3002\u901a\u904e\u522a\u9664\u4e0d\u5fc5\u8981\u7684\u6578\u64da\u3001\u4f7f\u7528 TRUNCATE \u547d\u4ee4\u3001\u8abf\u6574\u5b58\u5132\u53c3\u6578\u4ee5\u53ca\u5229\u7528\u5206\u5340\u6280\u8853\uff0c\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u53ef\u4ee5\u6709\u6548\u5730\u63a7\u5236\u8868\u7684\u5927\u5c0f\u3002\u5c0d\u65bc\u9700\u8981\u9ad8\u6548\u6578\u64da\u7ba1\u7406\u7684\u4f01\u696d\uff0c\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4e5f\u662f\u81f3\u95dc\u91cd\u8981\u7684\uff0c\u9019\u6a23\u53ef\u4ee5\u78ba\u4fdd\u6578\u64da\u5eab\u904b\u884c\u7684\u7a69\u5b9a\u6027\u548c\u53ef\u9760\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u5982\u4f55\u6709\u6548\u4fee\u6539 Oracle \u6578\u64da\u5eab\u8868\u5927\u5c0f\uff0c\u63d0\u5347\u6027\u80fd\u8207\u5b58\u5132\u6548\u7387\uff0c\u78ba\u4fdd\u6578\u64da\u7ba1\u7406\u7684\u9748\u6d3b\u6027\u8207\u7a69\u5b9a\u6027\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-154585","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/154585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=154585"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/154585\/revisions"}],"predecessor-version":[{"id":154586,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/154585\/revisions\/154586"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=154585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=154585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=154585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}