Migrating the database

Migrating the database is carried out by dumping the current database, and then restoring the data in the new database. These two functions should be carried out by your database administrator using the pg_dump and psql commands. The first act is to dump the old helpdesk database to a file (such as migration.sql):

#> pg_dump -U chosen_username -W -d -c -f migration.sql helpdesk

Then on the new server, assuming the new database server has been installed correctly, you should create an empty helpdesk database using the following commands (please see Setting up the database):

#> su postgres
%> createuser -A -d -E -P chosen_username
%> createdb -U chosen_username -W helpdesk

Then once the migration.sql file has been transferred between the servers, the simple act of restoring the data and schema to your new database is done with the following command:

#> psql -U chosen_username -W helpdesk -f migration.sql

Please be aware that the above is simply a guide for those without experience who wish to try. If you are working on important and sensitive information you should be getting your fully experienced database administrator to do the job. If they're worth their salt, they shouldn't need to read this chapter.