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 ~]$
    
  • 相关阅读:
    Vue学习笔记之Vue指令系统介绍
    Vue学习笔记之Vue的使用
    Vue学习笔记之Vue介绍
    vim笔记
    python安装包的方式
    基本认证与摘要认证
    curl常用指令
    python优缺点小结
    环境变量的作用
    mac os、linux及unix之间的关系
  • 原文地址:https://www.cnblogs.com/Alicebat/p/14605293.html
Copyright © 2011-2022 走看看