You will take a fresh dump and bring it up where it cannot break anything: in a new, empty database.
A dump is tested by restoring it into a separate database next to the working one. createdb name creates an empty database; your role has the CREATEDB right. Then pg_restore -d name file: the working database takes no part at all.
pg_dump -Fc -d shop -f file captures the database as it is at the moment of the run, even if the application keeps writing. Yesterday's dump knows nothing about today's orders.
In an empty database pg_restore should hit no errors at all: an error means the copy is incomplete. --exit-on-error stops it at the first error, and --single-transaction runs the whole dump as one transaction: on an error nothing is applied.
A dump remembers owners: it contains ALTER TABLE … OWNER TO student. If you restore as another role, add --no-owner: that role becomes the owner of the objects.
Take a dump and bring up a copy
In ~/backup, take a fresh dump of the shop database in the custom format into shop-new.dump and restore it into a new database, shop_check. Leave shop alone.
Goals · 0 of 2
- Take a fresh dump of shop not done yet
- Restore it into a new database, shop_check not done yet