Berkeley DB 的内容

http://www.jinbuguo.com/lfs/lfs62/chapter06/db.html


                                                            安装的程序:
db_archive, db_checkpoint, db_deadlock, db_dump, db_hotbackup, db_load, db_printlog, db_recover, db_stat, db_upgrade, db_verify
安装的库: libdb.{so,ar}and libdb_cxx.r{o,ar}

简要描述

db_archive

打印出不再使用的日志文件路径名

db_checkpoint

监视和检查数据库日志的守护进程

db_deadlock

当死锁发生时,退出锁定要求

db_dump

把数据库文件转换成 db_load 能认出的文本文件

db_hotbackup

创建 "hot backup" 或者是 "hot failover" 的 Berkeley DB 数据库镜像。

db_load

从db_dump产生的文本文件中创建出数据库文件

db_printlog

把数据库日志文件转换成人能读懂的文本

db_recover

在发生错误后,把数据库恢复到一致的状态

db_stat

显示数据库环境统计

db_upgrade

把数据库文件转换成新版本的Berkley DB格式

db_verify

对数据库文件进行一致性检查

libdb.{so,a}

包含db处理相关函数的C库

libdb_cxx.{so,a}

包含db处理相关函数的C++库


删除冗余的log.xxxxxx
1)DB_CONFIG set_flags DB_LOG_AUTOREMOVE 是否有关系?为什么不能自动删除?
2)db_checkpoint -1
3)db_archive -d
=================================================
Provided by:  libdb2-util_2.7.7.0-10_i386   bug

 
   

NAME

       db_checkpoint - the DB database checkpoint utility

SYNOPSIS

       db_checkpoint [-1v] [-h home] [-k kbytes] [-L file] [-p min]

DESCRIPTION

       The  db_checkpoint  utility  is  a  daemon  process  that  monitors the
       database log and periodically calls txn_checkpoint(3) to checkpoint it.

       The options are as follows:

       -1   Checkpoint the log once, and then exit.

       -h   Specify a home directory for the database.

       -k   Checkpoint  the  database at least as often as every kbytes of log
            file are written.

       -L   Log the execution of the db_checkpoint utility  to  the  specified
            file in the following format, where ‘‘###’’ is the process ID, and
            the date is the time the utility starting running.

            db_checkpoint: ### Wed Jun 15 01:23:45 EDT 1995

            This file will be  removed  if  the  db_checkpoint  utility  exits
            gracefully.

       -p   Checkpoint the database at least every min minutes.

       -v   Write the time of each checkpoint to the standard output.

       At least one of the -1, -k and -p options must be specified.

       The  db_checkpoint  utility  attaches  to DB shared memory regions.  In
       order to avoid region corruption, it should always be given the  chance
       to  detach  and  exit  gracefully.   To cause db_checkpoint to clean up
       after itself and exit, send it an interrupt signal (SIGINT).

       The db_checkpoint utility exits 0  on  success,  and  >0  if  an  error
       occurs.

ENVIRONMENT VARIABLES

       The   following   environment   variables   affect   the  execution  of
       db_checkpoint:

       DB_HOME
            If 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_appinit(3).

SEE ALSO

       The DB library is a family of  groups  of  functions  that  provides  a
       modular  programming interface to transactions and record-oriented file
       access.   The  library  includes  support  for  transactions,  locking,
       logging  and  file  page  caching,  as  well  as various indexed access
       methods.  Many of the functional groups (e.g., the  file  page  caching
       functions)  are  useful independent of the other DB functions, although
       some functional groups are explicitly based on other functional  groups
       (e.g., transactions and logging).

       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
       db_load(1), db_recover(1), db_stat(1),

http://docs.oracle.com/cd/E17275_01/html/api_reference/C/db_archive.html

d db_archive

db_archive [-adlsVv] [-h home] [-P password]  

实用程序打印不再使用的日志文件路径名(例如,不再参与活动事务),到标准输出,每行一个路径名。应该将这些日志文件备份到媒体上为数据库崩溃提供恢复(还需要数据库的快照文件),但他们可能会被删除从系统回收磁盘空间。

The db_archive utility 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.

The options are as follows:

  • -a  绝对路径

    Write all pathnames as absolute pathnames, instead of relative to the database home directory.

  • -d 删除不再需要的日志文件,删除后数据崩溃时将不可恢复.

    Remove log files that are no longer needed; no filenames are written. This automatic log file removal is likely to make catastrophic recovery impossible.

  • -h 

    Specify a home directory for the database environment; by default, the current working directory is used.

  • -l 列出所有日志文件,包括正在使用的.

    Write out the pathnames of all the database log files, whether or not they are involved in active transactions.

  • -P 指定密码

    Specify 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.

  • -s

    Write 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.

    It 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. Whendb_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.

  • -V

    Write the library version number to the standard output, and exit.

  • -v

    Run in verbose mode.

Log 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.)

The 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).

The 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 an IEEE/ANSI Std 1003.1 (POSIX) environment.

The db_archive utility exits 0 on success, and >0 if an error occurs.

Environment Variables

DB_HOME

If 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 the DB_ENV->open()method.






你可能感兴趣的:(数据库)