Excellence Cloud Database Export Guide
GUIDE

How to restore a database export

Step-by-step instructions for restoring an exported .sql file to a local PostgreSQL database, using PyCharm or pgAdmin.

Before you start

  • PostgreSQL is installed on your machine.
  • PyCharm (or a JetBrains IDE with database tools) or pgAdmin is installed.
  • You have the exported .sql file downloaded from the Instance Controller.
  • You have the DB user for restore value copied from the instance page (shown next to the Export Database button).
Steps
1
Register your local PostgreSQL server (if not done already)

Open PyCharm and go to View → Tool Windows → Database. Click the + button and select Data Source → PostgreSQL.

PyCharm — add data source

In the connection settings, fill in:

  • Host: localhost
  • Port: 5432
  • User: django
  • Password: lundadminlocal
PyCharm — connection settings

Click Test Connection to verify, then click OK.

2
Create the required database users

The database username you need is shown on the instance page next to the Export Database button, labelled DB user for restore. Copy it before continuing.

If you no longer have access to the instance page, open the .sql file in a text editor and search for OWNER TO — the name that follows it is the username.


Create the users

In the Database panel, right-click your PostgreSQL server and select New → User. Fill in the username and password, then repeat for the second user.

PyCharm — New → User menu

Grant privileges via query console

Right-click the server and select New → Query Console, then run the GRANT statements below.

Run the following in the query console, replacing the placeholders:

GRANT ALL PRIVILEGES ON DATABASE <database_name> TO initdeploy;
GRANT ALL PRIVILEGES ON DATABASE <database_name> TO <instance_user>;
If a user already exists from a previous restore, you can skip creating it again — go straight to the GRANT statements.
3
Restore the database

In the Database panel, right-click your target database and select Restore. In the restore dialog:

  1. Set Path to executable to your local psql binary:
    C:\Program Files\PostgreSQL\[Version]\bin\psql.exe
  2. Select your downloaded .sql file as the input.
  3. Click Run.
PyCharm — restore dialog PyCharm — restore settings

The restore may take a minute depending on the size of the dump. Once complete, all tables and data will be available in your local database.

Expected warnings: You may see errors about the google_vacuum_mgmt extension not being available locally. These are harmless and do not affect the restored data.

You're done

Your local database now contains a copy of the exported instance data. You can connect to it from your local LEX setup by pointing it at the restored database. Remember that this is a point-in-time snapshot — any changes made in the instance after the export are not included.