0

This evening a developer asked to restore only schemas from a database into another database. A colleague of mine did this, but after that the developer came to me saying that the sequences are missing from the restored schema.

I think this was the command my colleague used to get a dump of the schema only :

/usr/local/pgsql915/bin/pg_dump -U backupuser --schema-only myegrtx -p 5432 -t tb_roadtax_kioskinfo -t tb_rtx_expdelivery_postcode -t tb_roadtax_inquiryinfo -t roadtax_tx_history -t tb_roadtax_payment_data_info -t tb_roadtax_renewalinfo -t tb_roadtax_kioskusers -t tb_roadtax_kioskuser_trans -t tb_roadtax_delivaryinfo -t tb_roadtax_asinfo  -t tb_roadtax_disk_print_info > myegrtxbike-schema.sql

And this was the command to restore it to the new db :

/usr/local/pgsql934/bin/psql -U postgres -d myegrtxbike -p 6434 -f srikanth/myegrtxbike-schema.sql

How do I now get the backup of and restore the sequences that have been reported missing?

I need some guide on this, as googling the commands is not a success (The commands do not work or I do not get the proper commands, especially for the sequence part).

1 Answer 1

1

Simply add -t <sequencename> for all the sequences you want to dump.

1
  • 1
    It is useful to remember that -t can be used with wildcards such as *_id_seq. Don't forget to take care of your shell's quoting rules if doing this from a shell! Commented Jun 11 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.