Export and import table dump (.sql) using pgAdmin

流过昼夜 提交于 2019-12-18 09:57:19

问题


I have pgAdmin version 1.16.1

So, for exporting table dumm I do:

Right click on table, then in menu click on backup, then in Format choice Plain and save file as some_name.sql

Then I remove table.

Ok, now I need import table backup some_name.sql into database.

How to do this? I can't find how to import table's .sql dump into database using pgAdmin.

Can you help me please?


回答1:


  1. In pgAdmin, select the required target scheme in object tree
  2. Click on Plugins/PSQL Console
  3. Write \i /path/to/yourfile.sql
  4. Press enter



回答2:


follow he steps. in pgadmin

host-DataBase-Schemas- public (click right) CREATE script- open file -(choose xxx.sql) , then click over the option execute query write result to file -export data file ok- then click in save.its all. it work to me.

note: error in version command script enter image description herede sql over pgadmin can be search, example: http://www.forosdelweb.com/f21/campo-tipo-datetime-postgresql-245389/




回答3:


Using PgAdmin step 1: select schema and right click and go to Backup..

step 2: Give the file name and click the backup button.

step 3: In detail message copy the backup file path.

step 4:

Go to other schema and right click and go to Restore. (see step 1)

step 5:

In popup menu paste aboved file path to filename category and click Restore button.




回答4:


Click "query tool" button in the list of "tool".

And then click the "open file" image button in the tool bar.




回答5:


If you have Git bash installed, you can do something like this:

/c/Program\ Files\ \(x86\)/PostgreSQL/9.3/bin/psql -U <pg_role_name> -d <pg_database_name> < <path_to_your>.sql



回答6:


An another way, you can do it easily with CMD on Windows

Put your installed version (mine is 11).

cd C:\Program Files\PostgreSQL\11\bin\

and run simple query

psql -U <postgre_username> -d <db_name> < <C:\path\data_dump.sql>

enter password then wait the final console message.



来源:https://stackoverflow.com/questions/18736345/export-and-import-table-dump-sql-using-pgadmin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!