Re: Need help how to manage a couple of daily DB copies.

From: DDT <410845160(at)qq(dot)com>
To: Andreas <maps(dot)on(at)gmx(dot)net>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Need help how to manage a couple of daily DB copies.
Date: 2013-10-25 03:14:35
Message-ID: tencent_3C4ACA1B4460F818199C0333@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear,

Append following command to crontab:

D=`date -d -5day +"%Y%m%d"`;echo "DROP DATABASE test_db_$D" | psql

Maybe you should change the "psql" to your psql path.

------------------ Original ------------------
From: "Andreas";<maps(dot)on(at)gmx(dot)net>;
Date: Fri, Oct 25, 2013 09:53 AM
To: "pgsql-general"<pgsql-general(at)postgresql(dot)org>;

Subject: [GENERAL] Need help how to manage a couple of daily DB copies.

Hi,

I'd like to set up a DB-Server that keeps copies of our productive db for an external db-assistant.
He should prepare chores on the test-server and mail the sql scripts to me.
I'll look over those scripts and run them against the productive db myself.

So I'd like to have a daily cron job dump the main db, rename the test-db to something with a date in it.
Like test_db --> test_db_20131024
Create a new test_db and import the dump of the main db.

So far no problem but how could I limit the number of test_dbs to 5?
I'd like to keep those test_dbs 5 days and then drop them.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message DDT 2013-10-25 05:19:59 Re: Replication and fsync
Previous Message Andreas 2013-10-25 02:50:22 Re: Need help how to manage a couple of daily DB copies.