postgresql 使用 pgAdmin 导出和导入表转储 (.sql)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18736345/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Export and import table dump (.sql) using pgAdmin
提问by Oto Shavadze
I have pgAdmin version 1.16.1
我有 pgAdmin 版本 1.16.1
So, for exporting table dumm I do:
因此,对于导出 table dumm,我会这样做:
Right click on table, then in menu click on backup
, then in Format
choice Plain
and save file as some_name.sql
右键单击表格,然后在菜单中单击backup
,然后Format
选择Plain
并将文件另存为some_name.sql
Then I remove table.
然后我删除表。
Ok, now I need import table backup some_name.sql
into database.
好的,现在我需要将表备份some_name.sql
导入数据库。
How to do this? I can't find how to import table's .sql
dump into database using pgAdmin.
这该怎么做?我找不到如何.sql
使用 pgAdmin将表的转储导入数据库。
Can you help me please?
你能帮我吗?
回答by Tomas Greif
- In pgAdmin, select the required target scheme in object tree
- Click on Plugins/PSQL Console
- Write
\i /path/to/yourfile.sql
- Press enter
- 在 pgAdmin 中,在对象树中选择所需的目标方案
- 单击插件/PSQL 控制台
- 写
\i /path/to/yourfile.sql
- 按回车
回答by EgoistDeveloper
An another way, you can do it easily with CMD on Windows
另一种方式,您可以在 Windows 上使用 CMD 轻松完成
Put your installed version (mine is 11).
把你安装的版本(我的是 11)。
cd C:\Program Files\PostgreSQL\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.
输入密码,然后等待最终的控制台消息。
回答by alexx ramzzx
follow he steps. in pgadmin
按照他的步骤。在 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.
host-DataBase-Schemas-public(点击右键)CREATE script-打开文件-(选择xxx.sql),然后点击选项执行查询写入结果到文件-导出数据文件ok-然后点击save.its all。它对我有用。
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/
注意:版本命令脚本中的错误在此处输入图像描述de sql over pgadmin 可以搜索,例如:http: //www.forosdelweb.com/f21/campo-tipo-datetime-postgresql-245389/
回答by Kavindu Gayan
Using PgAdmin
step 1:
select schema and right click and go to Backup..
使用 PgAdmin 步骤 1:选择架构并右键单击并转到备份..
step 2: Give the file name and click the backup button.
第 2 步:提供文件名并单击备份按钮。
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)
转到其他模式并右键单击并转到还原。(见步骤 1)
step 5:
第 5 步:
In popup menu paste aboved file path to filename category and click Restore button.
在弹出菜单中将上面的文件路径粘贴到文件名类别,然后单击“恢复”按钮。
回答by milaoshutapintou
Click "query tool" button in the list of "tool".
单击“工具”列表中的“查询工具”按钮。
And then click the "open file" image button in the tool bar.
然后单击工具栏中的“打开文件”图像按钮。
回答by Humming
If you have Git bash installed, you can do something like this:
如果您安装了 Git bash,您可以执行以下操作:
/c/Program\ Files\ \(x86\)/PostgreSQL/9.3/bin/psql -U <pg_role_name> -d <pg_database_name> < <path_to_your>.sql