windows下
运行pg_dumpall > outfile
linux下
psql -f outfile postgres
如果是在两台不同的计算机上,虚拟机当然也算,同时启动两台电脑的postgres服务
可以
pg_dump -h host1 dbname | psql -h host2 dbname
如果数据库比较简单,建议直接在新的数据库中,新建表等逻辑结构,在通过旧的数据库中运行copy table to file with csv
新的数据库中运行copy table from file with csv导入数据
其他方式和具体情况可以看文档http://www.postgresql.org/docs/8.3/interactive/backup.html
用我写的软件可以用excel导入到postgresql,你上网找fitreport就行了。 或者这样做: 可以写语句或采用以下的方法 网上转录下来的方法: 步骤: 1.将excel表格字段,按照postgresql 数据库中表的字段顺序来整理数据,并保存为csv文件。 2.用记事本打开csv文件,另存为utf-8格式。 3.使用pgadmin客户端链接postgresql数据库,执行如下脚本,导入csv文件到postgresql数据表: copy testdata from 'd:/test/testdata.csv' delimiter as',' csv quote as '"' 注:testdata 是postgresql数据库表的名称。 注意事项: 1.test目录需要赋予postgres 用户可读写的权限,否则会有如下报错信息: error: could not open file "d:/testdata2.csv" forwriting: permission denied 2.csv文件要为utf-8格式,否则导入时可能会有报错: error: invalid bytesequence for encoding "utf8": 0xcdf5 3.注意windows环境下文件路径的表述方式,如:d:/test/data.csv
热门文章更多>>
标签更多>>
专题更多>>
最新文章更多>>
- 团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
- 使用 MSBuild.exe 在发布模式下构建 C# 解决方案
- 当我发布 Web 应用程序时,AfterPublish 脚本不运行
- 构建时 T4 转换的产品仅在下一个构建中使用
- ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
- 新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
- 如何将条件编译符号(DefineConstants)传递给 msbuild
- MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
- NuGet 包还原找不到包,没有源
- 使用 C# 6.0 功能运行 TFS 构建
不离不弃18859304