This page applies to dbtool in releases 6.8 and later. For older versions see DBTool Legacy.
The Database Tool or DBTool is used for maintenance and other database operations.
It is included with every installation of the database service or can be installed as an individual component. DBTool.exe is located in the EasyPost® Mailroom installation folder.
In Mailroom version 6 DBTool.exe will ONLY connect to the database service running on the localhost. This means database operations should be performed on the database server.
Usage and Options
DBTool.exe can be used with various arguments to perform different database tasks. Each main option may have additional sub-options.
-h -help -? | Display information for a specific main option. Example: "dbtool -h b" will display backup options. |
-auto | Automatically answer all questions. Can be used for unmanned executions. |
-i -info | Display database status and configuration information. |
-b -backup | Backup database. |
-r -restore | Restore database from a backup. |
-c -clean | Clean database of unused data. |
-cp -copy_packs | Copy mailings to/from another database or location/ |
-auto
Automatically answer all questions. Possible arguments are "yes" or "no".
dbtool -auto no // Sets "no" as the answer to any question.
-i -info
Display database status and configuration information.
Possible sub-options are:
-db <dbname>
Show current status and size information of a specific database.
-all
Show current status and size information for all databases.
Examples:
dbtool -i dbtool -i -db ABC12345 dbtool -i -all
-b -backup
Backup the database without locking it and truncate transaction logs. The created backup will be current operation's start time, but may include some data modified during the backup operation. The operation will overwrite any previous backup stored in the same location.
Possible sub-options are:
-db <dbname>
Specify database name to backup. Required unless using -all.
-all
Backup all databases. When this option is specified the db option is ignored and if <backup path> is provided, it is assumed to be a folder path.
<backup path>
Absolute path in which to store the backup. If this option is not used the backup will be stored in the location as defined by the database configuration.
A predetermined file name and/or extension is appended automatically when necessary.
Examples:
dbtool -b -db ABC12345 "C:\Backups" // Backs up database ABC12345 to file c:\Backups\ABC12345.epbak dbtool -b -all // Backs up all databases to default location i.e. "C:\ProgramData\EasyPost\db\db.backup\usera.epbak" "userb.epbak" etc.
-r -restore
Restore database from a backup. If the database being restored exists, this operation will attempt to lock the database and overwrite any existing data. The default backup file is used to restore the data from, unless a full path to a backup file is specified as an additional argument.
Possible sub-options are:
-db <dbname>
Set target database. Required unless using -all or restoring from a specific backup file.
-all
Restore all databases. When this option is specified the target db option is ignored and if <backup path> is provided, it is assumed to be a folder path.
<backup path>
Absolute path to a backup file. If used with -all it is assumed to be a folder path. When -db is not specified, the target database name is taken from the backup file content.
If this option is not used the backup will be restored from the default location as defined by database configuration.
Examples:
dbtool -r -db ABC12345 // Restores database ABC12345 backup from the default location. dbtool -r -db archive C:\Backups\db.epbak // Restores the backup db.epbak to a database named archive. dbtool -r -all // Restores all backups from the default location. dbtool -r -all c:\Backups // Restores all backups from the specified location.
-c -clean
Clean the database of unused/deleted data without locking the database. Any deleted items and unreferenced data will be permanently removed. It is possible to specify some mailings to be removed as well. Multiple sub-options can be combined to better define which mailings to remove, except where explicitly denied.
By default attachments and letterheads are excluded unless using -f option.
Possible sub-options are:
-db <dbname>
Set target database. Required unless using -all
-all
Clean all databases. When this option is specified the target db option is ignored.
-f <folder_type>
Remove specific types of mailings. Can be one of "all", "new", "draft", "submit", "upload", "final”, "attach", or "letterhead". "all" requires date range or title/id match (see below).
+n
Remove mailings older than N days.
dd/mm/yyyy
Remove mailings older than the specified date. The date format is <day in month>/<month from 1 to 12>/<full year>.
-t <title>
Remove mailings by title, comparison is case sensitive. Explicit confirmation needed for each found mailing.
-tr <title regex>
Remove mailings with titles matched using a regular expression. Explicit confirmation needed for each found mailing.
-id <epid>
Remove mailings using it's unique id. Explicit confirmation needed.
-idr <epid regex>
Remove mailings with ids matched using a regular expression. Explicit confirmation needed for each found mailing.
Examples:
dbtool -c -db ABC12345 // Clean database ABC12345 removing all deleted mailings. dbtool -c -all // Clean all databases removing all deleted mailings. dbtool -c -db ABC12345 +90 // Clean database ABC12345 removing all mailings older than 90 days. dbtool -c -db ABC12345 01/01/2025 -f all // Clean database ABC12345 removing mailings older than 01/01/2025 including attachments and letterheads. dbtool -c -all -tr "Invoice.*" // Clean all databases removing mailings matching title regex Invoice.*
-cp -copy_packs
Copy mailings from another source, optionally constrained by mailing creation time. If a mailing already exists in the target database it may be overridden unless currently locked.
Possible sub-options are:
-start_date <dd/mm/yyyy>
The minimum creation date for the source mailings. Ignored when importing from file.
-end_date <dd/mm/yyyy>
The upper boundary for creation date for the source mailings. Ignored when importing from file.
-db <target>
Set target.
-src_db <source>
Set source.
-all
Copy all databases.
Depending on the target and source format, copy packs can operate in 3 different modes: Copy, Export and Import.
Copy from another database service.
-db <dbname> - Target local database.
-src_db <source> - Remote source database in format <host\database>.
-all - Can be used instead of -db. Copies from all databases from a host.
Examples:
dbtool -cp -db ABC12345 -src_db server\john \\ copies all mailings from database "john" on host "server" to database "ABC12345". dbtool -cp -db ABC12345 -src_db server\john -start_date 01/01/2024 \\ as above with the additional option to only copy mailings created after 01/01/2024. dbtool -cp -all -src_db server\ \\ copies all mailings from all databases on host "server".
Export to compressed zip file.
-db <folder> - Target folder path where <database>.zip file will be saved.
-src_db <dbname> - Source database.
-all - Can be used instead of instead of -src_db. Copies from all databases.
Examples:
dbtool -cp -db C:\folder -src_db john \\ copies mailings from database john to c:\folder\john.zip dbtool -cp -db \\server\folder -all -start_date 01/01/2024 -end_date 01/01/2025 // copies 2024 mailings from all databases to \\server\folder\<database>.zip (each db has it's own .zip archive).
Import from zip file or folder. Zip file must contain only .ezp files.
-db <dbname> - Target database.
-src_db <file or folder> - Source path to import mailings from. Can be single zip into target database or path to folder containing multiple zips if used with -all.
-all - Can be used instead of instead of -db. Copies from all zip files in a folder.
Examples:
dbtool -cp -db john -src_db C:\folder\john.zip \\ imports mailings from specified zip file into target database john. dbtool -cp -all -src_db \\server\folder \\ imports mailings from all zips in \\server\folder to databases of the same name.