Backingup and Restoring with PostgreSQL

Have more questions? Submit a request


HOW TO MAKE A BACKUP

*Before you start, make sure you know your database password (oasispg).*

  1. Select your database
    Open pgAdmin and expand the "Servers" tree on the left. Find your database named "OASIS", right-click its name, and select "Backup..."

 

 

  1. Name your backup file
    In the "General" tab, click the "..." button next to the "Filename" box. Choose a folder where you want to save it, type a name for your file (like "OASIS_backup.sql"), and click "Save".

 

 

 

  1. Choose the format
    In that same window, change the "Format" dropdown to "Custom". (This is important because it makes restoring much easier later).

 

 

  1. Set the roll name
    In that same window, change the "Role name" dropdown to "OASIS". 

 

 

  1. Run the backup
    Click the "Backup" button at the bottom right. A little pop-up will appear in the bottom corner telling you when the backup is successfully completed.

 

 

 

 

HOW TO RESTORE A BACKUP

*To avoid data conflicts, you always want to restore into a fresh, empty target database.*

PART A: CREATE THE "OASIS" USER WITH FULL PRIVILEGES

  1. Open the Login window
    In the left-hand tree, expand your server. Right-click on the words "Login/Group Roles" and select "Create > Login/Group Role..."

 

 

  1. Name the user
    In the "General" tab, type the name "OASIS" in the "Name" box.

 

 

  1. Set the password
    Switch to the "Definition" tab. Type "oasispg" into the "Password" box.

 

 

  1. Grant Superuser/Full privileges
    Switch to the "Privileges" tab. Turn on the following switches to give full power:
    * Set "Can login?" to YES
    * Set "Superuser" to YES (This automatically grants full privileges across the database)

 

 

  1. Save the user
    Click the "Save" button at the bottom right.

 

 


PART B: CREATE THE TARGET DATABASE

  1. Open the creation window
    In the left-hand tree, right-click on the word "Databases" and select "Create > Database..."

 

 

  1. Name and assign the database
    In the "General" tab, type "OASIS" in the "Database" box. 
    Change the "Owner" dropdown menu to your newly created user: "OASIS".

 

 

  1. Save and create
    Click the "Save" button at the bottom right. You will see your brand-new, empty "OASIS" database appear in the list on the left.

 

 


PART C: RUN THE RESTORE

  1. Open the Restore tool
    Right-click your newly created "OASIS" database and select "Restore..."

 

 

  1. Select your backup file
    In the "General" tab, change the "Format" dropdown to "Custom or tar". Then, click the "..." button next to "Filename", locate the backup file ("OASIS_backup.sql"), and select it.

 

 

 

 

  1. Run the restore
    Click the "Restore" button at the bottom right. pgAdmin will process the file using your backup data and alert you in the bottom right corner when the process has started and is complete.

 

 

 

 

Articles in this section

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.