{"id":5745,"date":"2024-11-14T12:13:07","date_gmt":"2024-11-14T04:13:07","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5745\/"},"modified":"2024-11-14T12:13:07","modified_gmt":"2024-11-14T04:13:07","slug":"oracle%e6%80%8e%e4%b9%88%e6%b8%85%e7%90%86%e8%a1%a8%e7%a9%ba%e9%97%b4","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5745\/","title":{"rendered":"oracle\u600e\u4e48\u6e05\u7406\u8868\u7a7a\u95f4"},"content":{"rendered":"<blockquote><p>\n  oracle\u8868\u7a7a\u95f4\u6e05\u7406\u6b65\u9aa4\uff1a1. \u8bc6\u522b\u672a\u4f7f\u7528\u7684\u8868\u7a7a\u95f4\uff1b2. \u5220\u9664\u672a\u4f7f\u7528\u7684\u6bb5\uff1b3. \u91cd\u5efa\u7d22\u5f15\uff1b4. \u6536\u7f29\u8868\u7a7a\u95f4\uff1b5. \u5408\u5e76\u8868\u7a7a\u95f4\uff08\u5982\u6709\u9700\u8981\uff09\uff1b6. \u79fb\u52a8\u6570\u636e\u6587\u4ef6\uff08\u5982\u6709\u9700\u8981\uff09\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053021542293461.jpg\" class=\"aligncenter\" title=\"oracle\u600e\u4e48\u6e05\u7406\u8868\u7a7a\u95f4\u63d2\u56fe\" alt=\"oracle\u600e\u4e48\u6e05\u7406\u8868\u7a7a\u95f4\u63d2\u56fe\" \/><\/p>\n<p><strong>Oracle\u6e05\u7406\u8868\u7a7a\u95f4\u7684\u6b65\u9aa4<\/strong><\/p>\n<p>Oracle\u8868\u7a7a\u95f4\u662f\u903b\u8f91\u5b58\u50a8\u5355\u5143\uff0c\u7528\u4e8e\u5b58\u50a8\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u3002\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\uff0c\u8868\u7a7a\u95f4\u4f1a\u7d2f\u79ef\u672a\u4f7f\u7528\u7684\u7a7a\u95f4\uff0c\u4ece\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002\u5b9a\u671f\u6e05\u7406\u8868\u7a7a\u95f4\u5bf9\u4e8e\u4fdd\u6301\u6570\u636e\u5e93\u7684\u6548\u7387\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><\/p>\n<p><strong>1. \u8bc6\u522b\u9700\u8981\u6e05\u7406\u7684\u8868\u7a7a\u95f4<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8be2\u8bc6\u522b\u672a\u4f7f\u7528\u7684\u8868\u7a7a\u95f4\uff1a<\/p>\n<pre>SELECT tablespace_name, SUM(bytes) \/ 1024 \/ 1024 \/ 1024 AS GB_USED\nFROM dba_segments\nGROUP BY tablespace_name\nORDER BY GB_USED DESC;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u5220\u9664\u672a\u4f7f\u7528\u7684\u6bb5<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8be2\u627e\u51fa\u5360\u7528\u672a\u7528\u7a7a\u95f4\u7684\u6bb5\uff1a<\/p>\n<pre>SELECT owner, segment_name, segment_type, bytes\nFROM dba_segments\nWHERE tablespace_name = '&lt;\u8868\u7a7a\u95f4\u540d\u79f0&gt;'\nAND bytes &lt; 1024 * 1024;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5220\u9664\u8fd9\u4e9b\u6bb5\uff1a<\/p>\n<pre>DROP TABLE &lt;\u6240\u6709\u8005&gt;.&lt;\u8868\u540d&gt; PURGE;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u91cd\u5efa\u7d22\u5f15<\/strong><\/p>\n<p>\u91cd\u5efa\u7d22\u5f15\u6709\u52a9\u4e8e\u4ece\u8868\u7a7a\u95f4\u4e2d\u56de\u6536\u672a\u4f7f\u7528\u7684\u7a7a\u95f4\uff1a<\/p>\n<pre>ALTER INDEX &lt;\u7d22\u5f15\u540d\u79f0&gt; REBUILD;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u6536\u7f29\u8868\u7a7a\u95f4<\/strong><\/p>\n<p>\u6536\u7f29\u8868\u7a7a\u95f4\u4f1a\u91ca\u653e\u672a\u4f7f\u7528\u7684\u7a7a\u95f4\uff0c\u4ece\u800c\u51cf\u5c0f\u5176\u5927\u5c0f\uff1a<\/p>\n<pre>ALTER TABLESPACE &lt;\u8868\u7a7a\u95f4\u540d\u79f0&gt; SHRINK;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u5408\u5e76\u8868\u7a7a\u95f4<\/strong><\/p>\n<p>\u5982\u679c\u6709\u591a\u4e2a\u5c0f\u8868\u7a7a\u95f4\uff0c\u53ef\u4ee5\u8003\u8651\u5c06\u5176\u5408\u5e76\u5230\u4e00\u4e2a\u8f83\u5927\u7684\u8868\u7a7a\u95f4\u4e2d\uff1a<\/p>\n<pre>ALTER TABLESPACE &lt;\u65b0\u8868\u7a7a\u95f4\u540d\u79f0&gt; ADD DATAFILE '&lt;\u6570\u636e\u6587\u4ef6\u8def\u5f84&gt;';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>6. \u79fb\u52a8\u6570\u636e\u6587\u4ef6<\/strong><\/p>\n<p>\u5982\u679c\u8868\u7a7a\u95f4\u4e2d\u6709\u5927\u91cf\u672a\u4f7f\u7528\u7684\u7a7a\u95f4\uff0c\u53ef\u4ee5\u8003\u8651\u79fb\u52a8\u6570\u636e\u6587\u4ef6\u5230\u5176\u4ed6\u4f4d\u7f6e\uff1a<\/p>\n<pre>ALTER DATABASE DATAFILE '&lt;\u6570\u636e\u6587\u4ef6\u8def\u5f84&gt;' MOVE '&lt;\u65b0\u4f4d\u7f6e&gt;'<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u9075\u5faa\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u53ef\u4ee5\u6709\u6548\u6e05\u7406Oracle\u8868\u7a7a\u95f4\uff0c\u91ca\u653e\u672a\u4f7f\u7528\u7684\u7a7a\u95f4\u5e76\u63d0\u9ad8\u6570\u636e\u5e93\u7684\u6027\u80fd\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u6e05\u7406\u8868\u7a7a\u95f4\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>oracle\u8868\u7a7a\u95f4\u6e05\u7406\u6b65\u9aa4\uff1a1. \u8bc6\u522b\u672a\u4f7f\u7528\u7684\u8868\u7a7a\u95f4\uff1b2. \u5220\u9664\u672a\u4f7f\u7528\u7684\u6bb5\uff1b3. \u91cd\u5efa\u7d22\u5f15\uff1b4. \u6536\u7f29\u8868\u7a7a\u95f4\uff1b5. \u5408\u5e76\u8868\u7a7a\u95f4\uff08\u5982\u6709\u9700\u8981\uff09\uff1b6. \u79fb\u52a8\u6570\u636e\u6587\u4ef6\uff08\u5982\u6709\u9700\u8981\uff09\u3002 Oracle\u6e05\u7406\u8868\u7a7a\u95f4\u7684\u6b65\u9aa4 Oracle\u8868\u7a7a\u95f4\u662f\u903b\u8f91\u5b58\u50a8\u5355\u5143\uff0c\u7528\u4e8e\u5b58\u50a8\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u3002\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\uff0c\u8868\u7a7a\u95f4\u4f1a\u7d2f\u79ef\u672a\u4f7f\u7528\u7684\u7a7a\u95f4\uff0c\u4ece\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002\u5b9a\u671f\u6e05\u7406\u8868\u7a7a\u95f4\u5bf9\u4e8e\u4fdd\u6301\u6570\u636e\u5e93\u7684\u6548\u7387\u81f3\u5173\u91cd\u8981\u3002 \u6b65\u9aa4\uff1a 1. \u8bc6\u522b\u9700\u8981\u6e05\u7406\u7684\u8868\u7a7a\u95f4 \u4f7f\u7528\u4ee5\u4e0b\u67e5\u8be2\u8bc6\u522b\u672a\u4f7f\u7528\u7684\u8868\u7a7a\u95f4\uff1a SELECT tablespace_name, SUM(bytes) \/ 1024 \/ 1024 \/ 1024 AS GB_USED FROM dba_segments GROUP BY tablespace_name ORDER BY GB_USED DESC; \u767b\u5f55\u540e\u590d\u5236 2. \u5220\u9664\u672a\u4f7f\u7528\u7684\u6bb5 \u4f7f\u7528\u4ee5\u4e0b\u67e5\u8be2\u627e\u51fa\u5360\u7528\u672a\u7528\u7a7a\u95f4\u7684\u6bb5\uff1a SELECT owner, segment_name, segment_type, bytes FROM dba_segments WHERE tablespace_name = &#8216;&lt;\u8868\u7a7a\u95f4\u540d\u79f0&gt;&#8217; AND bytes &lt; 1024 * 1024; \u767b\u5f55\u540e\u590d\u5236 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5745","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5745"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5745\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}