To take a backup of the internal PostgreSQL database, perform the following steps:
Stop Servicedesk service, by running the following command:
service servicedesk stop
witch to postgres user, by running the following command:
sudo -su postgres
Go to the root level (/) or to the /tmp to avoid permission issue warning
Example: cd /tmp
Take database backup and keep it in /tmp location with file name "servicedesk_db.backup"
pg_dump --dbname=servicedesk --file=/tmp/servicedesk_db.backup --encoding=UTF8 --blobs --format tar
Start the service desk service, by running the following command:
service servicedesk start
To restore the internal PostgreSQL database, perform the following steps:
Copy the database backup to the /tmp location
stop Servicedesk service, by running the following command:
service servicedesk stop
Switch to postgres user, by running the following command:
sudo -su postgres
Go to the root level (/) or to the /tmp to avoid permission issue warning
Example: cd /tmp
Drop existing internal database.
If the drop fails, then the database is being used. Example: servicedesk any other database viewer tool. Ensure that you stop those services)
dropdb servicedesk
Create empty internal database, by running the following command:
createdb servicedesk --template=template0 --encoding=UTF8 --owner=sdadmin
Restore database from the backup file, , by running the following command:
pg_restore /tmp/servicedesk_db.backup --dbname=servicedesk -n public
run vacuum command to optimize, by running the following command:
vacuumdb -f -z servicedesk
Start the service desk service, by running the following command:
service servicedesk start