Page created: 22 Jul 2020 |
Page updated: 12 Dec 2022
The move-subtree tool provides the ability to move multiple entries
listed in a DN file from one machine to another. Empty lines and lines beginning
with the octothorpe character (#) will be ignored. Entry DNs may optionally be
dn: , but long DNs cannot be wrapped across multiple
Open a text file, enter a list of DNs, one DN per line, and then save the file.
You can also use the ldapsearch command with the special
character "1.1" to create a file containing a list of DNs that you want to move.
The following example searches for all entries that match
(department=Engineering) and returns only the DNs that
match the criteria. The results are re-directed to an output file,
$ bin/ldapsearch --baseDN dc=example,dc=com \ --searchScope sub "(department=Engineering)" "1.1" > test-dns.ldif
Run the move-subtree tool with the
--entryDNFile option to specify the file of DNs that will
be moved from one machine to another.
$ bin/move-subtree --sourceHost source.example.com --sourcePort 389 \ --sourceBindDN "uid=admin,dc=example,dc=com" --sourceBindPassword password \ --targetHost target.example.com --targetPort 389 \ --targetBindDN "uid=admin,dc=example,dc=com" --targetBindPassword password \ --entryDNFile /path/to/file/test-dns.ldif
If an error occurs with one of the DNs in the file, the output message shows
the error. The move-subtree tool will continuing processing the
remaining DNs in the file.
An error occurred while communicating with the target server: The entry uid=user.2,ou=People,dc=example,dc=com cannot be added because an entry with that name already exists Entry uid=user.3,ou=People,dc=example,dc=com was successfully moved from source.example.com:389 to target.example.com:389 Entry uid=user.4,ou=People,dc=example,dc=com was successfully moved from source.example.com:389 to target.example.com:389