Thread: Database backup

Database backup

From
sreejith s
Date:
Hai,
How to take Database backup from an application developed in Visual
Basic thats running at Windows Client and Database resting at Linux
Server. THanx

Sreejith


Re: Database backup

From
Steven Klassen
Date:
* sreejith s <getsreejith@gmail.com> [2004-10-17 08:49:44 +0530]:

> How to take Database backup from an application developed in Visual
> Basic thats running at Windows Client and Database resting at Linux
> Server. THanx

pg_dump -U your_username your_database > your_database.sql

-- 
Steven Klassen - Lead Programmer
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Replication & Support Services, (503) 667-4564


Re: Database backup

From
Andreas
Date:
sreejith s wrote:

>How to take Database backup from an application developed in Visual
>Basic thats running at Windows Client and Database resting at Linux
>Server. THanx
>  
>
You wrote a similar question some days ago and mentioned that pg_dump 
wouldn't work on Windows, so I figure you don't want to let the Linux 
host computer make the backups but your Windows client.

You could go 2 ways.

1)
Install pg_dump on your Windows client.
Either as PostgreSQL on a CygWin environment or a Windows-native 
PostgreSQL 7.5 or 8.0 installation.
Since you only need pg_dump you wouldn't configure a running PostgreSQL 
so this should be pretty easy.

E.g. the Linux host's IP is 192.168.0.123.   Then you can run on Windows :
pg_dump --host=192.168.0.123 -U your_username your_database > 
your_database.sql

2)
Let the Linux server do the backup and transfer the resulting backup 
file as soon as possible to your Windows client.
a)   The server could push it through SAMBA, SCP or FTP.
b)   The client could collect all backup files when it gets booted, if 
the server puts the files in a SAMBA share that the client can mount as 
network drive or access via FTP.

I'd propose you take the alternative  2) b).



getting back autonumber just inserted

From
lorid
Date:
I could have sworn I kept a copy of prior emails that discussed how to 
get back a value that was just inserted into a autonumber (or in 
postgresql case a sequence number)

any help will be appreciated
thanks

Lori





Re: getting back autonumber just inserted

From
Scott Marlowe
Date:
On Thu, 2005-02-03 at 16:16, lorid wrote:
> I could have sworn I kept a copy of prior emails that discussed how to 
> get back a value that was just inserted into a autonumber (or in 
> postgresql case a sequence number)


If you know the name of the sequence the number came from you can use
currval():

insert into table1 (info) values ('abc');
select currval('table1seq');

Assuming table1seq is the name of the sequence here.

In 8.0 there's a function to do this (I'm not sure of the name, but a
quick search of the 8.0 docs should turn it up.)


Re: getting back autonumber just inserted

From
Sean Davis
Date:
On Feb 3, 2005, at 5:16 PM, lorid wrote:

> I could have sworn I kept a copy of prior emails that discussed how to  
> get back a value that was just inserted into a autonumber (or in  
> postgresql case a sequence number)
>

See here:

http://www.postgresql.org/docs/8.0/interactive/functions- 
sequence.html#FUNCTIONS-SEQUENCE-TABLE

Sean



Re: getting back autonumber just inserted

From
Edmund Bacon
Date:
Perhaps you meant:
http://www.postgresql.org/docs/8.0/interactive/functions-info.html#FUNCTIONS-INFO-SCHEMA-TABLE

in particular  |pg_get_serial_sequence|(table_name, column_name)



Sean Davis wrote:

>
> On Feb 3, 2005, at 5:16 PM, lorid wrote:
>
>> I could have sworn I kept a copy of prior emails that discussed how 
>> to  get back a value that was just inserted into a autonumber (or in  
>> postgresql case a sequence number)
>>
>
> See here:
>
> http://www.postgresql.org/docs/8.0/interactive/functions- 
> sequence.html#FUNCTIONS-SEQUENCE-TABLE
>
> Sean
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)


-- 
Edmund Bacon <ebacon@onesystem.com>