- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Ipostgres数据库维护方法和恢复
主题:postgres数据库维护方法
1、首先登录服务器,用postgres用户,在/export/home/postgres下执行crontab –l命令查看
bash-2.05$ crontab -l
11 * * * * /export/home/postgres/vacuumdb.sh hour
38 6 * * * /export/home/postgres/vacuumdb.sh daily
这两行命令是根据规定时间自动运行删除优化数据库。(其中蓝字分别代表分钟、小时、天、月、星期)crontab--操作系统的定时调度器
用命令ls –al查看:
bash-2.05$ ls -al
total 36608
drwxr-xr-x 10 postgres postgres 512 Dec 29 09:42 .
drwxr-xr-x 8 root root 512 Dec 29 09:35 ..
-rw------- 1 postgres postgres 5179 Apr 14 19:55 .bash_history
-rw-r--r-- 1 postgres postgres 365 Apr 10 2004 .profile
-rw------- 1 postgres postgres 1575 Feb 2 18:02 .psql_history
drwxr-xr-x 2 postgres postgres 1024 Dec 29 09:31 bin
-rw-r--r-- 1 postgres postgres 3088 Aug 13 2004 cptemp.lst
-rw-r--r-- 1 postgres postgres 3090 Jul 27 2004 cptemp.lst.bak
-rw-r--r-- 1 postgres postgres 54574 Apr 15 06:42 crontab.daily
-rw-r--r-- 1 postgres postgres 1304310 Apr 15 09:16 crontab.hour
drwx------ 6 postgres postgres 512 Dec 28 16:23 data
drwxr-xr-x 3 postgres postgres 512 Apr 10 2004 doc
drwxr-xr-x 5 postgres postgres 512 Apr 10 2004 include
drwxr-xr-x 2 postgres postgres 1536 Apr 10 2004 lib
-rw-r--r-- 1 postgres postgres 136 Apr 10 2004 local.cshrc
-rw-r--r-- 1 postgres postgres 157 Apr 10 2004 local.login
-rw-r--r-- 1 postgres postgres 174 Apr 10 2004 local.profile
-rw-r--r-- 1 postgres postgresMay 11 2004 logfile
drwxr-xr-x 4 postgres postgres 512 Apr 10 2004 man
-rw-r--r-- 1 postgres postgres 102 May 25 2004 postgres
-rw-r--r-- 1 postgres postgres 365 Dec 29 09:42 postgres.profile
drwxr-xr-x 2 postgres postgres 512 Apr 10 2004 share
drwxr-xr-x 2 postgres postgres 512 Jul 27 2004 synOra
-rwxr--r-- 1 postgres postgres 177 Jun 28 2004 vacuumdb.sh
必须保证蓝字的时间戳要于当前时间基本保持一致。
如果当前的时间差大于调度的时间粒度,说明数据库有问题了,需要采取以下步骤:
在/export/home/postgres/bin/下手工执行vacuumdb -a -z -U postgres命令,看能否正常运行。
(vacuumdb的脚本在/export/home/postgres目录下
文档评论(0)