当前位置:Gxlcms > 数据库问题 > postgresql 备份 还原

postgresql 备份 还原

时间:2021-07-01 10:21:17 帮助过:22人阅读

windows  linux 通用

第一步:
通过 cmd 进入到postgresql 安装目录的 bin 下: 

cd C:\PostgreSQL\pg95\bin

 

第二步:备份数据库

pg_dump -h localhost -U TPlusPosAdmin -d tegen -f "C:\testdatabase.bak" 

-h:数据库服务器地址;

-p:数据库端口号;

-U:U 大写,表示用户名;

-d:数据库名称;
-f:把备份文件放在哪里;

 

第三步:还原数据库(你要还原的数据库软件里面必须先创建一个空数据库 已有的话就是覆盖) 

psql -h localhost -U TPlusPosAdmin -d tegen -f "E:/testdatabase.bak" 


-h:数据库服务器地址;

-p:数据库端口号;

-U:U 大写,表示用户名;

-d:数据库名称;

-f:备份文件路径以及备份文件名称;

 

psql -h localhost -U TPlusPosAdmin -d tegen -f "E:/testdatabase.bak"
pg_dump -h localhost -U TPlusPosAdmin -d tegen -f "C:\testdatabase.bak"

 

直接复制 改成自己的参数   执行命令  :  备份 还原 完成

postgresql 备份 还原

标签:postgres   bsp   备份文件   localhost   覆盖   pos   数据库服务器   std   用户   

人气教程排行