{"id":91636,"date":"2024-10-18T22:52:21","date_gmt":"2024-10-18T14:52:21","guid":{"rendered":"https:\/\/server.hk\/cnblog\/91636\/"},"modified":"2024-10-18T22:52:21","modified_gmt":"2024-10-18T14:52:21","slug":"ora-31206-dbms_ldap-pl-sql-%e7%84%a1%e6%95%88%e7%9a%84-ldap-%e6%90%9c%e7%b4%a2%e7%af%84%e5%9c%8d%e3%80%82-oracle-%e5%a0%b1%e9%8c%af-%e6%95%85%e9%9a%9c%e4%bf%ae%e5%be%a9-%e9%81%a0%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/91636\/","title":{"rendered":"ORA-31206: DBMS_LDAP: PL\/SQL \u2013 \u7121\u6548\u7684 LDAP \u641c\u7d22\u7bc4\u570d\u3002 ORACLE \u5831\u932f \u6545\u969c\u4fee\u5fa9 \u9060\u7a0b\u8655\u7406"},"content":{"rendered":"<h1 id=\"ora-31206-dbms_ldap-pl-sql-%e7%84%a1%e6%95%88%e7%9a%84-ldap-%e6%90%9c%e7%b4%a2%e7%af%84%e5%9c%8d-%e6%95%85%e9%9a%9c%e4%bf%ae%e5%be%a9-%e9%81%a0%e7%a8%8b%e8%99%95%e7%90%86-pjlRKgZaOn\">ORA-31206: DBMS_LDAP: PL\/SQL \u2013 \u7121\u6548\u7684 LDAP \u641c\u7d22\u7bc4\u570d \u6545\u969c\u4fee\u5fa9 \u9060\u7a0b\u8655\u7406<\/h1>\n<p>\u5728\u4f7f\u7528 Oracle \u6578\u64da\u5eab\u6642\uff0c\u958b\u767c\u8005\u548c\u7cfb\u7d71\u7ba1\u7406\u54e1\u53ef\u80fd\u6703\u9047\u5230\u5404\u7a2e\u932f\u8aa4\u4ee3\u78bc\uff0c\u5176\u4e2d\u4e4b\u4e00\u4fbf\u662f ORA-31206\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u8207 LDAP\uff08\u8f15\u91cf\u7d1a\u76ee\u9304\u8a2a\u554f\u5354\u8b70\uff09\u76f8\u95dc\uff0c\u4e26\u4e14\u6703\u5728 PL\/SQL \u7a0b\u5e8f\u4e2d\u51fa\u73fe\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e ORA-31206 \u932f\u8aa4\u7684\u539f\u56e0\u3001\u5f71\u97ff\u4ee5\u53ca\u5982\u4f55\u9032\u884c\u6545\u969c\u4fee\u5fa9\u3002<\/p>\n<h2 id=\"ora-31206-%e9%8c%af%e8%aa%a4%e7%9a%84%e5%8e%9f%e5%9b%a0-pjlRKgZaOn\">ORA-31206 \u932f\u8aa4\u7684\u539f\u56e0<\/h2>\n<p>ORA-31206 \u932f\u8aa4\u7684\u5177\u9ad4\u4fe1\u606f\u70ba\u300cDBMS_LDAP: PL\/SQL \u2013 \u7121\u6548\u7684 LDAP \u641c\u7d22\u7bc4\u570d\u300d\u3002\u9019\u610f\u5473\u8457\u5728\u9032\u884c LDAP \u67e5\u8a62\u6642\uff0c\u6307\u5b9a\u7684\u641c\u7d22\u7bc4\u570d\u4e0d\u6b63\u78ba\u3002LDAP \u641c\u7d22\u7bc4\u570d\u901a\u5e38\u6709\u4e09\u7a2e\u9078\u64c7\uff1a<\/p>\n<ul>\n<li><strong>BASE<\/strong>\uff1a\u50c5\u67e5\u8a62\u6307\u5b9a\u7684\u689d\u76ee\u3002<\/li>\n<li><strong>ONE<\/strong>\uff1a\u67e5\u8a62\u6307\u5b9a\u689d\u76ee\u7684\u76f4\u63a5\u5b50\u689d\u76ee\u3002<\/li>\n<li><strong>SUB<\/strong>\uff1a\u67e5\u8a62\u6307\u5b9a\u689d\u76ee\u53ca\u5176\u6240\u6709\u5b50\u689d\u76ee\u3002<\/li>\n<\/ul>\n<p>\u5982\u679c\u5728 PL\/SQL \u4e2d\u4f7f\u7528\u7684\u641c\u7d22\u7bc4\u570d\u4e0d\u7b26\u5408\u9019\u4e9b\u9078\u9805\uff0c\u5247\u6703\u5c0e\u81f4 ORA-31206 \u932f\u8aa4\u3002\u4f8b\u5982\uff0c\u82e5\u4f7f\u7528\u4e86\u4e0d\u6b63\u78ba\u7684\u5b57\u7b26\u4e32\u6216\u62fc\u5beb\u932f\u8aa4\uff0c\u5247\u6703\u51fa\u73fe\u6b64\u932f\u8aa4\u3002<\/p>\n<h2 id=\"%e5%a6%82%e4%bd%95%e6%aa%a2%e6%9f%a5%e5%92%8c%e4%bf%ae%e5%be%a9-ora-31206-%e9%8c%af%e8%aa%a4-pjlRKgZaOn\">\u5982\u4f55\u6aa2\u67e5\u548c\u4fee\u5fa9 ORA-31206 \u932f\u8aa4<\/h2>\n<p>\u8981\u4fee\u5fa9 ORA-31206 \u932f\u8aa4\uff0c\u9996\u5148\u9700\u8981\u6aa2\u67e5 PL\/SQL \u4ee3\u78bc\u4e2d\u4f7f\u7528\u7684 LDAP \u641c\u7d22\u7bc4\u570d\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6b65\u9a5f\u548c\u793a\u4f8b\u4ee3\u78bc\uff0c\u5e6b\u52a9\u60a8\u9032\u884c\u6545\u969c\u6392\u9664\uff1a<\/p>\n<h3 id=\"1-%e6%aa%a2%e6%9f%a5-ldap-%e6%90%9c%e7%b4%a2%e7%af%84%e5%9c%8d-pjlRKgZaOn\">1. \u6aa2\u67e5 LDAP \u641c\u7d22\u7bc4\u570d<\/h3>\n<pre><code>\nDECLARE\n    l_ldap_session DBMS_LDAP.session;\n    l_result       DBMS_LDAP.message;\n    l_search_base  VARCHAR2(256) := 'dc=example,dc=com';\n    l_scope        INTEGER := DBMS_LDAP.SCOPE_SUB; -- \u78ba\u4fdd\u9019\u88e1\u7684\u7bc4\u570d\u6b63\u78ba\nBEGIN\n    l_ldap_session := DBMS_LDAP.init('ldap.example.com', 389);\n    DBMS_LDAP.bind(l_ldap_session, 'cn=admin,dc=example,dc=com', 'password');\n    \n    -- \u9032\u884c LDAP \u67e5\u8a62\n    l_result := DBMS_LDAP.search_s(l_ldap_session, l_search_base, l_scope, NULL, NULL, 0);\n    \n    -- \u8655\u7406\u7d50\u679c\n    DBMS_LDAP.unbind(l_ldap_session);\nEXCEPTION\n    WHEN OTHERS THEN\n        DBMS_OUTPUT.put_line('\u932f\u8aa4: ' || SQLERRM);\nEND;\n<\/code><\/pre>\n<p>\u5728\u4e0a\u8ff0\u4ee3\u78bc\u4e2d\uff0c\u8acb\u78ba\u4fdd <code>l_scope<\/code> \u8b8a\u91cf\u7684\u503c\u6b63\u78ba\u8a2d\u7f6e\u70ba <code>DBMS_LDAP.SCOPE_BASE<\/code>\u3001<code>DBMS_LDAP.SCOPE_ONE<\/code> \u6216 <code>DBMS_LDAP.SCOPE_SUB<\/code>\u3002\u5982\u679c\u4f7f\u7528\u4e86\u5176\u4ed6\u503c\uff0c\u5247\u6703\u5c0e\u81f4 ORA-31206 \u932f\u8aa4\u3002<\/p>\n<h3 id=\"2-%e6%aa%a2%e6%9f%a5-ldap-%e6%9c%8d%e5%8b%99%e5%99%a8%e9%85%8d%e7%bd%ae-pjlRKgZaOn\">2. \u6aa2\u67e5 LDAP \u670d\u52d9\u5668\u914d\u7f6e<\/h3>\n<p>\u9664\u4e86\u6aa2\u67e5 PL\/SQL \u4ee3\u78bc\u5916\uff0c\u9084\u9700\u8981\u78ba\u4fdd LDAP \u670d\u52d9\u5668\u7684\u914d\u7f6e\u6b63\u78ba\u3002\u9019\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u78ba\u8a8d LDAP \u670d\u52d9\u5668\u7684\u5730\u5740\u548c\u7aef\u53e3\u662f\u5426\u6b63\u78ba\u3002<\/li>\n<li>\u6aa2\u67e5\u7528\u6236\u540d\u548c\u5bc6\u78bc\u662f\u5426\u6709\u6548\u3002<\/li>\n<li>\u78ba\u4fdd LDAP \u670d\u52d9\u5668\u6b63\u5728\u904b\u884c\u4e26\u53ef\u8a2a\u554f\u3002<\/li>\n<\/ul>\n<h3 id=\"3-%e4%bd%bf%e7%94%a8%e8%aa%bf%e8%a9%a6%e5%b7%a5%e5%85%b7-pjlRKgZaOn\">3. \u4f7f\u7528\u8abf\u8a66\u5de5\u5177<\/h3>\n<p>\u5982\u679c\u554f\u984c\u4ecd\u7136\u5b58\u5728\uff0c\u53ef\u4ee5\u8003\u616e\u4f7f\u7528 LDAP \u8abf\u8a66\u5de5\u5177\u4f86\u6355\u7372\u548c\u5206\u6790 LDAP \u8acb\u6c42\u548c\u97ff\u61c9\u3002\u9019\u53ef\u4ee5\u5e6b\u52a9\u60a8\u8b58\u5225\u554f\u984c\u7684\u6839\u672c\u539f\u56e0\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-pjlRKgZaOn\">\u7e3d\u7d50<\/h2>\n<p>ORA-31206 \u932f\u8aa4\u901a\u5e38\u662f\u7531\u65bc\u7121\u6548\u7684 LDAP \u641c\u7d22\u7bc4\u570d\u5f15\u8d77\u7684\u3002\u901a\u904e\u6aa2\u67e5 PL\/SQL \u4ee3\u78bc\u4e2d\u7684\u641c\u7d22\u7bc4\u570d\u3001LDAP \u670d\u52d9\u5668\u914d\u7f6e\u4ee5\u53ca\u4f7f\u7528\u8abf\u8a66\u5de5\u5177\uff0c\u60a8\u53ef\u4ee5\u6709\u6548\u5730\u6392\u9664\u6545\u969c\u4e26\u89e3\u6c7a\u6b64\u554f\u984c\u3002\u5c0d\u65bc\u9700\u8981\u7a69\u5b9a\u548c\u9ad8\u6548\u7684\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\u7684\u4f01\u696d\uff0c\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\u53ef\u4ee5\u63d0\u4f9b\u66f4\u597d\u7684\u652f\u6301\u548c\u6027\u80fd\uff0c\u78ba\u4fdd\u60a8\u7684\u61c9\u7528\u7a0b\u5e8f\u904b\u884c\u9806\u5229\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89e3\u6c7a ORA-31206 \u932f\u8aa4\uff0c\u4e86\u89e3 DBMS_LDAP \u7684\u7121\u6548 LDAP \u641c\u7d22\u7bc4\u570d\u554f\u984c\uff0c\u7372\u53d6 Oracle \u6545\u969c\u4fee\u5fa9\u548c\u9060\u7a0b\u8655\u7406\u6307\u5357\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-91636","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/91636","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=91636"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/91636\/revisions"}],"predecessor-version":[{"id":91637,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/91636\/revisions\/91637"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=91636"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=91636"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=91636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}