{"id":4993,"date":"2024-11-14T12:32:21","date_gmt":"2024-11-14T04:32:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/4993\/"},"modified":"2024-11-14T12:32:21","modified_gmt":"2024-11-14T04:32:21","slug":"oracle%e4%b8%ad%e6%80%8e%e4%b9%88%e9%85%8d%e7%bd%aedblink","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/4993\/","title":{"rendered":"oracle\u4e2d\u600e\u4e48\u914d\u7f6edblink"},"content":{"rendered":"<blockquote><p>\n  db link \u5141\u8bb8\u60a8\u8bbf\u95ee\u8fdc\u7a0b\u6570\u636e\u5e93\u6570\u636e\u3002\u5982\u4f55\u914d\u7f6e db link\uff1a1. \u521b\u5efa\u6570\u636e\u5e93\u94fe\u63a5\uff1b2. \u6d4b\u8bd5\u8fde\u63a5\uff1b3. \u8fdc\u7a0b\u8bbf\u95ee\u6570\u636e\uff1b4. \u8bbf\u95ee\u8fdc\u7a0b\u5b58\u50a8\u8fc7\u7a0b\uff1b5. \u5feb\u901f\u521b\u5efa db link\uff08\u9700 sysdba \u6743\u9650\uff09\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/21\/2024052109091841168.jpg\" class=\"aligncenter\" title=\"oracle\u4e2d\u600e\u4e48\u914d\u7f6edblink\u63d2\u56fe\" alt=\"oracle\u4e2d\u600e\u4e48\u914d\u7f6edblink\u63d2\u56fe\" \/><\/p>\n<h2>\u5982\u4f55\u5728 Oracle \u4e2d\u914d\u7f6e DB Link<\/h2>\n<p>DB Link \u662f\u4e00\u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\uff0c\u5141\u8bb8\u60a8\u4ece\u8fdc\u7a0b\u6570\u636e\u5e93\u4e2d\u8bbf\u95ee\u6570\u636e\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5728 Oracle \u4e2d\u914d\u7f6e DB Link\uff1a<\/p>\n<h3>1. \u521b\u5efa\u4e00\u4e2a\u6570\u636e\u5e93\u94fe\u63a5<\/h3>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5728\u672c\u5730\u6570\u636e\u5e93\u4e2d\u521b\u5efa\u4e00\u4e2a DB Link\uff1a<\/p>\n<pre>CREATE DATABASE LINK remote_database CONNECT TO remote_user IDENTIFIED BY remote_password USING 'connect_string';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li>remote_database \u662f\u5bf9 DB Link \u7684\u540d\u79f0\u3002<\/li>\n<li>remote_user \u662f\u8fdc\u7a0b\u6570\u636e\u5e93\u7684\u7528\u6237\u540d\u3002<\/li>\n<li>remote_password \u662f\u8fdc\u7a0b\u6570\u636e\u5e93\u7684\u5bc6\u7801\u3002<\/li>\n<li>connect_string \u662f\u8fde\u63a5\u5230\u8fdc\u7a0b\u6570\u636e\u5e93\u6240\u9700\u7684\u8fde\u63a5\u5b57\u7b26\u4e32\u3002<\/li>\n<\/ul>\n<h3>2. \u6d4b\u8bd5\u8fde\u63a5<\/h3>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8be2\u6d4b\u8bd5 DB Link \u662f\u5426\u8fde\u63a5\u6210\u529f\uff1a<\/p>\n<pre>SELECT * FROM remote_table@remote_database;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li>remote_table \u662f\u8981\u8bbf\u95ee\u7684\u8fdc\u7a0b\u8868\u3002<\/li>\n<\/ul>\n<h3>3. \u8fdc\u7a0b\u8bbf\u95ee<\/h3>\n<p>\u4e00\u65e6\u5efa\u7acb\u4e86 DB Link\uff0c\u60a8\u5c31\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u8fdc\u7a0b\u8bbf\u95ee\u6570\u636e\uff1a<\/p>\n<pre>SELECT * FROM remote_table@remote_database;\nUPDATE remote_table@remote_database SET column_name = new_value;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h3>4. \u8bbf\u95ee\u8fdc\u7a0b\u5b58\u50a8\u8fc7\u7a0b<\/h3>\n<p>\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528 DB Link \u8bbf\u95ee\u8fdc\u7a0b\u5b58\u50a8\u8fc7\u7a0b\uff1a<\/p>\n<pre>EXEC remote_package.procedure_name@remote_database(parameters);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h3>5. \u5feb\u901f\u65b9\u6cd5<\/h3>\n<p>\u5982\u679c\u60a8\u62e5\u6709\u8fdc\u7a0b\u6570\u636e\u5e93\u7684 SYSDBA \u6743\u9650\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5feb\u901f\u521b\u5efa DB Link\uff1a<\/p>\n<pre>CREATE DATABASE LINK remote_database CONNECT TO remote_database_name;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e2d\u600e\u4e48\u914d\u7f6edblink\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>db link \u5141\u8bb8\u60a8\u8bbf\u95ee\u8fdc\u7a0b\u6570\u636e\u5e93\u6570\u636e\u3002\u5982\u4f55\u914d\u7f6e db link\uff1a1. \u521b\u5efa\u6570\u636e\u5e93\u94fe\u63a5\uff1b2. \u6d4b\u8bd5\u8fde\u63a5\uff1b3. \u8fdc\u7a0b\u8bbf\u95ee\u6570\u636e\uff1b4. \u8bbf\u95ee\u8fdc\u7a0b\u5b58\u50a8\u8fc7\u7a0b\uff1b5. \u5feb\u901f\u521b\u5efa db link\uff08\u9700 sysdba \u6743\u9650\uff09\u3002 \u5982\u4f55\u5728 Oracle \u4e2d\u914d\u7f6e DB Link DB Link \u662f\u4e00\u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\uff0c\u5141\u8bb8\u60a8\u4ece\u8fdc\u7a0b\u6570\u636e\u5e93\u4e2d\u8bbf\u95ee\u6570\u636e\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5728 Oracle \u4e2d\u914d\u7f6e DB Link\uff1a 1. \u521b\u5efa\u4e00\u4e2a\u6570\u636e\u5e93\u94fe\u63a5 \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5728\u672c\u5730\u6570\u636e\u5e93\u4e2d\u521b\u5efa\u4e00\u4e2a DB Link\uff1a CREATE DATABASE LINK remote_database CONNECT TO remote_user IDENTIFIED BY remote_password USING &#8216;connect_string&#8217;; \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d\uff1a remote_database \u662f\u5bf9 DB Link \u7684\u540d\u79f0\u3002 remote_user \u662f\u8fdc\u7a0b\u6570\u636e\u5e93\u7684\u7528\u6237\u540d\u3002 remote_password \u662f\u8fdc\u7a0b\u6570\u636e\u5e93\u7684\u5bc6\u7801\u3002 connect_string [&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-4993","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/4993","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=4993"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/4993\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=4993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=4993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=4993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}