PostgreSQL在非默认的路径下创建表空间及数据库后,删除数据库目录后,还需要删除pg_tblspc下的链接文件,否则尝试启动其他实例时会报错

来源:互联网 发布:耶鲁大学法学院知乎 编辑:程序博客网 时间:2024/05/16 02:46
在非默认的路径下创建表空间及数据库后,删除数据库目录后,还需要删除pg_tblspc下的链接文件,否则尝试启动其他实例时会报错:
如下案例中的“pg_tblspc/46885”实际链接路径为“/data/highgo/4.1.0/1”
把/data/highgo/4.1.0/1删除后,
[highgo@db1 ~]$ cat .bash_profile 
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export LANG=C
export PGHOME=/data/highgo/4.1.0
export PGUSER=highgo
export PGPORT=5866
export PGDATA=/data/highgo/4.1.0/data
export PATH=$PGHOME/bin:$PATH:$HOME/bin
export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH


启动数据库会报错:
[highgo@db1 ~]$ pg_ctl start
server starting
[highgo@db1 ~]$ ??:  00000: ?????????? 2017-07-14 11:41:46 CST
??:  00000: could not open tablespace directory "pg_tblspc/46885/PG_9.5_201510051": ENOENT
??:  00000: ???????????????
??:  00000: ???????????
??:  00000: ???autovacuum


删除pg_tblspc下的链接文件后,再次启动/data/highgo/4.1.0/data下的实例正常
[highgo@db1 data]$ cd pg_tblspc/
[highgo@db1 pg_tblspc]$ ls
46885
[highgo@db1 pg_tblspc]$ rm -rf *

[highgo@db1 ~]$ pg_ctl start
server starting
[highgo@db1 ~]$ ??:  00000: ?????????? 2017-07-14 11:42:53 CST
??:  00000: ???????????????
??:  00000: ???????????
??:  00000: ???autovacuum
阅读全文
0 0
原创粉丝点击