The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Backup Postgresql

Discussion in 'Database Discussions' started by alexandz, Oct 28, 2011.

  1. alexandz

    alexandz Well-Known Member

    Joined:
    Oct 28, 2011
    Messages:
    111
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Chile
    cPanel Access Level:
    Root Administrator
    How to backup postgresql?
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You can back up postgres with the following commands in root SSH:

    Code:
    su - postgres
    pg_dumpall > /tmp/pg111102
    exit
    This would save the dump file to /tmp with the name pg111102 (for today's date). You can name the file whatever you prefer and put it into any location you prefer.

    To restore the database dump, you’d do the following:

    Code:
    su - postgres
    psql -f /tmp/pg111102 template1
    exit
     
  3. alexandz

    alexandz Well-Known Member

    Joined:
    Oct 28, 2011
    Messages:
    111
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Chile
    cPanel Access Level:
    Root Administrator
    Thank you :)
     
  4. riyast

    riyast Registered

    Joined:
    Nov 15, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    For taking postgresql backup one can follow the steps below:

    Login to the server VIA ssh,
    su - postgres
    pg_dumpall > /tmp/backup_filename
    exit

    For restoring the backup
    su - postgres
    psql -f /tmp/backup_filename file
    exit


    Riyas
     
Loading...

Share This Page