You might want to import/export the PostgreSQL DB in the following situations:

  • Moving the DB from one server to another (for example, staging to production).
  • Moving from one architecture to another (HA, external DB).

Export Siemplify databases

  1. Change to postgres user by using this command:
    su postgres
  2. Execute the following commands by using the pg_dump command:
pg_dump siemplify_agents_db>siemplify_agents_db.bak
pg_dump siemplify_dashboards_db>siemplify_dashboards_db.bak
pg_dump siemplify_entityexplorer_db>siemplify_entityexplorer_db.bak
pg_dump siemplify_homepage_db>siemplify_homepage_db.bak
pg_dump siemplify_integrations_db>siemplify_integrations_db.bak
pg_dump siemplify_jobs_db>siemplify_jobs_db.bak
pg_dump siemplify_metadata_db>siemplify_metadata_db.bak
pg_dump siemplify_monitoring_db>siemplify_monitoring_db.bak
pg_dump siemplify_notifications_db>siemplify_notifications_db.bak
pg_dump siemplify_ontology_db>siemplify_ontology_db.bak
pg_dump siemplify_orchestration_db>siemplify_orchestration_db.bak
pg_dump siemplify_report_system_db>siemplify_report_system_db.bak
pg_dump siemplify_search_everything_db>siemplify_search_everything_db.bak
pg_dump siemplify_system_db>siemplify_system_db.bak
pg_dump siemplify_command_center_db>siemplify_command_center_db.bak
pg_dump siemplify_configuration_db>siemplify_configuration_db.bak
pg_dump siemplify_layout_view_db>siemplify_layout_view_db.bak
pg_dump siemplify_queues_db>siemplify_queues_db.bak
pg_dump siemplify_simulation_db>siemplify_simulation_db.bak
pg_dump siemplify_usecases_db>siemplify_usecases_db.bak
  1. Verify that all the backup files are in the current folder:
  2. Move these files into the postgres folder (in the target server) using this command:
  3. If you receive a permission denied message, run the following commands:
    1. cd /tmp/
    2. mkdir backup && chmod -R 777 backup
    3. While using pg_dump command with postgres user, run the pg dump commands as follows:
      pg_dump siemplify_agents_db > /tmp/backup/siemplify_agents_db.bak

Import Backup Files

  1. Connect to the DB via CLI as follows:
    sudo -u postgres psql
  1. Delete the existing databases (by using the DROP command):
DROP DATABASE siemplify_agents_db;
DROP DATABASE siemplify_dashboards_db;
DROP DATABASE siemplify_entityexplorer_db;
DROP DATABASE siemplify_homepage_db;
DROP DATABASE siemplify_integrations_db;
DROP DATABASE siemplify_jobs_db;
DROP DATABASE siemplify_metadata_db;
DROP DATABASE siemplify_monitoring_db;
DROP DATABASE siemplify_notifications_db;
DROP DATABASE siemplify_ontology_db;
DROP DATABASE siemplify_orchestration_db;
DROP DATABASE siemplify_report_system_db;
DROP DATABASE siemplify_search_everything_db;
DROP DATABASE siemplify_system_db;
DROP DATABASE siemplify_command_center_db;
DROP DATABASE siemplify_configuration_db;
DROP DATABASE siemplify_layout_view_db;
DROP DATABASE siemplify_queues_db;
DROP DATABASE siemplify_simulation_db;
DROP DATABASE siemplify_usecases_db;
  1. Create new (and empty) databases:
CREATE DATABASE siemplify_agents_db;
CREATE DATABASE siemplify_dashboards_db;
CREATE DATABASE siemplify_entityexplorer_db;
CREATE DATABASE siemplify_homepage_db;
CREATE DATABASE siemplify_integrations_db;
CREATE DATABASE siemplify_jobs_db;
CREATE DATABASE siemplify_metadata_db;
CREATE DATABASE siemplify_monitoring_db;
CREATE DATABASE siemplify_notifications_db;
CREATE DATABASE siemplify_ontology_db;
CREATE DATABASE siemplify_orchestration_db;
CREATE DATABASE siemplify_report_system_db;
CREATE DATABASE siemplify_search_everything_db;
CREATE DATABASE siemplify_system_db;
CREATE DATABASE siemplify_command_center_db;
CREATE DATABASE siemplify_configuration_db;
CREATE DATABASE siemplify_layout_view_db;
CREATE DATABASE siemplify_queues_db;
CREATE DATABASE siemplify_simulation_db;
CREATE DATABASE siemplify_usecases_db;
  1. Change the owner of the DB to the local user using by siemplify (default – sa)
ALTER DATABASE siemplify_agents_db   OWNER TO sa;
ALTER DATABASE siemplify_dashboards_db OWNER TO sa;
ALTER DATABASE siemplify_entityexplorer_db OWNER TO sa;
ALTER DATABASE siemplify_homepage_db OWNER TO sa;
ALTER DATABASE siemplify_integrations_db OWNER TO sa;
ALTER DATABASE siemplify_jobs_db OWNER TO sa;
ALTER DATABASE siemplify_metadata_db OWNER TO sa;
ALTER DATABASE siemplify_monitoring_db OWNER TO sa;
ALTER DATABASE siemplify_notifications_db OWNER TO sa;
ALTER DATABASE siemplify_ontology_db OWNER TO sa;
ALTER DATABASE siemplify_orchestration_db OWNER TO sa;
ALTER DATABASE siemplify_report_system_db OWNER TO sa;
ALTER DATABASE siemplify_search_everything_db OWNER TO sa;
ALTER DATABASE siemplify_system_db OWNER TO sa;
ALTER DATABASE siemplify_command_center_db OWNER TO sa;
ALTER DATABASE siemplify_configuration_db OWNER TO sa;
ALTER DATABASE siemplify_layout_view_db OWNER TO sa;
ALTER DATABASE siemplify_queues_db OWNER TO sa;
ALTER DATABASE siemplify_simulation_db OWNER TO sa;
ALTER DATABASE siemplify_usecases_db OWNER TO sa;
  1. Verify the databases. They should display as in the screenshot below:
  1. Exit postgres, and change the user to postgres by using this command:
    su postgres
  1. Make sure that all the .bak files are located in the postgres folder:
  1. Run the following commands to load the .bak files into the empty databases:
psql -U postgres siemplify_agents_db < siemplify_agents_db.bak
psql -U postgres siemplify_dashboards_db < siemplify_dashboards_db.bak 
psql -U postgres siemplify_entityexplorer_db < siemplify_entityexplorer_db.bak
psql -U postgres siemplify_homepage_db < siemplify_homepage_db.bak
psql -U postgres siemplify_integrations_db < siemplify_integrations_db.bak
psql -U postgres siemplify_jobs_db < siemplify_jobs_db.bak
psql -U postgres siemplify_metadata_db < siemplify_metadata_db.bak
psql -U postgres siemplify_monitoring_db < siemplify_monitoring_db.bak
psql -U postgres siemplify_notifications_db < siemplify_notifications_db.bak
psql -U postgres siemplify_ontology_db < siemplify_ontology_db.bak
psql -U postgres siemplify_orchestration_db < siemplify_orchestration_db.bak
psql -U postgres siemplify_report_system_db < siemplify_report_system_db.bak
psql -U postgres siemplify_search_everything_db < siemplify_search_everything_db.bak
psql -U postgres siemplify_system_db < siemplify_system_db.bak
psql -U postgres siemplify_command_center_db < siemplify_command_center_db.bak
psql -U postgres siemplify_configuration_db < siemplify_configuration_db.bak
psql -U postgres siemplify_layout_view_db < siemplify_layout_view_db.bak
psql -U postgres siemplify_queues_db < siemplify_queues_db.bak
psql -U postgres siemplify_simulation_db < siemplify_simulation_db.bak
psql -U postgres siemplify_usecases_db < siemplify_usecases_db.bak
  1. Run Siemplify server and validate the database (cases, playbooks, users, etc.)

Need more help with this?
Click here to open a Support ticket

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.