1.Dd December 3, 2003       \" DATE 
2.Dt db_dump 1       \" Program name and manual section number 
3.Os Darwin
4.Sh NAME                 \" Section Header - required - don't modify 
5.Nm db_dump
6.\" The following lines are read in generating the apropos(man -k) database. Use only key
7.\" words here as the database is built based on the words here and in the .ND line. 
8.\" Use .Nm macro to designate other names for the documented program.
9.Sh SYNOPSIS             \" Section Header - required - don't modify
10.Nm
11.Op Fl klNpRrV
12.Op Fl d Ar ahr
13.Op Fl f Ar output
14.Op Fl h Ar home
15.Op Fl P Ar password
16.Op Fl s Ar database
17file
18.Sh DESCRIPTION          \" Section Header - required - don't modify
19The
20.Nm
21utility reads the database file file and writes it to the standard output using a portable flat-text format understood by the db_load utility. The file argument must be a file produced using the Berkeley DB library functions.
22.Pp
23The options are as follows:
24.Bl -tag -width
25.It Fl d
26Dump the specified database in a format helpful for debugging the Berkeley DB library routines.
27.Bl -tag -width
28.It a
29Display all information.
30.It h
31Display only page headers.
32.It r
33Do not display the free-list or pages on the free list. This mode is used by the recovery tests.
34.El
35.Pp
36.Em The output format of the -d option is not standard and may change, without notice, between releases of the Berkeley DB library.
37.It Fl f
38Write to the specified file instead of to the standard output.
39.It Fl h
40Specify a home directory for the database environment; by default, the current working directory is used.
41.It Fl k
42Dump record numbers from Queue and Recno databases as keys.
43.It Fl l
44List the databases stored in the file.
45.It Fl N
46Do not acquire shared region mutexes while running. Other problems, such as potentially fatal errors in Berkeley DB, will be ignored as well. This option is intended only for debugging errors, and should not be used under any other circumstances.
47.It Fl P
48Specify an environment password. Although Berkeley DB utilities overwrite password strings as soon as possible, be aware there may be a window of vulnerability on systems where unprivileged users can see command-line arguments or where utilities are not able to overwrite the memory containing the command-line arguments.
49.It Fl p
50If characters in either the key or data items are printing characters (as defined by isprint(3)), use printing characters in file to represent them. This option permits users to use standard text editors and tools to modify the contents of databases.
51.Pp
52Note: different systems may have different notions about what characters are considered 
53.Em printing characters,
54and databases dumped in this manner may be less portable to external systems.
55.It Fl R
56Aggressively salvage data from a possibly corrupt file. The -R flag differs from the -r option in that it will return all possible data from the file at the risk of also returning already deleted or otherwise nonsensical items. Data dumped in this fashion will almost certainly have to be edited by hand or other means before the data is ready for reload into another database
57.It Fl r
58Salvage data from a possibly corrupt file. When used on a uncorrupted database, this option should return equivalent data to a normal dump, but most likely in a different order.
59.It Fl s
60Specify a single database to dump. If no database is specified, all databases in the database file are dumped.
61.It Fl V
62Write the library version number to the standard output, and exit.
63.El
64.Pp
65Dumping and reloading Hash databases that use user-defined hash functions will result in new databases that use the default hash function. Although using the default hash function may not be optimal for the new database, it will continue to work correctly.
66.Pp
67Dumping and reloading Btree databases that use user-defined prefix or comparison functions will result in new databases that use the default prefix and comparison functions. 
68.Em \&In this case, it is quite likely that the database will be damaged beyond repair permitting neither record storage or retrieval.
69.Pp
70The only available workaround for either case is to modify the sources for the db_load utility to load the database using the correct hash, prefix, and comparison functions.
71.Pp
72The 
73.Nm
74utility output format is documented in the Dump Output Formats section of the Berkeley DB Reference Guide.
75.Pp
76The
77.Nm
78utility may be used with a Berkeley DB environment (as described for the -h option, the environment variable DB_HOME, or because the utility was run in a directory containing a Berkeley DB environment). In order to avoid environment corruption when using a Berkeley DB environment, 
79.Nm
80should always be given the chance to detach from the environment and exit gracefully. To cause
81.Nm 
82to release all environment resources and exit cleanly, send it an interrupt signal (SIGINT).
83.Pp
84Even when using a Berkeley DB database environment, the
85.Nm
86utility does not use any kind of database locking if it is invoked with the -d, -R, or -r arguments. If used with one of these arguments, the
87.Nm
88utility may only be safely run on databases that are not being modified by any other process; otherwise, the output may be corrupt.
89.Pp
90The 
91.Nm
92utility exits 0 on success, and >0 if an error occurs.
93.Pp
94.Sh ENVIRONMENT      \" May not be needed
95.Bl -tag -width "DB_HOME" \" ENV_VAR_1 is width of the string ENV_VAR_1
96.It Ev DB_HOME
97If the -h option is not specified and the environment variable DB_HOME is set, it is used as the path of the database home, as described in DB_ENV->open.
98.El                      
99.\" .Sh FILES                \" File used or created by the topic of the man page
100.\" .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
101.\" .It Pa /usr/share/file_name
102.\" FILE_1description
103.\" .It Pa /Users/joeuser/Library/really_long_file_name
104.\" FILE_2 description
105.\" .Sh DIAGNOSTICS       \" May not be needed
106.\" .Bl -diag
107.\" .It Diagnostic Tag
108.\" Diagnostic informtion here.
109.\" .It Diagnostic Tag
110.\" Diagnostic informtion here.
111.\" .El
112.Sh SEE ALSO 
113.Xr db_archive 1 ,
114.Xr db_checkpoint 1 ,
115.Xr db_deadlock 1 ,
116.Xr db_load 1 ,
117.Xr db_printlog 1 ,
118.Xr db_recover 1 ,
119.Xr db_stat 1 ,
120.Xr db_upgrade 1 ,
121.Xr db_verify 1
122.\" .Sh BUGS              \" Document known, unremedied bugs 
123.\" .Sh HISTORY           \" Document history if command behaves in a unique manner 
124