我在使用DBMS_LDAP.delete_s
函数删除任何LDAP条目时遇到问题。我的代码如下所示:
DECLARE
l_ldap_user VARCHAR2(256) := 'dc=example,dc=com';
l_session DBMS_LDAP.session;
...
BEGIN
...
l_retval := dbms_ldap.delete_s(l_session, l_ldap_user || ',cn=Tink');
...
END
/
我使用Apache Directory Studio版本2.0.0来存储LDAP数据,它看起来像:
dn: dc=example,dc=com
objectclass: top
objectclass: domain
dc: example
userPassword:: e1NTSEF9YTZIYUF0U1BGSnFOQ2piZm9ENStpV3BMQnJ1VnBlT21IbFAraHc9P
Q==
dn: cn=Tink,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: person
objectClass: organizationalPerson
objectClass: top
cn: Tink
sn: Tink
userPassword:: e1NTSEF9eDZBZUV2SzVEYmkrYlA2c0FCZU1zdk5YMzlUN1JUL3FOSk9KQmc9P
Q==
结果我收到以下错误消息:
Error report -
ORA-31202: DBMS_LDAP: LDAP client/server error: No such object.
NO_SUCH_OBJECT: failed for MessageType : DEL_REQUEST
Message ID : 2
Del request
Entry : 'dc=example,dc=com,cn=Tink'
org.apache.directory.api.ldap.model.message.DeleteRequestImpl@ac23db41:
ERR_268 Cannot find a partition for dc=example,dc=com,cn=Tink
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_LDAP", line 1487
ORA-06512: at "SYS.DBMS_LDAP", line 709
ORA-06512: at line 69
31202. 00000 - "DBMS_LDAP: LDAP client/server error: %s"
*Cause: There is a problem either on the LDAP server or on the client.
*Action: Please report this error to the LDAP server administrator or
your Database administrator.
请帮助我,因为我没有知道如何修复此代码的想法。
问题出在行中:
l_retval := dbms_ldap.delete_s(l_session, l_ldap_user || ',cn=Tink');
LDAP 中的正确读取节点是:leaf.domainname.domainname
这个问题的答案:
l_retval := dbms_ldap.delete_s(l_session, 'cn=Tink,' || l_ldap_user); --l_ldap_user = 'dn=domain,dn=com'.