473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to use pg_dump to backup a database?

I want to backup and restore a database by comand line,
Acually I successed to do that but I have a problem in spacial status:

the database name: swt
schema name: public
the owner of this DB: swt_user

I executed the following comand, it worked and the backup done:

>pg_dump.exe -i -h localhost -p 5432 -U swt_user -F c -v -f d:\pg_backup\swt.backup -n public -w swt

although the command structure doesn't require the database name (swt), but it didn't work without it.


My issues:
1. I want to provide the password of the connected user
in this command, like following:
>pg_dump.exe -i -h localhost -p 5432 -U swt_user -F c -v -f d:\pg_backup\swt.backup -n public -W ******(the password)

because I want to execute the command automaticly,
is it possible?

2. I want to connect by the superuser (postgres) and
provide different schema names from different
databases.

3. Sometimes, when I execute the same command, it
doesn't work(access is denied) and I get an error
message that says:
(pg_dump is not a valid win32 application).

may someone help me and give me the optimal command
for each issues?

Best Regards
Osman.
Apr 4 '11 #1
1 11711
rski
700 Expert 512MB
Ad 1.
No, but you can create file .pgpass with all needed information
http://www.postgresql.org/docs/curre...pq-pgpass.html

You should also ensure that postgres requires password for a user, see here
http://www.postgresql.org/docs/curre...ntication.html


Ad 2. Not sure what do you mean. To connect as a superuser you can use
Expand|Select|Wrap|Line Numbers
  1. -U postgres
  2.  
parameter

Ad 3.
Some windows issue? I'm not good at windows.
Apr 9 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Colin Finck | last post by:
Hello! I need to backup a MySQL database (MySQL 4.0). But it is on a shared-hosting web server and so I don't have direct server access. I also have no phpMyAdmin installed. How can I backup the...
3
by: Stanley Sinclair | last post by:
For years I have been hoping for a native db2 solution which compresses data on BACKUP DATABASE. (Using Windows.) I have heard that it will happen, but has anyone enough chutzpa to say if it will...
1
by: MeganF via AccessMonster.com | last post by:
Does it make sense to create an option to create a backup database. The folks I'm working with aren't set up really well in their office for automation. I'm helping by automating their invoice...
4
by: Andy Davis | last post by:
Is it possible to create a button with code to carry out the a weekly compact and repair of database and backup? My users know how to do this from the menu but would really like some kind process...
4
by: jack turer | last post by:
I have a database in pgsql (7.3.2) on redhat 9. When I try a 'pg_dump mydb' to back up the database, I get: pg_dump: could not find namespace with OID 2200 Verbose version is: -bash-2.05b$...
4
by: fstenoughsnoopy | last post by:
I have a database on a server, not split into FE/BE and it has the user level security set up. I do have one problem. I need to back up the database. According to Microsoft and other books and...
3
by: ineedahelp | last post by:
Does anyone have an efficient way to MOVE tables to a backup database using code? Thanks in advance for any help!!
1
by: bwmiller16 | last post by:
Folks - DB21085I Instance "db2inst1" uses "32" bits and DB2 code release "SQL08022" with level identifier "03030106". Informational tokens are "DB2 v8.1.2.88", "s050422", "MI00117", and...
2
japuentem
by: japuentem | last post by:
I want to backup a database with the SQL Query Analizer with the following instruction: BACKUP DATABASE my_database TO DISK 'C:\backups\my_database.bak' WITH FORMAT GO and send me this error...
2
by: billalquist | last post by:
Here is what I am trying to do....I am using Access 2007. I created a form (frmEmailBudget) with a button (btnCreateBudgetBackup). This button needs to generate a backup of the active database...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.