Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsCUK-0004i3-Cd for pgsql-admin@arkaria.postgresql.org; Mon, 07 Jan 2013 13:11:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TsCUJ-0006QA-9y for pgsql-admin@arkaria.postgresql.org; Mon, 07 Jan 2013 13:11:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsCUI-0006Q3-9b for pgsql-admin@postgresql.org; Mon, 07 Jan 2013 13:11:34 +0000 Received: from cmailb.vita.virginia.gov ([166.67.65.182]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsCU7-0005dc-VF for pgsql-admin@postgresql.org; Mon, 07 Jan 2013 13:11:30 +0000 X-SBRS: None X-HAT: Group: RELAYLIST_WHITELIST, Policy: $RELAYED_WHITELIST X-IronPort-AV: E=Sophos;i="4.84,424,1355115600"; d="scan'208";a="565390863" Received: from unknown (HELO COVMSGCES-HUB03.cov.virginia.gov) ([10.192.2.219]) by CRelayB.vita.virginia.gov with ESMTP; 07 Jan 2013 08:11:20 -0500 Received: from COVMSGCES-MBX01.cov.virginia.gov ([10.192.2.206]) by COVMSGCES-HUB03.cov.virginia.gov ([10.192.2.219]) with mapi id 14.02.0318.004; Mon, 7 Jan 2013 08:11:19 -0500 From: "Burgholzer, Robert (DEQ)" To: "pgsql-admin@postgresql.org" Subject: Re: restoring from a dump Thread-Topic: [ADMIN] restoring from a dump Thread-Index: AQHN64cnxWlCyGkB4UaLSLBD2FZP/5g9ClWAgADN+bA= Date: Mon, 7 Jan 2013 13:11:19 +0000 Message-ID: <77F5F8FA4B407F43BFCFD3FC347896913CC16D@COVMSGCES-MBX01> References: , <50E9D507.7040506@consistentstate.com> In-Reply-To: <50E9D507.7040506@consistentstate.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.193.11.62] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org The other quick item to consider is whether or not your database is on a *n= ix system or a windows machine, and if your workstation is *nix or windows.= =20=20 Cases/suggestions: 1. Windows workstation / *nix DB Server: use putty.exe to ssh into the DB s= erver (a second option would be to use PGAdmin, a GUI db management package= for PostgreSQL) 2. Windows workstation / Windows DB Server: use CMD.com and enter psql comm= and line (may have to add "C:/Program Files/PostgreSQLX.YY/bin" to your PAT= H). Could also use PGAdmin in this case 3. *nix client / *nix server: command line psql (ssh to server if not the s= ame as your workstation) ________________________________________ From: pgsql-admin-owner@postgresql.org [pgsql-admin-owner@postgresql.org] o= n behalf of CS DBA [cs_dba@consistentstate.com] Sent: Sunday, January 06, 2013 2:48 PM To: pgsql-admin@postgresql.org Subject: Re: [ADMIN] restoring from a dump On 1/5/13 1:54 PM, J Rouse wrote: > Stupid person here. Just got PostgresSQL today. Have text dump > file. Need to restore. > > I think I need to use psql, but do not even know how to get to it. > Need exact instructions on where to enter the command line, setting up > paths if necessary, etc. > > Jim > > > to restore from a text (sql) file: 1) ensure you have a target database: - you might need to set your path, i.e. you need to know where psql is - if you did an rpm / package install it's probably in /usr/bin # connect to the cluster (database instance): $ psql # then create your target database: postgres# create database my_target_db; Then exit from psql (exit; or ctl-d) postgres# exit; 2) import the sql text file - cd to the directory where the text file is: $ cd /home/postgres/Downloads - Import the file $ psql -ef ./import_file.sql my_target_db You could also point to the sql file without being in the directory: $ psql -ef /home/postgres/Downloads/import_file.sql my_target_db Note the -f is the psql flag to import (or run) a specified sql file from the command line, the -e flag says to push all SQL statements as well as normal output to STDOUT See the psql command docs for more info here: http://www.postgresql.org/docs/9.2/interactive/app-psql.html Hope this helps, /Kevin -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin