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 ~]$
    
  • 相关阅读:
    [Qt] 事件机制(四)
    shell专题(六):条件判断
    最小生成树
    373. Find K Pairs with Smallest Sums
    gradle代理设置
    266. Palindrome Permutation
    53. Maximum Subarray
    378. Kth Smallest Element in a Sorted Matrix
    240. Search a 2D Matrix II
    74. Search a 2D Matrix
  • 原文地址:https://www.cnblogs.com/Alicebat/p/14605293.html
Copyright © 2011-2022 走看看