Обсуждение: importing csv files into v7.2.1 on Solaris 8 x86

Поиск
Список
Период
Сортировка

importing csv files into v7.2.1 on Solaris 8 x86

От
Russell Aspinwall
Дата:
Hi,

I recently compiled PostgreSQL v7.2.1 under Solaris 8 x86 (July 2001) in
order to use it to hold the contents of Firewall logs. I have automated
the Firewall log creation process and got them delivered to the intended
database server as csv text files. I have compiled v7.2.1 (straight
forward if you just include C, C++ support) but now need to write a
program to accept the csv log file and enter the record information.

Some newbie questions.

Is their a utility which will read a database table definition and
automatically import a csv format file expecting the fields to be in the
correct order as the table? I remember that Progress (c 1994) can dump
its database definition and database as text files which can then be
read by another version of Progress to automatically recreate the
database tables and populate the tables.

Can anyone recommend the best way to perform a backup of PostgreSQL on
Solaris.
Can I just shutdown PostgreSQL and perform a ufsdump of the disk on
which postgreSQL resides and restore onto a different disk or server as
necessary?

Regards

Russell
--
Network and Systems Administrator           Flomerics Ltd
Email: russell.aspinwall at flomerics.co.uk 81 Bridge Road
Telephone: 020-8941-8810 x3116              Hampton Court
Facsimile: 020-8941-8730                    Surrey, KT8 9HH, UK

Re: importing csv files into v7.2.1 on Solaris 8 x86

От
Justin Clift
Дата:
Hi Russell,

I didn't know anyone still ran Solaris x86.  That used to be my
favourite OS until a very black day involving Sun.  :(  I've still got
the first CD of Solaris 9 INTEL OE which I'd downloaded before Sun
pulled the CD set from their download site.  :)

For backing up a PostgreSQL database, you'll probably want to do a live
backup with the pg_dump command.

i.e.:

pg_dump foo_database > foo_database.sql

To restore the database, you can use the psql command:

psql foo_database < foo_database.sql > /dev/null


Each of these two commands has a bunch of command line switches you can
use for various things.

psql --help and pg_dump --help work fine.


Hopefully when you compiled PostgreSQL you did it using these
instructions:

http://techdocs.postgresql.org/installguides.php#solaris


As you're new to PostgreSQL, these two links will probably be valuable
for you:

http://www.postgresql.org/idocs (online version of the PostgreSQL 7.2.1
manual which is searchable, notes can be added, etc)

http://techdocs.postgresql.org (Lots of community contributed
documentation, guides, pointers, links, etc)

Hope this helps you out Russell.

:-)

Regards and best wishes,

Justin Clift


Russell Aspinwall wrote:
>
> Hi,
>
> I recently compiled PostgreSQL v7.2.1 under Solaris 8 x86 (July 2001) in
> order to use it to hold the contents of Firewall logs. I have automated
> the Firewall log creation process and got them delivered to the intended
> database server as csv text files. I have compiled v7.2.1 (straight
> forward if you just include C, C++ support) but now need to write a
> program to accept the csv log file and enter the record information.
>
> Some newbie questions.
>
> Is their a utility which will read a database table definition and
> automatically import a csv format file expecting the fields to be in the
> correct order as the table? I remember that Progress (c 1994) can dump
> its database definition and database as text files which can then be
> read by another version of Progress to automatically recreate the
> database tables and populate the tables.
>
> Can anyone recommend the best way to perform a backup of PostgreSQL on
> Solaris.
> Can I just shutdown PostgreSQL and perform a ufsdump of the disk on
> which postgreSQL resides and restore onto a different disk or server as
> necessary?
>
> Regards
>
> Russell
> --
> Network and Systems Administrator           Flomerics Ltd
> Email: russell.aspinwall at flomerics.co.uk 81 Bridge Road
> Telephone: 020-8941-8810 x3116              Hampton Court
> Facsimile: 020-8941-8730                    Surrey, KT8 9HH, UK
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
   - Indira Gandhi