Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8329997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:58:46+00:00 2026-06-09T01:58:46+00:00

I would like to backup my production database before and after running a database

  • 0

I would like to backup my production database before and after running a database migration from my deploy server (not the database server) I’ve got a Postgresql 8.4 server sitting on a CentOS 5 machine. The website accessing the database is on a Windows 2008 server running an MVC.Net application, it checks out changes in the source code, compiles the project, runs any DB Changes, then deploys to IIS.

I have the DB server set up to do a crontab job backup for daily backups, but I also want a way of calling a backup from the deploy server during the deploy process. From what I can figure out, there isn’t a way to tell the database from a client connection to back itself up. If I call pg_dump from the web server as part of the deploy script it will create the backup on the web server (not desirable). I’ve looked at the COPY command, and it probably won’t give me what I want. MS SQLServer lets you call the BACKUP command from within a DB Connection which will put the backups on the database machine.

I found this post about MySQL, and that it’s not a supported feature in MySQL. Is Postgres the same? Remote backup of MySQL database

What would be the best way to accomplish this? I thought about creating a small application that makes an SSH connection to the DB Server, then calls pg_dump? This would mean I’m storing SSH connection information on the server, which I’d really rather not do if possible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:58:48+00:00Added an answer on June 9, 2026 at 1:58 am

    Create a database user pgbackup and assign him read-only privileges to all your database tables.

    Setup a new OS user pgbackup on CentOS server with a /bin/bash shell.

    Login as pgbackup and create a pair of ssh authentication keys without passphrase, and allow this user to login using generated private key:

    su - pgbackup
    ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N ""
    cp -a ~/.ssh/.id_rsa.pub ~/.ssh/authorized_keys
    

    Create a file ~pgbackup/.bash_profile:

    exec pg_dump databasename --file=`date +databasename-%F-%H-%M-%S-%N.sql`
    

    Setup your script on Windows to connect using ssh and authorize using primary key. It will not be able to do anything besides creating a database backup, so it would be reasonably safe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We would like to use a cronjob to create a database backup. The backup
Having properly configured a Development server and a Production server, I would like to
I would like to know why is this: backup.sql file not being accepted by
We would like to be able to nightly make a copy/backup/snapshot of a production
I have a backup server that replicates my production server's mysql database, awhile ago
I have a backup log file from robocopy and would like to take last
I would like to backup a dir in Win XP on a Solaris server
I would like to know which backup software to use with my ubuntu server
I would like to know how people tackle backup and restore of data in
I would like to know the on disk format of an RMAN backup file.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.