I understand how to backup and restore a number of schema(s) from a PostgreSQL database utilizing psql:
- Go to the folder that accommodates the executables of PostgreSQL:
cd C:Program FilesPostgreSQL11bin
- Hook up with the database:
psql -U person -p port -d database
- Rename the schema to lowercases:
ALTER SCHEMA “schema_name”
RENAME TO “lowercase_schema_name”;
- Exit PostgreSQL:
- Save the schema(s) utilizing the -n flag:
pg_dump -U person -p port -n schema1 -n schema2 database > “C:pathtodirectoryschema_backup.sql”
- Add the schema(s) to the specified database (the present schemas are preserved):
psql -U person -p port -d database -f”C:pathtodirectoryschema_backup.sql”
This process works effectively and is fast to carry out. Nonetheless, as I’ve to ask uninitiated folks to do it, I’d have preferred to not should undergo the command immediate, however solely via PgAdmin GUI.
It is extremely easy in PgAdmin to export and import a whole database by right-clicking on the database and utilizing the backup and restore instruments. Nonetheless, I am unable to do the identical factor only for one explicit schema. In the identical means as with psql (as described above), I need to save just one (ore extra) schema(s) after which import it right into a given database. After I save the schema in .sql format, create a brand new clean schema (for instance in the identical database) and backup the saved schema, the tables of the brand new schema are empty…
Any thought how to do that? Possibly I’ve to vary some parameters in Dump choices?