How to use pg_dump to copy a table from one Airwave server to another?
Scenario: Need to copy guest user accounts from one Airwave to another.
pg_dump is a utility for backing up a PostgreSQL database. It makes consistent backups even if the database is being used concurrently. Dumps can be output in script or archive file formats. Script dumps are plain-text files containing the SQL commands required to reconstruct the database to the state it was in at the time it was saved.
Execute the command -> # pg_dump -t guest_user -U airwave airwave > /tmp/guest_user
This command will generate a file guest_user in /tmp directory and it will contain all the commands to create a table and all the guest user exist in the database.
In order to import the guest users using the exported backup, the table should be dropped first.
Executing the command will do it, # dbc 'drop table guest_user'
Using the cat command, guest users could be imported, # cat /tmp/guest_user | db
This command will create the table first, then copy the contents to it.