Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8926037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:51:59+00:00 2026-06-15T07:51:59+00:00

I am dumping my database ‘mydatabase’ into a text file ‘mydatabase.sql’ through command line.

  • 0

I am dumping my database ‘mydatabase’ into a text file ‘mydatabase.sql’ through command line.

"C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_dump.exe " --host localhost --port 5432 --username "postgres" --no-password --verbose --file "C:\Users\User 1\Desktop\mydatabase.sql" "mydatabase"

Thas’ going nice.
But after many tries I can’t do a pg_restore those file back to database with data.
But if I delete all tables in this database I can do it with:

psql -f "C:\Users\User 1\Desktop\mydatabase.sql" "mydatabase" "postgres"

This recover’s all data.
Problem is that I can’t run pgsl through VBNET/shell so I would rather need pg_restore.exe
This is my try:

"C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_restore.exe " -i -h localhost -p 5432 -U postgres -d "mydatabase" -v "C:\Users\User 1\Desktop\mydatabase.sql"

…where I get message:

C:\Users\User 1>”C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_restore.exe ” -i -h
localhost -p 5432 -U postgres -d “mydatabase” -v “C:\Users\User 1\Desktop\mydatabase.sql”
invalid binary “C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_restore.exe ”
pg_restore.exe : [archiver] input file does not appear to be a valid archive

Before trying to restore I have empty database ‘mydatabase’ on server (without tables).
Please any help to get pg_restore working with ‘mydatabase.sql’ which is dumped with pg_dump and which obviously contains a proper data so I can use it through pure command line or VBNET/shell.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:52:01+00:00Added an answer on June 15, 2026 at 7:52 am

    In your pg_dump, specify the -F t flag. This tells pg_dump to create the backup in tar format, which is suitable for restore via pg_restore.

    "C:/Program Files (x86)/PostgreSQL/9.1/bin/pg_dump.exe " --host localhost --port 5432 --username "postgres" --no-password --verbose -F t --file "C:\Users\User 1\Desktop\mydatabase.sql" "mydatabase"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm dumping a database into a file (piping the dump through gzip) and it
Short of SQL-dumping my entire database to text and searching that, is there a
Is there an easy way of dumping a SQLite database table into a text
I am able to backup mysql database via command line by executing the below
I am trying to restore the database file(backup.sql) using c# by the following method...
I have a software dumping values to a local SQL Express database once a
What I have is 3 dictionaries dumping with pickle to 3 different files. I
I am in process of creating a software for dumping plain text of whatever
I have a fairly large SQL Server database; I'd like to pull 4 tables
How do you get Django's dumpdata management command to stream contents to a file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.