Monitoring, Management & Location Tracking

How to use pg_dump to copy a table from one Airwave server to another?

Aruba Employee
Requirement:

Scenario: Need to copy guest user accounts from one Airwave to another.



Solution:

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.



Configuration:

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'



Verification

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.

Version history
Revision #:
2 of 2
Last update:
‎03-18-2017 11:46 AM
Updated by:
 
Labels (1)
Contributors
Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: