Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Backup Postgresql

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

  1. alexandz

    alexandz Well-Known Member

    Joined:
    Oct 28, 2011
    Messages:
    111
    Likes Received:
    0
    Trophy Points:
    66
    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,609
    Likes Received:
    32
    Trophy Points:
    238
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. alexandz

    alexandz Well-Known Member

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

    riyast Registered

    Joined:
    Nov 15, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    51
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice