compactWithOptions (Database - Java)

Compacts a local database allowing the submission of options.

Note: This method is new with Release 6.5.

Defined in



public int compactWithOptions(String options)
    throws NotesException
public int compactWithOptions(int options)
    throws NotesException
public int compactWithOptions(int options, String spacethreshhold)
    throws NotesException


String options

One or more command-line options supported by the Compact server task without the minus signs. Spaces are insignificant except that a space cannot be placed in the S option between the number and the final K, k, M, or m. Options are processed in their order of specification.

int options

One or more of the following constants. Combine constants by adding.

  • Database.CMPC_ARCHIVE_DELETE_COMPACT (1) a (archive and delete, then compact)
  • Database.CMPC_ARCHIVE_DELETE_ONLY (2) A (archive and delete with no compact; supersedes a)
  • Database.CMPC_CHK_OVERLAP (32768) o and O (check overlap)
  • Database.CMPC_COPYSTYLE (16) c and C (copy style; supersedes b and B)
  • Database.CMPC_DISABLE_DOCTBLBIT_OPTMZN (128) f (disable document table bit map optimization)
  • Database.CMPC_DISABLE_LARGE_UNKTBL (4096) k (disable large unknown table)
  • Database.CMPC_DISABLE_RESPONSE_INFO (512) H (disable "Don't support specialized response hierarchy")
  • Database.CMPC_DISABLE_TRANSACTIONLOGGING (262144) t (disable transaction logging)
  • Database.CMPC_DISABLE_UNREAD_MARKS (1048576) U (disable "Don't maintain unread marks")
  • Database.CMPC_DISCARD_VIEW_INDICES (32) d and D (discard view indexes)
  • Database.CMPC_ENABLE_DOCTBLBIT_OPTMZN (64) F (enable document table bit map optimization; supersedes f)
  • Database.CMPC_ENABLE_LARGE_UNKTBL (2048) K (enable large unknown table; supersedes k)
  • Database.CMPC_ENABLE_RESPONSE_INFO (256) h (enable "Don't support specialized response hierarchy"; supersedes H)
  • Database.CMPC_ENABLE_TRANSACTIONLOGGING (131072) T (enable transaction logging; supersedes t)
  • Database.CMPC_ENABLE_UNREAD_MARKS (524288) u (enable "Don't maintain unread marks"; supersedes U)
  • Database.CMPC_IGNORE_COPYSTYLE_ERRORS (1024) i (ignore copy-style errors)
  • Database.CMPC_MAX_4GB (16384) m and M (set maximum database size at 4 gigabytes)
  • Database.CMPC_NO_LOCKOUT (8192) l and L (do not lock out users)
  • Database.CMPC_RECOVER_INPLACE (8) B (recover unused space in-place and reduce file size; supersedes b)
  • Database.CMPC_RECOVER_REDUCE_INPLACE (4) b (recover unused space in-place without reducing file size)
  • Database.CMPC_REVERT_FILEFORMAT (65536) r and R (do not convert old file format)
String spacethreshhold

The value of the S option (compact if specified percent or amount of unused space) without the S, for example, "10" for 10 percent, "10K" for 10 kilobytes, or "10M" for 10 megabytes.

Return value


The difference in bytes between the size of the database before and after compacting.


This method throws an exception if the database is not local.

An agent cannot compact the current database (the database in which the agent is running) or the desktop.dsk file.

The options are those that you can use with the Compact server task. For more information, see "Compact options" in Administration Help.

This method does not support the e or E option.