Changes

Jump to navigation Jump to search
no edit summary
==Basic ConfigurationConfiguring a copy of Postgres on Windows==
Add PostgreSQL to the path if it isn't already:
createdb -O ed_egan DBName
 
==Postgres.Haas==
 
We have a new dedicated Postgres server available for use by PhD Students and Faculty only. Access to the server is available from within Haas or over the VPN.
 
To get an account see Ed Egan (in F533). Ed can either set you up with SSH access so that you can create an account on the database server and as many databases as you like, or he can create an account on the database server, and a blank database owner solely by your account, for you.
 
Once you have a username and password you and a blank database, can use ''psql'' on your local computer (available from [http://psql.sourceforge.net/]) to connect to the database server as detailed below. You will probably find that this gives you everything you need - you can load data, perform queries, and produce output datasets for analysis (for example in STATA).
 
Without an SSH account you may not be able to use the backup and restore command-line tools. We are currently experimenting with ways to overcome this if necessary. Please ask for more information. If you are comfortable using SSH then all advanced functionality will be available, including the ability to mount your R drive using the commands:
 
mkdir /mnt/username
mount -t cifs //bear/username/ /mnt/ed -o user=username
==Dumping and Restoring a Database==
This can be done in pgAdminin Windows, but the commands (needed on Linux with SSH access) are:
To dump a db:
To connect your psql client to a db type (for localhost don't specify the host):
psql -h host DBName
 
Therefore to connect to Postgres.Haas you will type:
psql -h postgres.haas.berkeley.edu DBName
Useful commands are:
\dt List tables
\COPY Psql's version of copy
\r Reset the query buffer
Ctrl-c Abort the current query
==SQL Commands==
Anonymous user

Navigation menu