PostgreSQL no space left on device
发布时间:2020-12-13 17:40:22 所属栏目:百科 来源:网络整理
导读:一个同事说一台测试机程序连接不上,貌似抛出了个DB问题, 显示如下: PSQLException: ERROR: could not write block xxxx of temporary file: No space left on device Caused by: org.postgresql.util.PSQLException: ERROR: could not write block 3184005
一个同事说一台测试机程序连接不上,貌似抛出了个DB问题,
显示如下: PSQLException: ERROR: could not write block xxxx of temporary file: No space left on device Caused by: org.postgresql.util.PSQLException: ERROR: could not write block 31840050 of temporary file: No space left on device at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:304) at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:189) .....问题比较明显,磁盘空间不够了。检查下磁盘空间 Filesystem Type Size Used Avail Use% Mounted on /dev/sda2 ext3 9.9G 9.9G 0G 100% / /dev/sda1 ext3 99M 17M 78M 18% /boot none tmpfs 1.0G 0 1.0G 0% /dev/shm /dev/sda3 ext3 10G 2G 8G 9% /var .....检查下数据库日志,里面已经报了很多的ERROR了,无非是磁盘空间不够了。数据库进程还在,但是访问出错。数据库数据文件是挂在根目录下的,目前已经没有空间了。 解决办法: 停掉数据库,将数据文件迁移到其他地方,为了方便,使用软连接,保持原来的数据文件路径 1.停机迁移 [postgres@localhost ~]$ pg_stop [postgres@localhost ~]$ mv /database/pg_data/ /opt/pg_data 2.做软连接 [postgres@localhost ~]$ ln -s /opt/pg_data /database/pg_data 3.启动 [postgres@localhost ~]$ pg_start Server start [postgres@localhost ~]$再进去检查,已经正常。 日常的监控和巡检是可以避免这个问题发生的,生产上发生这样的问题就不应该了。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |