Re: Getting back names of databases

From: "Steve Wolfe" <steve(at)iboats(dot)com>
To: <pgsql-general(at)hub(dot)org>
Subject: Re: Getting back names of databases
Date: 2000-05-22 18:09:35
Message-ID: 000d01bfc418$e30862a0$85755ad1@iboats.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I know that I've seen this somewhere in past messages, but I can't seem
> to find how to search the archives. Is the search engine offline?
>
> Anyway, I'm trying to write a shell script which will backup my
> databases to DAT tape. I'd like to know how I could get the list of
> existing database names from Postgres. For example, I have 3 databases
> named db01, db02, db03. How can I ask Postgres for these 3 names?

There are a few ways... such as doing something like "psql -d
template1 -c \l" on the command line, and parsing the output. You could
also do a pg_dumpall instead of a pg_dump, but it's not always the best for
a backup. It makes it nice if you have to restore the entire server, but
if you just need to restore one particular database, then you have to edit
the file.

steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Hoffmann 2000-05-22 18:13:48 Re: Getting back names of databases
Previous Message G. Anthony Reina 2000-05-22 18:05:42 Getting back names of databases