6.9. dbscan

6.9. dbscan

The dbscan tool analyzes and extracts information from a Directory Server database file. See Section 4.4, “Database Files” for more information on database files.

Database files use the .db2, .db3, and .db4 extensions in their filename, depending on the version of Directory Server.

Syntax

dbscan -f filename [ options ]

Options

Option Parameter Description
-f filename Specifies the name of the database file, the contents of which are to be analyzed and extracted. This option is required.
-R   Dump the database as raw data.
-t size Specifies the entry truncate size (in bytes).
Table 6.21. Common Options

NOTE

The options listed in Table 6.22, “Entry File Options” are meaningful only when the database file is id2entry.db4.

Option Parameter Description
-K entry_id Specifies the entry to ID to look up.
Table 6.22. Entry File Options

NOTE

The index file options, listed in Table 6.23, “Index File Options ”, are meaningful only when the database file is the secondary index file.

Option Parameter Description
-k key Specifies the key to look up in the secondary index file.
-l size Sets the maximum length of the dumped ID list. The valid range is from 40 to 1048576 bytes. The default value is 4096.
-G n Sets only to display those index entries with ID lists exceeding the specified length.
-n   Sets only to display the length of the ID list.
-r   Sets to display the contents of the ID list.
-s   Gives the summary of index counts.
Table 6.23. Index File Options

Examples

The following are command-line examples of different situations using dbscan to examine the Directory Server databases.

dbscan -f /var/lib/dirsrv/slapd-instance_name/db/userRoot/id2entry.db4

Example 6.7. Dumping the Entry File

dbscan -f /var/lib/dirsrv/slapd-instance_name/db/userRoot/cn.db4

Example 6.8. Displaying the Index Keys in cn.db4

dbscan -r -f /var/lib/dirsrv/slapd-instance_name/db/userRoot/mail.db4

Example 6.9. Displaying the Index Keys and the Count of Entries with the Key in mail.db4

dbscan -r -G 20 -f /var/lib/dirsrv/slapd-instance_name/db/userRoot/sn.db4

Example 6.10. Displaying the Index Keys and the All IDs with More Than 20 IDs in sn.db4

dbscan -s -f /var/lib/dirsrv/slapd-instance_name/db/userRoot/objectclass.db4

Example 6.11. Displaying the Summary of objectclass.db4

dbscan -r -f /var/lib/dirsrv/slapd-instance_name/db/userRoot/vlv#bymccoupeopledcpeopledccom.db4

Example 6.12. Displaying VLV Index File Contents

dbscan -f /var/lib/dirsrv/slapd-instance_name/changelogdb/c1a2fc02-1d11b2-8018afa7-fdce000_424c8a000f00.db4

Example 6.13. Displaying the Changelog File Contents

dbscan -R -f /var/lib/dirsrv/slapd-instance_name/db/userRoot/uid.db4

Example 6.14. Dumping the Index File uid.db4 with Raw Mode

In this example, the common name key is =hr managers, and the equals sign (=) means the key is an equality index.

dbscan -k "=hr managers" -r -f /var/lib/dirsrv/slapd-instance_name/db/userRoot/cn.db4 =hr%20managers 7

Example 6.15. Displaying the entryID with the Common Name Key "=hr managers"

dbscan -K 7 -f id2entry.db4 id 7 dn: cn=HR Managers,ou=groups,dc=example,dc=com
objectClass: top 
objectClass: groupOfUniqueNames 
cn: HR Manager
ou: groups 
description: People who can manage HR entries
creatorsName: cn=directory manager 
modifiersName: cn=directory manager 
createTimestamp: 20050408230424Z 
modifyTimestamp: 20050408230424Z
nsUniqueId: 8b465f73-1dd211b2-807fd340-d7f40000 parentid: 3
entryid: 7 
entrydn: cn=hr managers,ou=groups,dc=example,dc=com

Example 6.16. Displaying an Entry with the entry ID of 7


Note: This documentation is provided {and copyrighted} by Red Hat®, Inc. and is released via the Open Publication License. The copyright holder has added the further requirement that Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. The CentOS project redistributes these original works (in their unmodified form) as a reference for CentOS-5 because CentOS-5 is built from publicly available, open source SRPMS. The documentation is unmodified to be compliant with upstream distribution policy. Neither CentOS-5 nor the CentOS Project are in any way affiliated with or sponsored by Red Hat®, Inc.