Database Tool (db-tools)

This tool provides a variety of functionality manipulating the PaperCut NG database and data. The syntax of the command is:

            db-tools command [options]
        

The valid commands are:

export-db Command

The export-db command exports the data from the database. The application server must be stopped before performing the export. The syntax and options for the export-db command are:

    usage: db-tools export-db [options]
     -d,--dir <dir>     Exports the database to the given directory.
     -f,--file <file>   Exports the database to the given file.
     -h,--help          Displays this help.
            

If no options are specified then the database export file is created in the [appdir]\server\data\backups directory and the file is named export-[date-time].zip.

The --dir option is used to override the default backup directory. The filename will still be named export-[date-time].zip.

The --file option is used to specify the full path and filename where the backup is saved.

Caution

If the directory or filename parameters contains space, then the argument needs to be quoted.

import-db Command

The import-db command imports the data (from a previous export) into the database. The application server must be stopped to perform the import. The syntax and options for the import-db command are:

    usage: db-tools import-db [options] import-file
     -f,--force   Deletes any existing data before loading the data.
     -h,--help    Displays this help.
            

The --force option is required when the data is loaded into a database that already contains data. In this situation, the force option indicates that existing data will be deleted first.

Caution

If the import-file contains spaces this argument will need to be quoted.

init-db Command

The init-db command initializes a database, creating the required tables and initial data. The application server must be stopped before you initialize the database. The syntax and options for the init-db command are:

    usage: db-tools init-db [options]
     -f,--force   Re-initializes the database even if it already exists.
     -h,--help    Displays this help.
            

The --force option is required to initialize a database that already contains the tables and data. In this case the force option will drop the existing tables before recreating the tables.