{"id":1239,"date":"2019-12-02T11:11:25","date_gmt":"2019-12-02T03:11:25","guid":{"rendered":"http:\/\/www.821121.com\/?p=1239"},"modified":"2021-03-02T10:52:02","modified_gmt":"2021-03-02T02:52:02","slug":"sys%e7%94%a8%e6%88%b7%e5%88%a0%e9%99%a4%e6%99%ae%e9%80%9a%e7%94%a8%e6%88%b7%e5%88%9b%e5%bb%ba%e7%9a%84db_link","status":"publish","type":"post","link":"http:\/\/www.821121.com\/?p=1239","title":{"rendered":"sys\u7528\u6237\u5220\u9664\u666e\u901a\u7528\u6237\u521b\u5efa\u7684db_link"},"content":{"rendered":"<p>scott\u7528\u6237\u521b\u5efa\u7684db_link\uff1aLINK10G<br \/>\n<img decoding=\"async\" src=\"\/wp-content\/uploads\/2020\/12\/image-1609384383175.png\" alt=\"file\" \/><\/p>\n<p>\u78b0\u5230\u4ee5\u4e0b\u60c5\u5f62\uff1a\u65e0\u6cd5\u8054\u7cfb\u5e94\u7528\u4fa7\u4eba\u5458\u83b7\u53d6scott\u7528\u6237\u7684\u5bc6\u7801\u6765\u767b\u5f55\u6570\u636e\u5e93\u5220\u9664scott\u7528\u6237\u521b\u5efa\u7684db_link\uff1aLINK10G\u3002<\/p>\n<p>\u4f7f\u7528sys\u7528\u6237\u65e0\u6cd5\u76f4\u63a5\u5220\u9664\u3002<br \/>\n<img decoding=\"async\" src=\"\/wp-content\/uploads\/2020\/12\/image-1609384522086.png\" alt=\"file\" \/><\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u5220\u9664\uff1a<br \/>\n\u521b\u5efa\u5b58\u50a8\u8fc7\u7a0b<\/p>\n<pre><code class=\"language-sql\">Create or replace procedure Drop_DbLink(schemaName varchar2, dbLink varchar2 ) is\n            plsql   varchar2(1000);\n            cur     number;\n            uid     number;\n            rc      number;\n    begin\n            select   u.user_id into uid from    dba_users u\n           where   u.username = schemaName;\n             plsql := &#039;drop database link &quot;&#039;||dbLink||&#039;&quot;&#039;;\n             cur := SYS.DBMS_SYS_SQL.open_cursor;\n             SYS.DBMS_SYS_SQL.parse_as_user(\n                   c =&gt; cur,\n                   statement =&gt; plsql,\n                   language_flag =&gt; DBMS_SQL.native,\n                   userID =&gt; uid\n          );\n             rc := SYS.DBMS_SYS_SQL.execute(cur);\n             SYS.DBMS_SYS_SQL.close_cursor(cur);\n   end;\n   \/<\/code><\/pre>\n<p>\u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b\u5220\u9664db_link<\/p>\n<pre><code class=\"language-sql\">SQL&gt; exec Drop_DbLink(&#039;SCOTT&#039;,&#039;LINK10G&#039;);\n\nPL\/SQL procedure successfully completed.<\/code><\/pre>\n<p>\u5220\u9664db_link\u540e\uff0c\u5220\u9664\u5b58\u50a8\u8fc7\u7a0b\u3002<\/p>\n<pre><code class=\"language-sql\">drop procedure Drop_DbLink;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>scott\u7528\u6237\u521b\u5efa\u7684db_link\uff1aLINK10G<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,48],"tags":[],"class_list":["post-1239","post","type-post","status-publish","format-standard","hentry","category-oracle-11g","category-sql"],"_links":{"self":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/1239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1239"}],"version-history":[{"count":1,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/1239\/revisions"}],"predecessor-version":[{"id":1243,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/1239\/revisions\/1243"}],"wp:attachment":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1239"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}