The savapage-db command-line tool provides functions for
manipulating the database. The tool is located in
/opt/savapage/server/bin/linux-x64/
and needs to be
executed from a command prompt. The syntax of the command is:
usage: [OPTION] --db-check Checks database integrity. This is an advanced option. Please contact SavaPage Support before use. --db-check-fix Checks and fixes database integrity. NOTE: Only perform as requested by SavaPage Support. --db-config-get <NAME> Gets configuration property value. This is an advanced option. Please contact SavaPage Support before use. --db-config-set <NAME=VALUE> Sets configuration property value. This is an advanced option. Please contact SavaPage Support before use. --db-delete-logs <DAYS> Deletes application, account transaction and document log data older than DAYS. A DAYS value of zero (0) will remove all log data from the system. --db-export Exports the database to the default backup location. --db-export-to <FILE|DIR> Exports the database to the specified file or directory. --db-import <FILE> Imports the database from the specified file. Deletes any existing data before loading the data. --db-init Re-initializes the database even if it already exists. --db-run-script <FILE> Runs SQL statements from the specified script file. NOTE: Only perform as requested by SavaPage Support. --db-run-sql <STATEMENT> Runs an SQL statement. NOTE: Only perform as requested by SavaPage Support. -h,--help Displays this help text.
The command must be run as the savapage
user. An
example:
sudo su - savapage cd server/bin/linux-x64 ./savapage-db --db-import /home/john/savapage-backup.zip
savapage-db needs exclusive access to the database. It is important that any SavaPage services and processes are stopped before executing a command. Failure to do so will result in a "database in use" error message. The savapage-db command is a powerful low-level utility and its use on a production system should be carefully considered. Details of the available commands are discussed below.
Checks database integrity. This is an advanced option. Please contact SavaPage Support before use.
Checks and fixes database integrity.
Only perform as requested by SavaPage Support.
With this option the (decrypted) value of a Configuration Property can be retrieved. Also see Section C.1.9, “getConfigProperty”.
With this option the value of a Configuration Property can be set (and encrypted). Also see Section C.1.19, “setConfigProperty”.
This option delete old log data from the system. This command will permanently delete the following data.
Document logs - Record all document history and statistics
Transaction logs - Record all financial history and statistics
Application logs - Record application status and error messages
The DAYS option determines what data will be deleted. If DAYS is 90, then all log data more than 90 days old will be deleted. A value of zero (0) will remove all historical log data from the system. This is an example:
savapage-db --db-delete-logs 90
This option exports the data from the database. The application server must be stopped before performing the export. See Section C.5, “Stopping and Starting the Server”.
If you want to perform an online backup without stopping the application server you can use the backup function in the Admin Web App. See Section 4.11.12, “Backups”.
savapage-db --db-export savapage-db --db-export-to /home/john savapage-db --db-export-to /home/john/savapage-backup.zip
The database export file is created in the
| |
This option is used to override the default backup directory.
The filename will still be named
| |
The full path and filename where the backup is saved is specified. |
When executing the command the last line echoed to
stdout
is the canonical path of the database
export file.
The database export zip file contains an unformatted XML file with the
database content (tables and rows). An XML formatter can be enabled by
setting configuration item
system.backup.xmlformatter.enable
to
Y
. See Section 4.11.14, “Config Editor” on how to
set this property.
If the directory or filename parameters contain spaces, then the argument needs to be quoted.
This option imports the data (from a previous export) into the database. The application server must be stopped to perform the import. This is an example:
savapage-db --db-import /home/john/savapage-backup.zip
Progress and statistics of the import process are written to
stdout
.
Before import the database is initialized. Thereby existing data in the database are erased.