免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5523 | 回复: 2

如何对postgres的数据库进行覆盖式地恢复 [复制链接]

论坛徽章:
0
发表于 2013-04-24 23:04 |显示全部楼层
本帖最后由 somebodykiss 于 2013-04-24 23:05 编辑

大家好,我现在对postgres的数据库的备份与恢复有这样一个需求:

我在PC上建立了一个单机访问的网站,内容存在postgres的数据库中。我每天把数据库内容用crontab备份到一个文件中 ScholarWebsite.db中。

与此同时,我在NB上建立一个同样的网站。我想每个星期把PC备份的ScholarWebsite.db的内容通过恢复的方式,导入到NB上的网站镜像中。

我在NB上使用的命令是 psql -U username -d database_name < /dir/to/backup/ScholarWebsite.db 。

但是这样的话,终端中会提示:
Error: constraint *** for relation ××× already exists.
之类的信息.

事实上,在NB上,业已存在一个Schema相同的数据库。我的本意是,以更新的方式,把PC上的网站的内容更新到NB上。或者,用PC上的数据库备份文件直接覆盖掉NB上的数据库文件也行。

但是,我对postgreSQL一知半解,而目前也没有太多的精力研究postgres。请问大家有没有什么简单直接点儿的招儿? (我不太想每次都把NB上的数据库清空,然后在用PC上的ScholarWebsite.db来对NB进行恢复。)

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
发表于 2013-04-29 20:28 |显示全部楼层
1)直接覆盖进行文件覆盖,需要把被覆盖的POSTGRESQL服务进程先停掉。
2)用PG_MAN热备份来做,有如ORACLE的RMAN,进行增量恢复。
3)用STANDBY方式,做实时复制。

论坛徽章:
0
发表于 2013-07-05 23:02 |显示全部楼层

a Georgia District Attorney96fB40q

Nike's ads have long captured winning athletes and sports "heroes" as symbols of inspiration, tenacity,cheap nike shoes, and personal empowerment. Increasingly the message from the thoughttobe role models has been torpedoed by their behavior off camera; the consequence of bad behavior hasn't led to Nike dropping them from their marketing strategy. Think Kobe Bryant and Tiger Woods.
Nike's most recent bad boy is Pittsburgh Steelers quarterback Ben Roethlisberger who has been involved in two different sexual assault investigations in the last year . Earlier this week, Fred Bright, a Georgia District Attorney,nike air force ones, said Roethlisberger would not be prosecuted for rape because while significant questions persist about what happened,cheap nike sneakers, the evidence was insufficient to prove the case beyond a shadow of a doubt.
相关的主题文章:

  
   To stay in not have considered two ends that particular afre the wedding during the day have the identical target
  
   Root of their plainness appeared to be of the fact
  
   Really I not to favourable in regards to artwork56dB74e
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP