1.Dd December 3, 2003       \" DATE 
2.Dt db_archive 1       \" Program name and manual section number 
3.Os Darwin
4.Sh NAME                 \" Section Header - required - don't modify 
5.Nm db_archive
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 adlsVv
12.Op Fl h Ar home
13.Op Fl P Ar password
14.Sh DESCRIPTION          \" Section Header - required - don't modify
15The
16.Nm
17utility writes the pathnames of log files that are no longer in use (for example, no longer involved in active transactions), to the standard output, one pathname per line. These log files should be written to backup media to provide for recovery in the case of catastrophic failure (which also requires a snapshot of the database files), but they may then be deleted from the system to reclaim disk space.
18.Pp
19The options are as follows:
20.Bl -tag -width
21.It Fl a
22Write all pathnames as absolute pathnames, instead of relative to the database home directories.
23.It Fl d
24Remove log files that are no longer needed; no filenames are written. Automatic log file removal is likely to make catastrophic recovery impossible.
25.It Fl h
26Specify a home directory for the database environment; by default, the current working directory is used.
27.It Fl l
28Write out the pathnames of all the database log files, whether or not they are involved in active transactions.
29.It Fl P
30Specify 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.
31.It Fl s
32Write the pathnames of all the database files that need to be archived in order to recover the database from catastrophic failure. If any of the database files have not been accessed during the lifetime of the current log files, db_archive will not include them in this output.
33.Pp
34It is possible that some of the files to which the log refers have since been deleted from the system. In this case, db_archive will ignore them. When db_recover is run, any files to which the log refers that are not present during recovery are assumed to have been deleted and will not be recovered.
35.It Fl V
36Write the library version number to the standard output, and exit.
37.It Fl v
38Run in verbose mode, listing the checkpoints in the log files as they are reviewed.
39.El
40.Pp
41Log cursor handles (returned by the DB_ENV->log_cursor method) may have open file descriptors for log files in the database environment. Also, the Berkeley DB interfaces to the database environment logging subsystem (for example, DB_ENV->log_put and DB_TXN->abort) may allocate log cursors and have open file descriptors for log files as well. On operating systems where filesystem related system calls (for example, rename and unlink on Windows/NT) can fail if a process has an open file descriptor for the affected file, attempting to move or remove the log files listed by db_archive may fail. All Berkeley DB internal use of log cursors operates on active log files only and furthermore, is short-lived in nature. So, an application seeing such a failure should be restructured to close any open log cursors it may have, and otherwise to retry the operation until it succeeds. (Although the latter is not likely to be necessary; it is hard to imagine a reason to move or rename a log file in which transactions are being logged or aborted.)
42.Pp
43The db_archive utility uses 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, db_archive should always be given the chance to detach from the environment and exit gracefully. To cause db_archive to release all environment resources and exit cleanly, send it an interrupt signal (SIGINT).
44.Pp
45The DB_ENV->log_archive method is the underlying method used by the db_archive utility. See the db_archive utility source code for an example of using DB_ENV->log_archive in a IEEE/ANSI Std 1003.1 (POSIX) environment.
46.Pp
47The 
48.Nm
49utility exits 0 on success, and >0 if an error occurs.
50.Pp
51.Sh ENVIRONMENT      \" May not be needed
52.Bl -tag -width "DB_HOME" \" ENV_VAR_1 is width of the string ENV_VAR_1
53.It Ev DB_HOME
54If 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.
55.El                      
56.\" .Sh FILES                \" File used or created by the topic of the man page
57.\" .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
58.\" .It Pa /usr/share/file_name
59.\" FILE_1description
60.\" .It Pa /Users/joeuser/Library/really_long_file_name
61.\" FILE_2 description
62.\" .Sh DIAGNOSTICS       \" May not be needed
63.\" .Bl -diag
64.\" .It Diagnostic Tag
65.\" Diagnostic informtion here.
66.\" .It Diagnostic Tag
67.\" Diagnostic informtion here.
68.\" .El
69.Sh SEE ALSO 
70.Xr db_checkpoint 1 ,
71.Xr db_deadlock 1 ,
72.Xr db_dump 1 ,
73.Xr db_load 1 ,
74.Xr db_printlog 1 ,
75.Xr db_recover 1 ,
76.Xr db_stat 1 ,
77.Xr db_upgrade 1 ,
78.Xr db_verify 1
79.\" .Sh BUGS              \" Document known, unremedied bugs 
80.\" .Sh HISTORY           \" Document history if command behaves in a unique manner 
81