How do I restore my data?

Submitted by ehu on

Assuming you have followed the How Do I Backup My Data instructions, you can restore your database as follows...

Note LedgerSMB versions prior to version 1.9.16 did not support PostgreSQL 14 or higher due to a backward incompatible change in PostgreSQL 14.

Note that the following examples use the  'lsmb_dbadmin' for the database administrative user. Recent LedgerSMB installs do not automatically create an 'lsmb_dbadmin' user.  This has to be created manually.  You may have to use the 'postgres' user depending on how your database was installed.

1) Restore the roles

$ psql -h [database host] -U [database admin user] < [roles backup file]

For example:

$ psql -h localhost -U lsmb_dbadmin < lsmb-roles.sqlc

2) Create a new database to restore into

$ psql -h [database host] -U [database admin user] -c 'CREATE DATABASE [new company name]'

For example:

$ psql -h localhost -U lsmb_dbadmin -c 'CREATE DATABASE newcompany'

3) Restore the company backup into the new database:

$ psql -h [database host] -U [database admin user] [new company name] < [company backup file]

For example:

$ psql -h localhost -U lsmb_dbadmin newcompany < lsmb-db.sqlc
FAQ Category
Topic