Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TrwCt-0006FY-85 for pgsql-admin@arkaria.postgresql.org; Sun, 06 Jan 2013 19:48:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TrwCs-00088N-Np for pgsql-admin@arkaria.postgresql.org; Sun, 06 Jan 2013 19:48:30 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TrwCr-00087F-9W for pgsql-admin@postgresql.org; Sun, 06 Jan 2013 19:48:29 +0000 Received: from mail-ie0-f174.google.com ([209.85.223.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TrwCn-0003Pg-8Q for pgsql-admin@postgresql.org; Sun, 06 Jan 2013 19:48:28 +0000 Received: by mail-ie0-f174.google.com with SMTP id c11so21911565ieb.5 for ; Sun, 06 Jan 2013 11:48:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=ZnRLzm3gLEDu9SjHTPmtGBKeyajso2/Uuc85yotsNPs=; b=lQ61y0Rbh7ONYJy0glgPyePikuY6KyXjZDXTY70bYEWOVelwiJ+JKwm9CQKqKuH8o+ BSnTD6JlkacqMaolinJ6B11Io+Dka3fJGbvHa9NgZsOspHdGuiVkRnKUPByAACalWRF5 jnrZ6qE6FXWe7iIBF6iYC4USBbNkkGjDlHjPeEnEsp86oZzG/lbaEFG5rV1WHfprj598 ELNNcd1DKBRGegrFgYobVof8yp1ssaD3LtjkyosN0mCLOeUkLotRtq4Mzmxj4exEGDx0 AOMRml3mrV8WXFKCzShyosBdQITI4Mhl37KSeWNmZmxrD0GHK7PRjUpyUVKJXDtUku18 mLGw== X-Received: by 10.50.77.133 with SMTP id s5mr3967213igw.110.1357501703868; Sun, 06 Jan 2013 11:48:23 -0800 (PST) Received: from Kevins-MacBook-Pro.local (184-96-131-233.hlrn.qwest.net. [184.96.131.233]) by mx.google.com with ESMTPS id i10sm5083195igb.12.2013.01.06.11.48.22 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 06 Jan 2013 11:48:23 -0800 (PST) Message-ID: <50E9D507.7040506@consistentstate.com> Date: Sun, 06 Jan 2013 12:48:23 -0700 From: CS DBA User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: restoring from a dump References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQni89ZCvwgUItKhRIt0jPtBYKSU59X9xrYpYJ4UEYgXWoIk9nk5gFuaj923Ucu3ssS8u+TO X-Pg-Spam-Score: -2.6 (--) 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 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