Re: vacuum and backup
От | Brent R. Matzelle |
---|---|
Тема | Re: vacuum and backup |
Дата | |
Msg-id | 20010227181931.9803.qmail@web312.mail.yahoo.com обсуждение исходный текст |
Ответ на | vacuum and backup (Colleen Williams <colleen@digital-arts.co.uk>) |
Список | pgsql-general |
> 3) Has anyone written some shell scripts to do vacuum and > backup? > I will have to write some but am not conversant with shell > scripts and > would greatly appreciate any help. You would probably be better off writing your scripts in a system language such as Python or Perl. Here is an excerpt from a basic Python backup program I wrote (uses pg_dump & postgresql-python) that does just that. #!/usr/bin/python import os, time from pg import DB # Backup database with the current date attached def pg_backup(): now = time.localtime(time.time()) today = time.strftime("%m-%d-%Y", now) os.system("pg_dump test > test-%s.sql" % today) print "Backup completed" # Run vacuum on database def pg_clean(): cxn = DB('test') cxn.query("VACUUME VERBOSE ANALYZE") print "Database optimized & space recovered" ### This is the main program ### if __name__ == "__main__": pg_backup() pg_clean() Brent __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
В списке pgsql-general по дате отправления: