Importing sample data to DHIS2 instance

i have installed dhis2 2.36.13 with tomcat9
postgis 2.4.3 i have checked the extention for postgis as well but still getting “Invalid Commands /N continuously and its not importing anything into the database.” will you please help out with the steps from first to restore sample database sierra leone on dhis2

Hi @Shivaraj_mahato,

Welcome to the community! :tada::tada:

Since the topic post you posted in was three years old and a lot has changed, I moved your post to a new topic post - thanks!

Sample data can be used in a dhis2 instance but the method of importing differs on which method you used to install the dhis2 instance. Are you using a server or did you spin up a local instance using d2 cluster in docker? Would you please share the installation guide you used?

If you’re on a server instance, as mentioned in the website: “The PostgreSQL file must be gunzipped and can be imported through pgAdmin restore function or with psql -d dbname -U username -f dhis2-db-sierra-leone.sql.”

If you ran a local instance using d2 then all would be needed is to run the command d2 cluster up [dhis2-instance-version-here] --db-version [database-version-here] --seed(here’s more info: DHIS2 CLI) And here’s the guide on How to spin up a DHIS2 local instance | DHIS2 Developer Portal

i followed this guide to install DHIS2 :-1: DHIS2 Installation on Ubuntu 19.04 LTS – Digital Ocean – DHIS2 Web Portal

i am using server with os ubuntu 18.04 …
for sample database i have downloaded it frm “” and followed the guide as mentioned::
To work with the database you can gunzip it:
gunzip dhis2-db-sierra-leone.sql.gz
Restore it using psql with a command like:
psql -d “” -U -f dhis2-db-sierra-leone.sql

and got these errors::
DETAIL: Key (programsectionid)=(1497623) is not present in table “programsection”.
psql:dhis2-db-sierra-leone.sql:5503781: ERROR: column “dataentryform” of relation “programstage” does not exist
psql:dhis2-db-sierra-leone.sql:5503782: invalid command \N
psql:dhis2-db-sierra-leone.sql:5503783: invalid command \N
psql:dhis2-db-sierra-leone.sql:5503784: invalid command \N
psql:dhis2-db-sierra-leone.sql:5503785: invalid command \N
psql:dhis2-db-sierra-leone.sql:5503786: invalid command \N
psql:dhis2-db-sierra-leone.sql:5503787: invalid command \N
psql:/home/ubuntu/Downloads/dhis2-db-sierra-leone.sql:7182497: ERROR: constraint “fky5d5y7ryw9s2gn7nc6jnsf22” for relation “trackedentityinstancereminder” already exists
psql:/home/ubuntu/Downloads/dhis2-db-sierra-leone.sql:7182505: ERROR: constraint “pk_dataset_dataentrystatus” for relation “dataentrystatus” already exists

Hi @Shivaraj_mahato
I found a similar discussion in another post and would like to quote what lead to the solution:

I really recommend you remove the dhis2 database you tried to install and then try to recreate because trying over and over before removing will probably fail. Hopefully the steps shared by Ulanbek will solve the issue.

And if that doesn’t work, please share versions used in your environment specifically Postgresql version?

Thank you!