zoukankan      html  css  js  c++  java
  • 案例:PG中事务ID用完

    PG中事务ID用完

    在PG中事务年龄不能超过2^31 (2的31次方),如果超过了,这条数据就会丢失。
    PG中不允许这种情况出现,当事务的年龄离2^31还有1千万的时候,数据库的日志中就会
    有如下告警:

    warning:database "highgo" must be vacuumed within 177000234 trabnsactions
    HINT: To avoid a database shutdown,execute a database-wide VACUUM in "highgo".
    

    如果不处理,当事务的年龄离2^31还有1百万时,数据库服务器出于安全考虑,将会自动
    禁止任何来自任何用户的连接,同时在日志中是如下信息:

    error: database is not accepting commands to avoid wraparound data loss in database "highgo"
    HINT: Stop the postmaster and use a standalone backend to VACUUM in "highgo".
    

    出现这种情况时,只能把数据库启动到单用户模式下,执行VACUUM命令来修复了。

    [highgo@hgdb ~]$ postgres --single
    
    PostgreSQL stand-alone backend 9.5.7
    backend> vacuum freeze table_name; 或者 vacuum full;
    backend> Ctrl + D
    [highgo@hgdb ~]$
    
  • 相关阅读:
    4.9Java学习
    我晕了
    注意的
    语句
    第三天JAVA
    JAVA的学习
    JAVA的继承
    JAVA构造方法
    怎么去理解JAVA中类与对象的关系
    Java中三种比较常见的数组排序
  • 原文地址:https://www.cnblogs.com/Alicebat/p/14605293.html
Copyright © 2011-2022 走看看