- Check Available Databases: Confirm that the database you want to write to is present. You can check the databases available in your PostgreSQL instance using:
\l- Connect to the Database:
Connect to the
my_dbdatabase using:
\c my_db- Check Schemas:
Check the schemas in the
my_dbdatabase using:
\dn- Install PostGIS Extension:
Run the following command to ensure the PostGIS extension was available in your
my_dbdatabase:
CREATE EXTENSION IF NOT EXISTS postgis;This will successfully install PostGIS, enabling spatial data types like geometry.
- Restore the Backup: The restore command to bring back the data from the backup:
pg_restore -U postgres -d nyc /tmp/data/nyc_data.backup- Verify the Tables:
After the restore, you can use the following to list the tables in the
publicschema:
\dt public.*Confirm that the tables from your backup were restored correctly.