{"id":93880,"date":"2024-10-19T17:41:22","date_gmt":"2024-10-19T09:41:22","guid":{"rendered":"https:\/\/server.hk\/cnblog\/93880\/"},"modified":"2024-10-19T17:41:22","modified_gmt":"2024-10-19T09:41:22","slug":"oracle-db-buffer%e5%af%b6%e5%85%b8%e8%aa%aa%e6%98%8e","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/93880\/","title":{"rendered":"Oracle DB BUFFER\u5bf6\u5178\u8aaa\u660e"},"content":{"rendered":"<h1 id=\"oracle-db-buffer%e5%af%b6%e5%85%b8%e8%aa%aa%e6%98%8e-AdghCuAawc\">Oracle DB BUFFER\u5bf6\u5178\u8aaa\u660e<\/h1>\n<p>\u5728\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\u4e2d\uff0cOracle Database \u662f\u4e00\u500b\u5ee3\u6cdb\u4f7f\u7528\u7684\u95dc\u4fc2\u578b\u6578\u64da\u5eab\u7cfb\u7d71\u3002\u5176\u6027\u80fd\u548c\u6548\u7387\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u4f9d\u8cf4\u65bc\u5176\u7de9\u885d\u5340\uff08Buffer\uff09\u7ba1\u7406\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e Oracle DB \u7684\u7de9\u885d\u5340\u7684\u904b\u4f5c\u539f\u7406\u3001\u914d\u7f6e\u53ca\u5176\u5c0d\u6027\u80fd\u7684\u5f71\u97ff\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e7%b7%a9%e8%a1%9d%e5%8d%80%ef%bc%9f-AdghCuAawc\">\u4ec0\u9ebc\u662f\u7de9\u885d\u5340\uff1f<\/h2>\n<p>\u7de9\u885d\u5340\u662f\u7528\u65bc\u81e8\u6642\u5b58\u5132\u6578\u64da\u7684\u5167\u5b58\u5340\u57df\uff0c\u76ee\u7684\u662f\u63d0\u9ad8\u6578\u64da\u7684\u8b80\u53d6\u548c\u5beb\u5165\u901f\u5ea6\u3002\u5728 Oracle DB \u4e2d\uff0c\u7de9\u885d\u5340\u4e3b\u8981\u7528\u65bc\u5b58\u5132\u5f9e\u78c1\u789f\u8b80\u53d6\u7684\u6578\u64da\u584a\uff0c\u9019\u6a23\u53ef\u4ee5\u6e1b\u5c11\u5c0d\u78c1\u789f\u7684\u76f4\u63a5\u8a2a\u554f\u6b21\u6578\uff0c\u5f9e\u800c\u63d0\u9ad8\u6574\u9ad4\u6027\u80fd\u3002<\/p>\n<h2 id=\"oracle-db-%e7%9a%84%e7%b7%a9%e8%a1%9d%e5%8d%80%e7%ae%a1%e7%90%86-AdghCuAawc\">Oracle DB \u7684\u7de9\u885d\u5340\u7ba1\u7406<\/h2>\n<p>Oracle \u4f7f\u7528\u4e00\u500b\u7a31\u70ba\u7de9\u885d\u5340\u7de9\u5b58\uff08Buffer Cache\uff09\u7684\u6a5f\u5236\u4f86\u7ba1\u7406\u7de9\u885d\u5340\u3002\u9019\u500b\u7de9\u5b58\u662f SGA\uff08System Global Area\uff09\u7684\u4e00\u90e8\u5206\uff0c\u4e3b\u8981\u7528\u65bc\u5b58\u5132\u6700\u8fd1\u4f7f\u7528\u7684\u6578\u64da\u584a\u3002\u7576\u7528\u6236\u8acb\u6c42\u6578\u64da\u6642\uff0cOracle \u9996\u5148\u6703\u6aa2\u67e5\u7de9\u885d\u5340\u7de9\u5b58\uff0c\u5982\u679c\u6578\u64da\u5df2\u7d93\u5b58\u5728\u65bc\u7de9\u885d\u5340\u4e2d\uff0c\u5247\u76f4\u63a5\u5f9e\u7de9\u885d\u5340\u8fd4\u56de\u6578\u64da\uff0c\u9019\u6a23\u53ef\u4ee5\u5927\u5e45\u63d0\u9ad8\u67e5\u8a62\u901f\u5ea6\u3002<\/p>\n<h3 id=\"%e7%b7%a9%e8%a1%9d%e5%8d%80%e7%9a%84%e9%a1%9e%e5%9e%8b-AdghCuAawc\">\u7de9\u885d\u5340\u7684\u985e\u578b<\/h3>\n<ul>\n<li><strong>\u6578\u64da\u7de9\u885d\u5340\uff08Data Buffer\uff09<\/strong>: \u5b58\u5132\u8868\u548c\u7d22\u5f15\u7684\u6578\u64da\u584a\u3002<\/li>\n<li><strong>\u91cd\u505a\u7de9\u885d\u5340\uff08Redo Buffer\uff09<\/strong>: \u5b58\u5132\u6240\u6709\u5c0d\u6578\u64da\u5eab\u9032\u884c\u7684\u66f4\u6539\uff0c\u4ee5\u4fbf\u5728\u7cfb\u7d71\u5d29\u6f70\u6642\u9032\u884c\u6062\u5fa9\u3002<\/li>\n<li><strong>\u5171\u4eab\u7de9\u885d\u5340\uff08Shared Pool\uff09<\/strong>: \u5b58\u5132 SQL \u8a9e\u53e5\u548c PL\/SQL \u7a0b\u5e8f\u7684\u57f7\u884c\u8a08\u5283\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b7%a9%e8%a1%9d%e5%8d%80%e7%9a%84%e9%85%8d%e7%bd%ae-AdghCuAawc\">\u7de9\u885d\u5340\u7684\u914d\u7f6e<\/h2>\n<p>\u5728 Oracle DB \u4e2d\uff0c\u7de9\u885d\u5340\u7684\u5927\u5c0f\u548c\u914d\u7f6e\u53ef\u4ee5\u901a\u904e\u521d\u59cb\u5316\u53c3\u6578\u9032\u884c\u8abf\u6574\u3002\u6700\u91cd\u8981\u7684\u53c3\u6578\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>DB_BLOCK_SIZE<\/strong>: \u5b9a\u7fa9\u6578\u64da\u584a\u7684\u5927\u5c0f\uff0c\u901a\u5e38\u70ba 2K\u30014K \u6216 8K\u3002<\/li>\n<li><strong>DB_CACHE_SIZE<\/strong>: \u5b9a\u7fa9\u7de9\u885d\u5340\u7de9\u5b58\u7684\u5927\u5c0f\uff0c\u9019\u500b\u503c\u8d8a\u5927\uff0c\u80fd\u5920\u5b58\u5132\u7684\u6578\u64da\u584a\u5c31\u8d8a\u591a\u3002<\/li>\n<\/ul>\n<p>\u4f8b\u5982\uff0c\u82e5\u8981\u8a2d\u7f6e\u7de9\u885d\u5340\u5927\u5c0f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b SQL \u8a9e\u53e5\uff1a<\/p>\n<pre><code>ALTER SYSTEM SET DB_CACHE_SIZE = 500M;<\/code><\/pre>\n<h2 id=\"%e7%b7%a9%e8%a1%9d%e5%8d%80%e7%9a%84%e6%80%a7%e8%83%bd%e5%bd%b1%e9%9f%bf-AdghCuAawc\">\u7de9\u885d\u5340\u7684\u6027\u80fd\u5f71\u97ff<\/h2>\n<p>\u7de9\u885d\u5340\u7684\u5927\u5c0f\u548c\u914d\u7f6e\u5c0d\u6578\u64da\u5eab\u6027\u80fd\u6709\u8457\u76f4\u63a5\u7684\u5f71\u97ff\u3002\u904e\u5c0f\u7684\u7de9\u885d\u5340\u53ef\u80fd\u5c0e\u81f4\u983b\u7e41\u7684\u78c1\u789f I\/O \u64cd\u4f5c\uff0c\u5f9e\u800c\u964d\u4f4e\u6027\u80fd\u3002\u76f8\u53cd\uff0c\u904e\u5927\u7684\u7de9\u885d\u5340\u5247\u53ef\u80fd\u5c0e\u81f4\u5167\u5b58\u8cc7\u6e90\u7684\u6d6a\u8cbb\u3002\u56e0\u6b64\uff0c\u5408\u7406\u7684\u7de9\u885d\u5340\u914d\u7f6e\u662f\u78ba\u4fdd Oracle DB \u9ad8\u6548\u904b\u884c\u7684\u95dc\u9375\u3002<\/p>\n<h3 id=\"%e7%b7%a9%e8%a1%9d%e5%8d%80%e5%91%bd%e4%b8%ad%e7%8e%87-AdghCuAawc\">\u7de9\u885d\u5340\u547d\u4e2d\u7387<\/h3>\n<p>\u7de9\u885d\u5340\u547d\u4e2d\u7387\u662f\u8861\u91cf\u7de9\u885d\u5340\u6027\u80fd\u7684\u4e00\u500b\u91cd\u8981\u6307\u6a19\u3002\u5b83\u8868\u793a\u5f9e\u7de9\u885d\u5340\u4e2d\u6210\u529f\u8b80\u53d6\u6578\u64da\u7684\u6bd4\u4f8b\u3002\u547d\u4e2d\u7387\u8d8a\u9ad8\uff0c\u8868\u793a\u7de9\u885d\u5340\u7684\u6548\u7387\u8d8a\u9ad8\u3002\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b SQL \u67e5\u8a62\u4f86\u6aa2\u67e5\u7de9\u885d\u5340\u547d\u4e2d\u7387\uff1a<\/p>\n<pre><code>SELECT \n    (1 - (phy.value \/ (phy.value + user.value))) * 100 AS \"Buffer Hit Ratio\"\nFROM \n    v$buffer_pool_statistics phy, \n    v$buffer_pool_statistics user;<\/code><\/pre>\n<h2 id=\"%e7%b5%90%e8%ab%96-AdghCuAawc\">\u7d50\u8ad6<\/h2>\n<p>Oracle DB \u7684\u7de9\u885d\u5340\u7ba1\u7406\u662f\u78ba\u4fdd\u6578\u64da\u5eab\u6027\u80fd\u7684\u95dc\u9375\u56e0\u7d20\u4e4b\u4e00\u3002\u901a\u904e\u5408\u7406\u914d\u7f6e\u7de9\u885d\u5340\u5927\u5c0f\u548c\u985e\u578b\uff0c\u53ef\u4ee5\u986f\u8457\u63d0\u9ad8\u6578\u64da\u7684\u8b80\u53d6\u548c\u5beb\u5165\u6548\u7387\u3002\u4e86\u89e3\u7de9\u885d\u5340\u7684\u904b\u4f5c\u539f\u7406\u53ca\u5176\u5c0d\u6027\u80fd\u7684\u5f71\u97ff\uff0c\u5c0d\u65bc\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u4f86\u8aaa\u81f3\u95dc\u91cd\u8981\u3002<\/p>\n<p>\u5982\u9700\u9032\u4e00\u6b65\u4e86\u89e3\u6709\u95dc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u548c\u5176\u4ed6\u4f3a\u670d\u5668\u89e3\u6c7a\u65b9\u6848\u7684\u4fe1\u606f\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Discover the essentials of Oracle DB BUFFER, including its functions, configurations, and best practices for optimal database performance.<\/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-93880","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/93880","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=93880"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/93880\/revisions"}],"predecessor-version":[{"id":93881,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/93880\/revisions\/93881"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=93880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=93880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=93880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}