PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 27th, 2002, 11:27 PM
ggnanaraj ggnanaraj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 69 ggnanaraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 55 sec
Reputation Power: 11
Automating Backup

I am planning to automate the backup procedure at periodic levels using cron. To generate dump files with a distinction each time, how can I append the date ?

eg.,

pg_dump hris > hris2808021000.dmp

where hris2808021000.dmp has 28 aug 02, 10:00.

Is this possible to auto generate by something like ...

pg_dump hris > hris%date.dmp

Awaiting your response.

Thanks & Regards.

Reply With Quote
  #2  
Old September 6th, 2002, 07:23 PM
Ted Striker Ted Striker is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 409 Ted Striker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
Cool

I just figured this one out today:

pg_dump hris > hris.`date +%A-%b-%d-%Y`

Not the same format as yours but it's pretty slick.

Reply With Quote
  #3  
Old September 8th, 2002, 11:41 AM
donarb donarb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 1999
Location: Seattle
Posts: 133 donarb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 15
You could also create a script (shell, Perl, Python) and call that from your cron job. That way, you can do much more in your backup process, things like compress the file, FTP the backup file to another location, send an email to interested parties. You might also want to vacuum the db before or after backup, doing that in one cron call may not be that easy.

Don

Reply With Quote
  #4  
Old September 8th, 2002, 11:06 PM
ggnanaraj ggnanaraj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 69 ggnanaraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 55 sec
Reputation Power: 11
Thanks for the replies !

Quote:
Originally posted by Ted Striker

pg_dump hris > hris.`date +%A-%b-%d-%Y`




That was pretty smart. Well, as I wanted a half hourly backup, I've configured it as follows...

1. created a table to store date in format ddmonyyyyhh24mi
2. update the table before the backup
3. use a select on the table and append the date to the destination file of pg_dump.

In practise, this will also result in loss of data for the past half an hour, depending on the time of failure.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > Automating Backup

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap