{"id":95708,"date":"2024-10-20T03:19:18","date_gmt":"2024-10-19T19:19:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/95708\/"},"modified":"2024-10-20T03:19:18","modified_gmt":"2024-10-19T19:19:18","slug":"oracle%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9b%a3%e6%8e%a7%e8%85%b3%e6%9c%ac%ef%bc%8c%e6%9c%89%e6%95%88%e7%b6%ad%e8%ad%b7%e6%95%b8%e6%93%9a%e5%ae%89%e5%85%a8%ef%bc%81-oracle%e6%95%b8%e6%93%9a%e5%ba%ab","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/95708\/","title":{"rendered":"Oracle\u6578\u64da\u5eab\u76e3\u63a7\u8173\u672c\uff0c\u6709\u6548\u7dad\u8b77\u6578\u64da\u5b89\u5168\uff01 (oracle\u6578\u64da\u5eab\u6aa2\u67e5\u76e3\u672c)"},"content":{"rendered":"<h1 id=\"oracle%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9b%a3%e6%8e%a7%e8%85%b3%e6%9c%ac%ef%bc%8c%e6%9c%89%e6%95%88%e7%b6%ad%e8%ad%b7%e6%95%b8%e6%93%9a%e5%ae%89%e5%85%a8%ef%bc%81-pnykYumCcr\">Oracle\u6578\u64da\u5eab\u76e3\u63a7\u8173\u672c\uff0c\u6709\u6548\u7dad\u8b77\u6578\u64da\u5b89\u5168\uff01<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u5b89\u5168\u6027\u548c\u7a69\u5b9a\u6027\u81f3\u95dc\u91cd\u8981\u3002Oracle\u6578\u64da\u5eab\u4f5c\u70ba\u4e00\u7a2e\u5ee3\u6cdb\u4f7f\u7528\u7684\u95dc\u4fc2\u578b\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5176\u76e3\u63a7\u548c\u7dad\u8b77\u5de5\u4f5c\u4e0d\u53ef\u5ffd\u8996\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u5982\u4f55\u901a\u904e\u6709\u6548\u7684\u76e3\u63a7\u8173\u672c\u4f86\u7dad\u8b77Oracle\u6578\u64da\u5eab\u7684\u6578\u64da\u5b89\u5168\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%9c%80%e8%a6%81%e7%9b%a3%e6%8e%a7oracle%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9f-pnykYumCcr\">\u70ba\u4ec0\u9ebc\u9700\u8981\u76e3\u63a7Oracle\u6578\u64da\u5eab\uff1f<\/h2>\n<p>Oracle\u6578\u64da\u5eab\u7684\u76e3\u63a7\u4e0d\u50c5\u80fd\u5920\u53ca\u6642\u767c\u73fe\u6f5b\u5728\u7684\u554f\u984c\uff0c\u9084\u80fd\u5920\u78ba\u4fdd\u6578\u64da\u7684\u5b8c\u6574\u6027\u548c\u53ef\u7528\u6027\u3002\u4ee5\u4e0b\u662f\u5e7e\u500b\u4e3b\u8981\u539f\u56e0\uff1a<\/p>\n<ul>\n<li><strong>\u6027\u80fd\u512a\u5316\uff1a<\/strong>\u901a\u904e\u76e3\u63a7\u6578\u64da\u5eab\u7684\u6027\u80fd\u6307\u6a19\uff0c\u53ef\u4ee5\u53ca\u6642\u8abf\u6574\u8cc7\u6e90\u914d\u7f6e\uff0c\u907f\u514d\u6027\u80fd\u74f6\u9838\u3002<\/li>\n<li><strong>\u5b89\u5168\u6027\u4fdd\u969c\uff1a<\/strong>\u76e3\u63a7\u7570\u5e38\u767b\u9304\u548c\u6578\u64da\u8a2a\u554f\u884c\u70ba\uff0c\u80fd\u5920\u53ca\u6642\u767c\u73fe\u6f5b\u5728\u7684\u5b89\u5168\u5a01\u8105\u3002<\/li>\n<li><strong>\u6545\u969c\u6392\u67e5\uff1a<\/strong>\u7576\u7cfb\u7d71\u51fa\u73fe\u6545\u969c\u6642\uff0c\u76e3\u63a7\u6578\u64da\u80fd\u5920\u5e6b\u52a9\u5feb\u901f\u5b9a\u4f4d\u554f\u984c\uff0c\u7e2e\u77ed\u6545\u969c\u6062\u5fa9\u6642\u9593\u3002<\/li>\n<\/ul>\n<h2 id=\"oracle%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9b%a3%e6%8e%a7%e8%85%b3%e6%9c%ac%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a7%8b%e6%88%90-pnykYumCcr\">Oracle\u6578\u64da\u5eab\u76e3\u63a7\u8173\u672c\u7684\u57fa\u672c\u69cb\u6210<\/h2>\n<p>\u4e00\u500b\u6709\u6548\u7684Oracle\u6578\u64da\u5eab\u76e3\u63a7\u8173\u672c\u901a\u5e38\u5305\u62ec\u4ee5\u4e0b\u5e7e\u500b\u90e8\u5206\uff1a<\/p>\n<ul>\n<li><strong>\u6027\u80fd\u6307\u6a19\u76e3\u63a7\uff1a<\/strong>\u5982CPU\u4f7f\u7528\u7387\u3001\u5167\u5b58\u4f7f\u7528\u60c5\u6cc1\u3001\u78c1\u789fI\/O\u7b49\u3002<\/li>\n<li><strong>\u6578\u64da\u5b8c\u6574\u6027\u6aa2\u67e5\uff1a<\/strong>\u5b9a\u671f\u6aa2\u67e5\u6578\u64da\u7684\u4e00\u81f4\u6027\u548c\u5b8c\u6574\u6027\u3002<\/li>\n<li><strong>\u5b89\u5168\u6027\u6aa2\u67e5\uff1a<\/strong>\u76e3\u63a7\u7528\u6236\u767b\u9304\u3001\u6b0a\u9650\u8b8a\u66f4\u7b49\u884c\u70ba\u3002<\/li>\n<\/ul>\n<h3 id=\"%e7%a4%ba%e4%be%8b%e7%9b%a3%e6%8e%a7%e8%85%b3%e6%9c%ac-pnykYumCcr\">\u793a\u4f8b\u76e3\u63a7\u8173\u672c<\/h3>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684Oracle\u6578\u64da\u5eab\u76e3\u63a7\u8173\u672c\u793a\u4f8b\uff0c\u8a72\u8173\u672c\u7528\u65bc\u6aa2\u67e5\u6578\u64da\u5eab\u7684\u6027\u80fd\u6307\u6a19\uff1a<\/p>\n<pre><code>\nSET SERVEROUTPUT ON;\nDECLARE\n    v_cpu_usage NUMBER;\n    v_mem_usage NUMBER;\nBEGIN\n    SELECT value INTO v_cpu_usage FROM v$sysmetric WHERE metric_name = 'CPU Usage Per Sec';\n    SELECT value INTO v_mem_usage FROM v$sysmetric WHERE metric_name = 'Memory Usage';\n    \n    DBMS_OUTPUT.PUT_LINE('CPU\u4f7f\u7528\u7387: ' || v_cpu_usage || '%');\n    DBMS_OUTPUT.PUT_LINE('\u5167\u5b58\u4f7f\u7528\u7387: ' || v_mem_usage || '%');\nEND;\n\/\n<\/code><\/pre>\n<p>\u9019\u6bb5\u8173\u672c\u901a\u904e\u67e5\u8a62\u7cfb\u7d71\u6307\u6a19\u4f86\u7372\u53d6CPU\u548c\u5167\u5b58\u7684\u4f7f\u7528\u60c5\u6cc1\uff0c\u4e26\u5c07\u7d50\u679c\u8f38\u51fa\u5230\u63a7\u5236\u53f0\u3002\u9019\u6a23\u7684\u76e3\u63a7\u53ef\u4ee5\u5e6b\u52a9\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u53ca\u6642\u4e86\u89e3\u7cfb\u7d71\u7684\u904b\u884c\u72c0\u6cc1\u3002<\/p>\n<h2 id=\"%e6%95%b8%e6%93%9a%e5%ae%8c%e6%95%b4%e6%80%a7%e6%aa%a2%e6%9f%a5-pnykYumCcr\">\u6578\u64da\u5b8c\u6574\u6027\u6aa2\u67e5<\/h2>\n<p>\u6578\u64da\u5b8c\u6574\u6027\u662f\u6578\u64da\u5eab\u5b89\u5168\u7684\u91cd\u8981\u7d44\u6210\u90e8\u5206\u3002\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0bSQL\u67e5\u8a62\u4f86\u6aa2\u67e5\u6578\u64da\u7684\u4e00\u81f4\u6027\uff1a<\/p>\n<pre><code>\nSELECT COUNT(*) FROM your_table WHERE your_column IS NULL;\n<\/code><\/pre>\n<p>\u9019\u689d\u67e5\u8a62\u5c07\u8fd4\u56de\u6307\u5b9a\u5217\u4e2d\u70baNULL\u7684\u8a18\u9304\u6578\uff0c\u5e6b\u52a9\u7ba1\u7406\u54e1\u8b58\u5225\u6578\u64da\u5b8c\u6574\u6027\u554f\u984c\u3002<\/p>\n<h2 id=\"%e5%ae%89%e5%85%a8%e6%80%a7%e6%aa%a2%e6%9f%a5-pnykYumCcr\">\u5b89\u5168\u6027\u6aa2\u67e5<\/h2>\n<p>\u70ba\u4e86\u78ba\u4fdd\u6578\u64da\u5eab\u7684\u5b89\u5168\u6027\uff0c\u5b9a\u671f\u6aa2\u67e5\u7528\u6236\u7684\u767b\u9304\u884c\u70ba\u662f\u5fc5\u8981\u7684\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u793a\u4f8b\u67e5\u8a62\uff0c\u7528\u65bc\u6aa2\u67e5\u6700\u8fd1\u7684\u767b\u9304\u6d3b\u52d5\uff1a<\/p>\n<pre><code>\nSELECT username, timestamp FROM user_audit WHERE action = 'LOGON' ORDER BY timestamp DESC;\n<\/code><\/pre>\n<p>\u9019\u689d\u67e5\u8a62\u5c07\u8fd4\u56de\u6700\u8fd1\u7684\u767b\u9304\u7528\u6236\u53ca\u5176\u767b\u9304\u6642\u9593\uff0c\u5e6b\u52a9\u7ba1\u7406\u54e1\u8b58\u5225\u53ef\u7591\u7684\u767b\u9304\u884c\u70ba\u3002<\/p>\n<h2 id=\"%e7%b5%90%e8%ab%96-pnykYumCcr\">\u7d50\u8ad6<\/h2>\n<p>\u901a\u904e\u6709\u6548\u7684Oracle\u6578\u64da\u5eab\u76e3\u63a7\u8173\u672c\uff0c\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u53ef\u4ee5\u53ca\u6642\u767c\u73fe\u4e26\u89e3\u6c7a\u6f5b\u5728\u7684\u554f\u984c\uff0c\u5f9e\u800c\u7dad\u8b77\u6578\u64da\u7684\u5b89\u5168\u6027\u548c\u5b8c\u6574\u6027\u3002\u5b9a\u671f\u7684\u6027\u80fd\u76e3\u63a7\u3001\u6578\u64da\u5b8c\u6574\u6027\u6aa2\u67e5\u548c\u5b89\u5168\u6027\u6aa2\u67e5\u662f\u78ba\u4fdd\u6578\u64da\u5eab\u7a69\u5b9a\u904b\u884c\u7684\u95dc\u9375\u3002<\/p>\n<p>\u5982\u9700\u4e86\u89e3\u66f4\u591a\u6709\u95dc\u65bc\u6578\u64da\u5eab\u7ba1\u7406\u548c\u76e3\u63a7\u7684\u8cc7\u8a0a\uff0c\u60a8\u53ef\u4ee5\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\uff0c\u7372\u53d6\u66f4\u591a\u8cc7\u6e90\u548c\u652f\u6301\u3002\u7121\u8ad6\u662f\u9078\u64c7<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u9084\u662f\u5176\u4ed6\u670d\u52d9\uff0c\u6211\u5011\u90fd\u81f4\u529b\u65bc\u63d0\u4f9b\u6700\u4f73\u7684\u89e3\u6c7a\u65b9\u6848\u4ee5\u6eff\u8db3\u60a8\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u6548\u7684Oracle\u6578\u64da\u5eab\u76e3\u63a7\u8173\u672c\uff0c\u78ba\u4fdd\u6578\u64da\u5b89\u5168\uff0c\u53ca\u6642\u6aa2\u67e5\u548c\u7dad\u8b77\uff0c\u63d0\u5347\u7cfb\u7d71\u7a69\u5b9a\u6027\u8207\u6027\u80fd\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-95708","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/95708","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=95708"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/95708\/revisions"}],"predecessor-version":[{"id":95709,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/95708\/revisions\/95709"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=95708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=95708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=95708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}