{"id":5009,"date":"2024-11-14T08:01:10","date_gmt":"2024-11-14T00:01:10","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5009\/"},"modified":"2024-11-14T08:01:10","modified_gmt":"2024-11-14T00:01:10","slug":"oracle%e7%9a%84dblink%e6%80%8e%e4%b9%88%e5%88%9b%e5%bb%ba","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5009\/","title":{"rendered":"oracle\u7684dblink\u600e\u4e48\u521b\u5efa"},"content":{"rendered":"<blockquote><p>\n  oracle dblink \u662f\u4e00\u79cd\u8fde\u63a5\u4e0d\u540c\u6570\u636e\u5e93\u7684\u7279\u6027\u80fd\uff0c\u5141\u8bb8\u5728\u6570\u636e\u5e93\u4e4b\u95f4\u5171\u4eab\u6570\u636e\u548c\u6267\u884c\u67e5\u8be2\u3002\u521b\u5efa dblink \u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u786e\u4fdd\u6743\u9650\u4f7f\u7528 create database link \u8bed\u53e5\u6307\u5b9a\u8fde\u63a5\u4e32\uff0c\u5176\u4e2d\u5305\u542b\u8fdc\u7a0b\u6570\u636e\u5e93\u4fe1\u606f\u4f8b\u5982\uff0c\u521b\u5efa\u540d\u4e3a remote_db \u7684 dblink\uff0c\u8fde\u63a5\u5230\u6570\u636e\u5e93 my_database\uff1acreate database link remote_db connect to my_username identified by my_password using &#8216;\/\/remot\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/21\/2024052110211831191.jpg\" class=\"aligncenter\" title=\"oracle\u7684dblink\u600e\u4e48\u521b\u5efa\u63d2\u56fe\" alt=\"oracle\u7684dblink\u600e\u4e48\u521b\u5efa\u63d2\u56fe\" \/><\/p>\n<p><strong>Oracle DBLink \u7684\u521b\u5efa<\/strong><\/p>\n<p><strong>\u4ec0\u4e48\u662f DBLink\uff1f<\/strong><\/p>\n<p>DBLink \u662f Oracle \u6570\u636e\u5e93\u4e2d\u5141\u8bb8\u6570\u636e\u5e93\u8fde\u63a5\u5230\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u7684\u7279\u6027\u3002\u5b83\u63d0\u4f9b\u4e86\u5728\u4e0d\u540c\u6570\u636e\u5e93\u4e4b\u95f4\u5171\u4eab\u6570\u636e\u548c\u6267\u884c\u67e5\u8be2\u7684\u80fd\u529b\u3002<\/p>\n<p><strong>\u521b\u5efa DBLink \u7684\u6b65\u9aa4\uff1a<\/strong><\/p>\n<p><strong>1. \u786e\u4fdd\u6743\u9650\uff1a<\/strong><\/p>\n<p>\u8981\u521b\u5efa DBLink\uff0c\u7528\u6237\u9700\u8981\u5177\u6709 CREATE DATABASE LINK \u6743\u9650\u3002<\/p>\n<p><strong>2. \u4f7f\u7528 CREATE DATABASE LINK \u8bed\u53e5\uff1a<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u521b\u5efa DBLink\uff1a<\/p>\n<pre>CREATE DATABASE LINK dblink_name CONNECT TO username IDENTIFIED BY password USING 'connect_string';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li>dblink_name \u662f DBLink \u7684\u540d\u79f0\u3002<\/li>\n<li>username \u662f\u8fde\u63a5\u5230\u8fdc\u7a0b\u6570\u636e\u5e93\u7684\u7528\u6237\u540d\u3002<\/li>\n<li>password \u662f\u8fde\u63a5\u7684\u5bc6\u7801\u3002<\/li>\n<li>connect_string \u662f\u7528\u4e8e\u8fde\u63a5\u5230\u8fdc\u7a0b\u6570\u636e\u5e93\u7684\u8fde\u63a5\u5b57\u7b26\u4e32\u3002<\/li>\n<\/ul>\n<p><strong>3. \u6307\u5b9a\u8fde\u63a5\u5b57\u7b26\u4e32\uff1a<\/strong><\/p>\n<p>\u8fde\u63a5\u5b57\u7b26\u4e32\u5305\u542b\u8fde\u63a5\u5230\u8fdc\u7a0b\u6570\u636e\u5e93\u6240\u9700\u7684\u4fe1\u606f\u3002\u5b83\u53ef\u4ee5\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li> <strong>\u4e3b\u673a\u540d\u6216 IP \u5730\u5740\uff1a<\/strong> \u8fdc\u7a0b\u6570\u636e\u5e93\u7684\u5730\u5740\u3002<\/li>\n<li> <strong>\u7aef\u53e3\u53f7\uff1a<\/strong> \u8fdc\u7a0b\u6570\u636e\u5e93\u6b63\u5728\u4fa6\u542c\u7684\u7aef\u53e3\u3002<\/li>\n<li> <strong>\u670d\u52a1\u540d\uff1a<\/strong> \u8fdc\u7a0b\u6570\u636e\u5e93\u7684\u670d\u52a1\u540d\u79f0\u3002<\/li>\n<li> <strong>SID\uff1a<\/strong> \u8fdc\u7a0b\u6570\u636e\u5e93\u7684 SID\uff08\u7cfb\u7edf\u6807\u8bc6\u7b26\uff09\u3002<\/li>\n<\/ul>\n<p><strong>4. \u4f8b\u5b50\uff1a<\/strong><\/p>\n<p>\u4ee5\u4e0b\u793a\u4f8b\u521b\u5efa\u540d\u4e3a remote_db \u7684 DBLink\uff0c\u8fde\u63a5\u5230\u540d\u4e3a my_database \u7684\u8fdc\u7a0b\u6570\u636e\u5e93\uff1a<\/p>\n<pre>CREATE DATABASE LINK remote_db CONNECT TO my_username IDENTIFIED BY my_password USING '\/\/remote_host:1521\/my_database';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f7f\u7528 DBLink\uff1a<\/strong><\/p>\n<p>\u521b\u5efa DBLink \u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b83\u5728\u672c\u5730\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u8fdc\u7a0b\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u3002\u60a8\u53ef\u4ee5\u5728 SQL \u67e5\u8be2\u4e2d\u4f7f\u7528 DBLink \u540d\u79f0\uff0c\u5982\u540c\u5b83\u662f\u4e00\u4e2a\u672c\u5730\u8868\u4e00\u6837\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>SELECT * FROM remote_db.my_table;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u7684dblink\u600e\u4e48\u521b\u5efa\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 dblink \u662f\u4e00\u79cd\u8fde\u63a5\u4e0d\u540c\u6570\u636e\u5e93\u7684\u7279\u6027\u80fd\uff0c\u5141\u8bb8\u5728\u6570\u636e\u5e93\u4e4b\u95f4\u5171\u4eab\u6570\u636e\u548c\u6267\u884c\u67e5\u8be2\u3002\u521b\u5efa dblink \u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u786e\u4fdd\u6743\u9650\u4f7f\u7528 create database link \u8bed\u53e5\u6307\u5b9a\u8fde\u63a5\u4e32\uff0c\u5176\u4e2d\u5305\u542b\u8fdc\u7a0b\u6570\u636e\u5e93\u4fe1\u606f\u4f8b\u5982\uff0c\u521b\u5efa\u540d\u4e3a remote_db \u7684 dblink\uff0c\u8fde\u63a5\u5230\u6570\u636e\u5e93 my_database\uff1acreate database link remote_db connect to my_username identified by my_password using &#8216;\/\/remot Oracle DBLink \u7684\u521b\u5efa \u4ec0\u4e48\u662f DBLink\uff1f DBLink \u662f Oracle \u6570\u636e\u5e93\u4e2d\u5141\u8bb8\u6570\u636e\u5e93\u8fde\u63a5\u5230\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u7684\u7279\u6027\u3002\u5b83\u63d0\u4f9b\u4e86\u5728\u4e0d\u540c\u6570\u636e\u5e93\u4e4b\u95f4\u5171\u4eab\u6570\u636e\u548c\u6267\u884c\u67e5\u8be2\u7684\u80fd\u529b\u3002 \u521b\u5efa DBLink \u7684\u6b65\u9aa4\uff1a 1. \u786e\u4fdd\u6743\u9650\uff1a \u8981\u521b\u5efa DBLink\uff0c\u7528\u6237\u9700\u8981\u5177\u6709 CREATE DATABASE LINK \u6743\u9650\u3002 2. \u4f7f\u7528 CREATE DATABASE LINK \u8bed\u53e5\uff1a \u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u521b\u5efa DBLink\uff1a CREATE DATABASE LINK [&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-5009","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5009","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=5009"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5009\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}