1、机房断电后重启pg数据库,报如下错误:
Aug 31 10:55:53 localhost.localdomain postmaster[1716]: 2022-08-31 10:55:53.775 CST [1716] LOG: could not open directory "pg_tblspc/memory/PG_12_201909212/pgsql_tmp": Not a directory Aug 31 10:55:53 localhost.localdomain postmaster[1716]: 2022-08-31 10:55:53.775 CST [1716] LOG: could not open directory "pg_tblspc/memory/PG_12_201909212": Not a directory Aug 31 10:55:53 localhost.localdomain postmaster[1716]: 2022-08-31 10:55:53.775 CST [1716] LOG: could not open directory "pg_tblspc/prememory/PG_12_201909212/pgsql_tmp": Not a directory Aug 31 10:55:53 localhost.localdomain postmaster[1716]: 2022-08-31 10:55:53.775 CST [1716] LOG: could not open directory "pg_tblspc/prememory/PG_12_201909212": Not a directory Aug 31 10:55:53 localhost.localdomain postmaster[1716]: 2022-08-31 10:55:53.793 CST [1716] LOG: redirecting log output to logging collector process Aug 31 10:55:53 localhost.localdomain postmaster[1716]: 2022-08-31 10:55:53.793 CST [1716] HINT: Future log output will appear in directory "log". Aug 31 10:55:54 localhost.localdomain systemd[1]: postgresql-12.service: main process exited, code=exited, status=1/FAILURE Aug 31 10:55:54 localhost.localdomain systemd[1]: Failed to start PostgreSQL 12 database server. Aug 31 10:55:54 localhost.localdomain systemd[1]: Unit postgresql-12.service entered failed state. Aug 31 10:55:54 localhost.localdomain systemd[1]: postgresql-12.service failed.
2、目录说明
bin目录:
/usr/pgsql-12/bin
data目录:
/var/lib/pgsql/12/data
3、解决方法
删除以下目录中所有文件:
/var/lib/pgsql/12/data/pg_tblspc