I'm trying to backup a table from one server and load it into another server.
This is the command im using:
pg_restore -h localhost -p 55433 -C -U postgres -v -O -j 8 -t my_table_name -f storage/my_table_name.dump
Few things to note:
-C
option-t my_table_name
as wellI tried running this last night and it went overnight and never finished and had no output. I can't imagine it would take that long so something has to be wrong. Any ideas?
For pg_restore, -f
gives the name of the output file, not the input file.
Since you did not give it the name of the input file, it is patiently waiting for you to type your input file in at the keyboard. Since you aren't doing that, then nothing is happening.
When using -C
, you still need to give it the -d
option, with it specifying the name of the database it should connect to in order to create the new database, if you want it actually do the import. In PostgreSQL, you can't created a database without first connecting to some other database. There is no way to connect to the system-at-large for maintenance operations (other than replication) like some other DBMS let you do.
When you give it -f and but not -d, you are telling it to translate the dump file into a plain text format, with no connection to the database happening.