Thread: Automatic backup with Linux.
Hi all, sorry for the question, but I am new to postgres and Linux. I will to write a litle script for data base backup that starts automaticaly. I have the script and can start it manualy and it use pg_dump. The script is working well. My question: 1. Ho to execute this script as user postgres under Linux. I will to use crontab, but do not know how to execute pg_dump as another user. 2. Is it possible to execute the backup script on working data base. I haved problems with data integrity on oracle in this case and needet to stop the oracle and then make backup. Many thanks in advance.
On Sat, 2002-07-20 at 06:58, pginfo wrote: > My question: > 1. Ho to execute this script as user postgres under Linux. I will to use > crontab, but do not know how to execute pg_dump as another user. Become user postgres before you run "crontab -e". On Debian you can instead use /etc/crontab, which has an extra field to define the user under whose uid the command will run. > 2. Is it possible to execute the backup script on working data base. I > haved problems with data integrity on oracle in this case and needet to > stop the oracle and then make backup. Yes it is possible. pg_dump will not see any transaction that has not yet been committed at the time you start it, so its output will be consistent. If you were using tar on the raw database files, you would probably need to stop the postmaster first. -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Behold, what manner of love the Father hath bestowed upon us, that we should be called the sons of God..." I John 3:1
On Sat, 2002-07-20 at 17:21, Rommel B. Abaya wrote: > isn't there any faster method to backup data than pg_dump ??? pg_dump preserves the consistency of the database. That is more important than raw speed. > or is there a way to speed up pg_dump ??? Not that I know of -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Behold, what manner of love the Father hath bestowed upon us, that we should be called the sons of God..." I John 3:1
isn't there any faster method to backup data than pg_dump ??? or is there a way to speed up pg_dump ??? ----- Original Message ----- From: Oliver Elphick <olly@lfix.co.uk> To: pginfo <pginfo@t1.unisoftbg.com> Cc: <pgsql-admin@postgresql.org> Sent: Saturday, July 20, 2002 3:38 PM Subject: Re: [ADMIN] Automatic backup with Linux. > On Sat, 2002-07-20 at 06:58, pginfo wrote: > > My question: > > 1. Ho to execute this script as user postgres under Linux. I will to use > > crontab, but do not know how to execute pg_dump as another user. > > Become user postgres before you run "crontab -e". On Debian you can > instead use /etc/crontab, which has an extra field to define the user > under whose uid the command will run. > > > 2. Is it possible to execute the backup script on working data base. I > > haved problems with data integrity on oracle in this case and needet to > > stop the oracle and then make backup. > > Yes it is possible. pg_dump will not see any transaction that has not > yet been committed at the time you start it, so its output will be > consistent. If you were using tar on the raw database files, you would > probably need to stop the postmaster first. > > -- > Oliver Elphick Oliver.Elphick@lfix.co.uk > Isle of Wight, UK > http://www.lfix.co.uk/oliver > GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C > ======================================== > "Behold, what manner of love the Father hath bestowed > upon us, that we should be called the sons of God..." > I John 3:1 > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org >
The only faster way to do a backup is to shut down the postmaster and tar the /data directory. --------------------------------------------------------------------------- Rommel B. Abaya wrote: > isn't there any faster method to backup data than pg_dump ??? > > or is there a way to speed up pg_dump ??? > > > ----- Original Message ----- > From: Oliver Elphick <olly@lfix.co.uk> > To: pginfo <pginfo@t1.unisoftbg.com> > Cc: <pgsql-admin@postgresql.org> > Sent: Saturday, July 20, 2002 3:38 PM > Subject: Re: [ADMIN] Automatic backup with Linux. > > > > On Sat, 2002-07-20 at 06:58, pginfo wrote: > > > My question: > > > 1. Ho to execute this script as user postgres under Linux. I will to use > > > crontab, but do not know how to execute pg_dump as another user. > > > > Become user postgres before you run "crontab -e". On Debian you can > > instead use /etc/crontab, which has an extra field to define the user > > under whose uid the command will run. > > > > > 2. Is it possible to execute the backup script on working data base. I > > > haved problems with data integrity on oracle in this case and needet to > > > stop the oracle and then make backup. > > > > Yes it is possible. pg_dump will not see any transaction that has not > > yet been committed at the time you start it, so its output will be > > consistent. If you were using tar on the raw database files, you would > > probably need to stop the postmaster first. > > > > -- > > Oliver Elphick Oliver.Elphick@lfix.co.uk > > Isle of Wight, UK > > http://www.lfix.co.uk/oliver > > GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C > > ======================================== > > "Behold, what manner of love the Father hath bestowed > > upon us, that we should be called the sons of God..." > > I John 3:1 > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026