Database Import

Importing a PostgreSQL database dump involves a few key steps to ensure the data is accurately and safely restored.

Prerequisites

  • Installed PostgreSQL client (CLI).
  • Remote access to the DBaaS Instance.
  • Existing User and Database.
  • The PostgreSQL dump file you wish to import.

Prepate the PostgreSQL Dump File

If you haven’t created a dump of your database, use pg_dump. Connect to the host of the source database and run:

pg_dump -U username -W -F c database_name > dump_file.dump
  • U: username: Your database username.
  • W: Prompts for the password of the database user.
  • F c: Creates a custom-format archive suitable for input into pg_restore.

Import the Dump

This method streams the dump file contents to the remote DBaaS instance.

psql -U remote_username -h remote_host -W -d remote_database_name -f dump_file.sql

Verify the Import

Connect to the Remote Database.

psql -U remote_username -h remote_host -W -d remote_database_name

Check for the Presence of Tables.

\dt

If you encounter errors during the import or need configuration adjustments (e.g. while importing a large dump), please open a ticket.

Last modified 03.05.2024: dos2unix mansvc files (d79b1ea)