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 operation 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.
|-db||Explicitly specify target database name.|
|-b -backup||Backup database.|
|-r -restore||Restore database from a backup.|
|-c -clean||Clean database of unused data.|
|-cp -copy_packs||Copy mailings from other database.|
Automatically answer all questions. Possible arguments are "yes" or "no".
dbtool -auto no
will set "no" as the answer to any question.
Specify target database name. Required unless using -all sub-option. Requires the database name.
Possible sub-options: -b, -r, -c, -cp
dbtool -db ABC12345 -b
Executes a backup command against the ABC12345 database.
Backup the database without locking it and truncate transaction logs. The created backup will be current as at the time the operation was started, but may include some data modified during the backup operation. The operation will overwrite any previous backup stored in the same location.
Set target database
Possible sub-options are:
Backup 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.
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 database configuration.
A predetermined file name and/or extension is appended automatically when necessary.
dbtool -db ABC12345 -b "C:\Backups"
Backs up the ABC12345 database to file ABC12345.epbak
dbtool -b -all
Backs up all databases to default backup location e.g. "C:\ProgramData\EasyPost\db\db.backup\usera.epbak" "userb.epbak" etc.
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.
Set target database. Required unless using -all or restoring from a specific backup file.
Possible sub-options are:
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.
Absolute path to a backup file. If used with -all it is assumed to be a folder path. If this option is not used the backup will be restored from the default location as defined by database configuration.
dbtool -db ABC12345 -r
Restores database ABC12345 from backup in default location.
dbtool -db archive -r C:\MailroomBackups\db.epbak
Restores the database backed up as db.epbak to a database named archive.
dbtool -r -all
Restores all database backups in the default location.
dbtool -r -all c:\mailroom\backups
Restores all database backups located in the specified location.
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 old submitted mailings to be removed as well:
+N will delete mailings older than N days.
dd/mm/yyyy will delete mailings older than the specified date. The date format is <day in month>/<month from 1 to 12>/<full year>
Set target database. Required unless using -all.
Clean all databases. When this option is specified the target db option is ignored.
Clean all mailing types i.e. New, Draft, Letterheads and Attachments.
dbtool -db ABC12345 -c
Delete all deleted mailings and unreferenced items from target database ABC12345.
dbtool -db ABC12345 -c +90
Delete all submitted mailings older than 90 days and remove unreferenced data from database ABC12345.
dbtool -db ABC1234 -c 01/12/2019 -all_types
Delete all types of mailings created before 01/12/2019 and remove unreferenced data from database ABC12345.
dbtool -c -all
Delete all deleted mailings and unreferenced items from all databases.
dbtool -c -all +90
Delete all submitted mailings older than 90 days and remove unreferenced items from all databases.
Copy mailings from other database. If no restrictions are specified all mailings will be copied. If a mailing already exists in the target database and is locked it will not be overridden.
Possible sub-options are:
Set target database. Required.
Specify the source database to copy the packs from. <db> requires format host\database connection string.
The minimum creation date for the source mailings.
The upper boundary for creation date for the source mailings.
dbtool -db ABC12345 -cp -src_db server\john
Will copy all mailings from database "john" on host server. To restrict packs to a date range use the following example.
dbtool -db ABC12345 -cp -src_db server\john -start_date 01/01/2019