发布网友
共2个回答
热心网友
Postgresql数据的导入和导出,以及copy命令介绍
如何导出PostgreSQL数据库中的数据:
pg_mp -U postgres -f mp.sql mydatabase
具体某个表
pg_mp -U postgres -t mytable -f mp.sql mydatabase
导入数据时首先创建数据库再用psql导入:
createdb newdatabase
psql -d newdatabase -U postgres -f mp.sql
把数据按照自己所想的方式导出,强大的copy命令:
echo "copy students to? stdout DELIMITER '|'"|psql school|head
(students为表名,school为库名,各个字段以|分隔)
echo 'copy (select * from students order by age limit 10) to stdout;' | psql school
热心网友
1, 导出esa数据库所有对象到esa.backup文件
pg_mp.exe --host localhost --port 5432 --username postgres --format custom --blobs --verbose --file "E:\Dl\esa.backup" esa
2, 导入esa.backup文件中esa数据库所有对象到esa数据库中
pg_restore.exe --host localhost --port 5432 --username postgres --dbname esa --verbose "E:\Dl\esa.backup"