Showing posts with label Postgresql Solutions and commands. Show all posts
Showing posts with label Postgresql Solutions and commands. Show all posts

Postgresql BackUp Command

Postgresql BackUp Command

1, In Windows XP, Go to Run , type cmd to open Command Prompt

2, Go to the Bin directory inside the Postgresql Installation directory

For EX : E:\workdir\Postgresql\bin

3, Postgresql has its own utility for BackUp called “pg_dump”.

The most common options used are :

1, -h à localhost (hostname)

2, -p à port (default is 5432)

3, -U à user of the database(default is postgres)

4, -f à output backup file name with location

Syntax : pg_dump [options] [databasename]

Ex: To backup “mydatabase” into a file “archive1.dmp” in location “E:\” ,

Use pg_dump -h localhost -p 5432 -U postgres –f “E:\archive1.dmpmydatabase

Postgresql ReStore Command

Postgresql ReStore Commands

1, In Windows XP, Go to “All Programs” --> “Postgresql” --> “psql”

2, Accept default settings and you will get prompt like “postgres-#

3, Postgresql has its own utility for Restore called “psql”.

The most common options used are :

1, -d --> database name

2, -U --> user of the database(default is postgres)

3, -f --> backup (*.dmp) file

Syntax : psql [options]

Ex: To restore “archive1.dmp” into a database “mydatabase”,

Run the commands below .

A, create database mydatabase

B, psql –d mydatabase –U postgres –f “E:\archive1.dmp

Popular Posts