Use to tell --table what table it has to backup:pg_dump
pg_dump --host localhost --port 5432 --username postgres --format plain --verbose --file "<abstract_file_path>" --table public.tablename dbname
When you have case sensitive table and schema name you have to do the proper quoting of a table name. The below command should work fine as I have successfully executed it at my end.
Please make sure you are using the correct case sensitive name of database, schema and table in this command.
./pg_dump --dbname="myDatabase" --host=localhost --port=5432 --username=postgres --table='"MyScheme"."TableName 01"' --file=Dummy
OR
./pg_dump --dbname="myDatabase" --host=localhost --port=5432 --username=postgres --table='"MyScheme"."TableName 01"' > ~/Dummy.SQL
if version < 8.4.0
pg_dump -D -t <table> <database>
Add before the -a if you only want the INSERTs, without the CREATE TABLE etc to set up the table in the first place.-t
version >= 8.4.0
pg_dump --column-inserts --data-only --table=<table> <database>
you can use a normal and well documented odbc interface, build up a connection to the postgres server and use cas statement( create table as .. ).
following steps are necessary:
on the oracle host install postgresodbc then create a odbc.ini with your parameters to the postgres server create tnsadmin.ora and listener.ora entries restart listener
After this and if you done all steps correct you should be able to connect to postgres.
There is no direct way to do that. I have two ideas:
Use a single format directory (pg_dump) of all the tables. True, there will be a single -F d with all the table metadata, but each table will be dumped to its own file.toc.dat
Use a single in pg_dump or directory format to get a consistent dump for all tables, and then create individual files from it withcustom
pg_restore -t table1 -f table1.sql all_tables.dmp
The default output format is a pg_dump script, so you can just concatenate them:psql
pg_dump -d my_db --schema-only > dump.sql
pg_dump -d my_db -t my_table --data-only >> dump.sql