{"id":152063,"date":"2024-11-01T19:48:19","date_gmt":"2024-11-01T11:48:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/152063\/"},"modified":"2024-11-01T19:48:20","modified_gmt":"2024-11-01T11:48:20","slug":"%e5%bf%85%e7%9c%8b%e4%b9%be%e8%b2%a8-oracle%e5%b8%b8%e8%a6%8b%e7%9a%84%e7%ad%89%e5%be%85%e4%ba%8b%e4%bb%b6%e8%aa%aa%e6%98%8e%ef%bc%88%e4%b8%8a%ef%bc%89","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/152063\/","title":{"rendered":"\u5fc5\u770b\u4e7e\u8ca8 | Oracle\u5e38\u898b\u7684\u7b49\u5f85\u4e8b\u4ef6\u8aaa\u660e\uff08\u4e0a\uff09"},"content":{"rendered":"<h1 id=\"%e5%bf%85%e7%9c%8b%e4%b9%be%e8%b2%a8-oracle%e5%b8%b8%e8%a6%8b%e7%9a%84%e7%ad%89%e5%be%85%e4%ba%8b%e4%bb%b6%e8%aa%aa%e6%98%8e%ef%bc%88%e4%b8%8a%ef%bc%89-ZiqacnDOCR\">\u5fc5\u770b\u4e7e\u8ca8 | Oracle\u5e38\u898b\u7684\u7b49\u5f85\u4e8b\u4ef6\u8aaa\u660e\uff08\u4e0a\uff09<\/h1>\n<p>\u5728\u4f7f\u7528Oracle\u6578\u64da\u5eab\u7684\u904e\u7a0b\u4e2d\uff0c\u4e86\u89e3\u5404\u7a2e\u7b49\u5f85\u4e8b\u4ef6\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u7b49\u5f85\u4e8b\u4ef6\u662f\u6307\u6578\u64da\u5eab\u5728\u57f7\u884c\u904e\u7a0b\u4e2d\uff0c\u7531\u65bc\u67d0\u4e9b\u8cc7\u6e90\u7684\u4e0d\u53ef\u7528\u800c\u66ab\u6642\u505c\u6b62\u7684\u60c5\u6cc1\u3002\u9019\u4e9b\u4e8b\u4ef6\u53ef\u4ee5\u5e6b\u52a9DBA\uff08\u6578\u64da\u5eab\u7ba1\u7406\u54e1\uff09\u8b58\u5225\u6027\u80fd\u74f6\u9838\uff0c\u9032\u800c\u9032\u884c\u512a\u5316\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u4e00\u4e9b\u5e38\u898b\u7684Oracle\u7b49\u5f85\u4e8b\u4ef6\u53ca\u5176\u542b\u7fa9\u3002<\/p>\n<h2 id=\"1-%e6%a6%82%e8%bf%b0-ZiqacnDOCR\">1. \u6982\u8ff0<\/h2>\n<p>Oracle\u6578\u64da\u5eab\u7684\u6027\u80fd\u76e3\u63a7\u901a\u5e38\u4f9d\u8cf4\u65bc\u7b49\u5f85\u4e8b\u4ef6\u7684\u5206\u6790\u3002\u6bcf\u7576\u4e00\u500b\u6703\u8a71\u5728\u57f7\u884cSQL\u8a9e\u53e5\u6642\uff0c\u53ef\u80fd\u6703\u56e0\u70ba\u5404\u7a2e\u539f\u56e0\u800c\u9032\u5165\u7b49\u5f85\u72c0\u614b\u3002\u9019\u4e9b\u7b49\u5f85\u4e8b\u4ef6\u53ef\u4ee5\u5206\u70ba\u5e7e\u500b\u985e\u5225\uff0c\u5305\u62ecI\/O\u7b49\u5f85\u3001\u9396\u7b49\u5f85\u3001\u7db2\u7d61\u7b49\u5f85\u7b49\u3002\u4e86\u89e3\u9019\u4e9b\u4e8b\u4ef6\u7684\u6027\u8cea\u548c\u539f\u56e0\uff0c\u80fd\u5920\u5e6b\u52a9DBA\u66f4\u6709\u6548\u5730\u9032\u884c\u6027\u80fd\u8abf\u512a\u3002<\/p>\n<h2 id=\"2-%e5%b8%b8%e8%a6%8b%e7%9a%84%e7%ad%89%e5%be%85%e4%ba%8b%e4%bb%b6-ZiqacnDOCR\">2. \u5e38\u898b\u7684\u7b49\u5f85\u4e8b\u4ef6<\/h2>\n<h3 id=\"2-1-db-file-sequential-read-ZiqacnDOCR\">2.1. db file sequential read<\/h3>\n<p>\u9019\u662f\u4e00\u7a2e\u5e38\u898b\u7684\u7b49\u5f85\u4e8b\u4ef6\uff0c\u901a\u5e38\u767c\u751f\u5728\u57f7\u884c\u67e5\u8a62\u6642\u3002\u7576\u6578\u64da\u5eab\u9700\u8981\u5f9e\u78c1\u789f\u4e2d\u8b80\u53d6\u55ae\u500b\u6578\u64da\u584a\u6642\uff0c\u5c31\u6703\u51fa\u73fe\u9019\u7a2e\u7b49\u5f85\u3002\u9019\u901a\u5e38\u8207\u7d22\u5f15\u7684\u4f7f\u7528\u6709\u95dc\uff0c\u56e0\u70ba\u7d22\u5f15\u67e5\u8a62\u901a\u5e38\u9700\u8981\u96a8\u6a5f\u8b80\u53d6\u6578\u64da\u3002<\/p>\n<pre><code>SELECT * FROM employees WHERE employee_id = 100;<\/code><\/pre>\n<h3 id=\"2-2-db-file-scattered-read-ZiqacnDOCR\">2.2. db file scattered read<\/h3>\n<p>\u8207\u201cdb file sequential read\u201d\u76f8\u5c0d\uff0c\u9019\u7a2e\u7b49\u5f85\u4e8b\u4ef6\u901a\u5e38\u767c\u751f\u5728\u5168\u8868\u6383\u63cf\u6216\u591a\u884c\u67e5\u8a62\u6642\u3002\u7576\u6578\u64da\u5eab\u9700\u8981\u5f9e\u78c1\u789f\u4e2d\u8b80\u53d6\u591a\u500b\u6578\u64da\u584a\u6642\uff0c\u5c31\u6703\u51fa\u73fe\u9019\u7a2e\u7b49\u5f85\u3002\u9019\u901a\u5e38\u8868\u793a\u67e5\u8a62\u7684\u6548\u7387\u4e0d\u9ad8\uff0c\u53ef\u80fd\u9700\u8981\u8003\u616e\u512a\u5316\u67e5\u8a62\u6216\u589e\u52a0\u7d22\u5f15\u3002<\/p>\n<pre><code>SELECT * FROM employees WHERE department_id = 10;<\/code><\/pre>\n<h3 id=\"2-3-log-file-sync-ZiqacnDOCR\">2.3. log file sync<\/h3>\n<p>\u9019\u7a2e\u7b49\u5f85\u4e8b\u4ef6\u767c\u751f\u5728\u6578\u64da\u5eab\u9700\u8981\u5c07\u4e8b\u52d9\u65e5\u8a8c\u5beb\u5165\u78c1\u789f\u6642\u3002\u7576\u4e00\u500b\u4e8b\u52d9\u63d0\u4ea4\u6642\uff0cOracle\u6703\u7b49\u5f85\u65e5\u8a8c\u6587\u4ef6\u7684\u5beb\u5165\u5b8c\u6210\uff0c\u9019\u6a23\u624d\u80fd\u78ba\u4fdd\u6578\u64da\u7684\u6301\u4e45\u6027\u3002\u5982\u679c\u9019\u500b\u7b49\u5f85\u4e8b\u4ef6\u7684\u6642\u9593\u904e\u9577\uff0c\u53ef\u80fd\u6703\u5f71\u97ff\u6574\u9ad4\u7684\u4e8b\u52d9\u6027\u80fd\u3002<\/p>\n<h3 id=\"2-4-enq-tx-row-lock-contention-ZiqacnDOCR\">2.4. enq: TX &#8211; row lock contention<\/h3>\n<p>\u9019\u662f\u4e00\u7a2e\u9396\u7b49\u5f85\u4e8b\u4ef6\uff0c\u7576\u591a\u500b\u4e8b\u52d9\u5617\u8a66\u540c\u6642\u4fee\u6539\u540c\u4e00\u884c\u6578\u64da\u6642\uff0c\u5c31\u6703\u51fa\u73fe\u9019\u7a2e\u7b49\u5f85\u3002\u9019\u901a\u5e38\u8868\u793a\u61c9\u7528\u7a0b\u5e8f\u7684\u8a2d\u8a08\u9700\u8981\u6539\u9032\uff0c\u4ee5\u6e1b\u5c11\u5c0d\u540c\u4e00\u8cc7\u6e90\u7684\u7af6\u722d\u3002<\/p>\n<h3 id=\"2-5-latch-free-ZiqacnDOCR\">2.5. latch free<\/h3>\n<p>\u9019\u7a2e\u7b49\u5f85\u4e8b\u4ef6\u901a\u5e38\u8207\u5167\u5b58\u7d50\u69cb\u7684\u9396\u5b9a\u6709\u95dc\u3002\u7576\u4e00\u500b\u6703\u8a71\u9700\u8981\u8a2a\u554f\u4e00\u500b\u88ab\u5176\u4ed6\u6703\u8a71\u9396\u5b9a\u7684\u5167\u5b58\u7d50\u69cb\u6642\uff0c\u5c31\u6703\u51fa\u73fe\u9019\u7a2e\u7b49\u5f85\u3002\u9019\u53ef\u80fd\u662f\u7531\u65bc\u4e0d\u7576\u7684\u5167\u5b58\u7ba1\u7406\u6216\u9ad8\u4e26\u767c\u7684\u8acb\u6c42\u5c0e\u81f4\u7684\u3002<\/p>\n<h2 id=\"3-%e5%a6%82%e4%bd%95%e7%9b%a3%e6%8e%a7%e7%ad%89%e5%be%85%e4%ba%8b%e4%bb%b6-ZiqacnDOCR\">3. \u5982\u4f55\u76e3\u63a7\u7b49\u5f85\u4e8b\u4ef6<\/h2>\n<p>Oracle\u63d0\u4f9b\u4e86\u591a\u7a2e\u5de5\u5177\u4f86\u76e3\u63a7\u7b49\u5f85\u4e8b\u4ef6\uff0c\u5305\u62ecV$SESSION\u548cV$SESSION_WAIT\u8996\u5716\u3002\u901a\u904e\u67e5\u8a62\u9019\u4e9b\u8996\u5716\uff0cDBA\u53ef\u4ee5\u7372\u53d6\u7576\u524d\u6703\u8a71\u7684\u7b49\u5f85\u4e8b\u4ef6\u4fe1\u606f\u3002<\/p>\n<pre><code>SELECT event, wait_time, seconds_in_wait FROM v$session_wait WHERE sid = ;<\/code><\/pre>\n<p>\u6b64\u5916\uff0cDBA\u9084\u53ef\u4ee5\u4f7f\u7528AWR\uff08Automatic Workload Repository\uff09\u5831\u544a\u4f86\u5206\u6790\u9577\u671f\u7684\u7b49\u5f85\u4e8b\u4ef6\u8da8\u52e2\uff0c\u5f9e\u800c\u5236\u5b9a\u76f8\u61c9\u7684\u512a\u5316\u7b56\u7565\u3002<\/p>\n<h2 id=\"4-%e7%b8%bd%e7%b5%90-ZiqacnDOCR\">4. \u7e3d\u7d50<\/h2>\n<p>\u4e86\u89e3Oracle\u7684\u7b49\u5f85\u4e8b\u4ef6\u5c0d\u65bc\u6578\u64da\u5eab\u6027\u80fd\u7684\u512a\u5316\u81f3\u95dc\u91cd\u8981\u3002\u901a\u904e\u8b58\u5225\u548c\u5206\u6790\u9019\u4e9b\u4e8b\u4ef6\uff0cDBA\u53ef\u4ee5\u66f4\u6709\u6548\u5730\u89e3\u6c7a\u6027\u80fd\u74f6\u9838\u554f\u984c\u3002\u5728\u63a5\u4e0b\u4f86\u7684\u6587\u7ae0\u4e2d\uff0c\u6211\u5011\u5c07\u6df1\u5165\u63a2\u8a0e\u66f4\u591a\u7684\u7b49\u5f85\u4e8b\u4ef6\u53ca\u5176\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u7528\u6236\u7684\u9700\u6c42\u3002\u7121\u8ad6\u662f\u4f01\u696d\u7d1a\u61c9\u7528\u9084\u662f\u500b\u4eba\u9805\u76ee\uff0c\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u4e91\u4f3a\u670d\u5668<\/a> \u90fd\u80fd\u70ba\u60a8\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3Oracle\u5e38\u898b\u7684\u7b49\u5f85\u4e8b\u4ef6\uff0c\u638c\u63e1\u6027\u80fd\u512a\u5316\u6280\u5de7\uff0c\u63d0\u5347\u6578\u64da\u5eab\u6548\u7387\uff0c\u5fc5\u770b\u4e7e\u8ca8\uff0c\u52a9\u4f60\u89e3\u6c7a\u5e38\u898b\u554f\u984c\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-152063","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/152063","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=152063"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/152063\/revisions"}],"predecessor-version":[{"id":152064,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/152063\/revisions\/152064"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=152063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=152063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=152063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}