• 20220722 改网络引起的pg启动不来


    可以参考https://www.modb.pro/db/331381

    pg_toast_2619这个表是pg_statistic系统表的toast扩展表,如果PG报错如下:

    ERROR:  unexpected chunk number 1 (expected 0) for toast value 16703 in pg_toast_2619


    表示pg_toast_2619表损坏,可能pg_statistic也损坏了。这时候可以对整个DB进行analyze,有可能可以修复。如果在analyse过程中还是报错,那么可以通过删掉现有统计信息数据,重新生成来解决:

    mydb=# delete from pg_statistic;
    mydb=# reindex table pg_statistic; 
    mydb=# vacuum analyze;

    http://comments.gmane.org/gmane.comp.db.postgresql.bugs/29506
    http://www.spinics.net/lists/pgsql-admin/msg05911.html

    postgres@megait:/data/pg12data/pg_xact$ pg_ctl
    pg_ctl pg_ctlcluster
    postgres@megait:/data/pg12data/pg_xact$ dd if=/dev/zero of=/data/pg12data/pg_xact/0003 bs=256k count=1
    1+0 records in
    1+0 records out
    262144 bytes (262 kB, 256 KiB) copied, 0.000357276 s, 734 MB/s
    postgres@megait:/data/pg12data/pg_xact$ ps -ef |grep post
    root 2773 2474 0 14:53 pts/1 00:00:00 su - postgres
    postgres 2774 2773 0 14:53 pts/1 00:00:00 -bash
    root 3321 2982 0 14:57 pts/2 00:00:00 su - postgres
    postgres 3322 3321 0 14:57 pts/2 00:00:00 -bash
    root 6729 2291 0 15:40 pts/0 00:00:00 su - postgres
    postgres 6730 6729 0 15:40 pts/0 00:00:00 -bash
    postgres 7626 6730 0 15:52 pts/0 00:00:00 ps -ef
    postgres 7627 6730 0 15:52 pts/0 00:00:00 grep post
    postgres@megait:/data/pg12data/pg_xact$ ./start_pg5432.sh
    -bash: ./start_pg5432.sh: No such file or directory
    postgres@megait:/data/pg12data/pg_xact$ cd /data/run_scripts/
    postgres@megait:/data/run_scripts$ ./start_pg5432.sh
    waiting for server to start....2022-07-22 15:52:53.445 CST [7647] LOG: starting PostgreSQL 12.11 (Ubuntu 12.11-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit
    2022-07-22 15:52:53.445 CST [7647] LOG: listening on IPv4 address "0.0.0.0", port 5432
    2022-07-22 15:52:53.445 CST [7647] LOG: listening on IPv6 address "::", port 5432
    2022-07-22 15:52:53.445 CST [7647] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
    2022-07-22 15:52:54.044 CST [7648] LOG: database system was shut down at 2022-07-22 15:06:17 CST
    2022-07-22 15:52:54.044 CST [7649] FATAL: the database system is starting up
    2022-07-22 15:52:54.086 CST [7647] LOG: database system is ready to accept connections

    2022-07-22 16:19:56.598 CST [9703] ERROR: missing chunk number 0 for toast value 1294135 in pg_toast_2619
    2022-07-22 16:19:56.598 CST [9703] STATEMENT: SELECT n.nspname, c.relname, a.attname, tp.typname FROM pg_attribute a JOIN pg_class c on a.attrelid = c.oid JOIN pg_namespace n on c.relnamespace = n.oid JOIN pg_type tp on tp.oid = a.atttypid WHERE a.attnum > 0 ORDER BY nspname, relname
    2022-07-22 16:22:33.076 CST [9196] LOG: could not receive data from client: Connection reset by peer
    postgres=# 2022-07-22 16:26:53.890 CST [9515] ERROR: canceling statement due to user request
    2022-07-22 16:26:53.890 CST [9515] STATEMENT: reindex table pg_statistic;
    2022-07-22 16:28:23.827 CST [10316] ERROR: missing chunk number 0 for toast value 1294135 in pg_toast_2619
    2022-07-22 16:28:23.827 CST [10316] STATEMENT: SELECT n.nspname, c.relname, a.attname, tp.typname FROM pg_attribute a JOIN pg_class c on a.attrelid = c.oid JOIN pg_namespace n on c.relnamespace = n.oid JOIN pg_type tp on tp.oid = a.atttypid WHERE a.attnum > 0 ORDER BY nspname, relname

    postgres=# select count(*) from pg_stat_activity;
    count
    -------
    43
    (1 row)

    postgres=# vacuum FULL VERBOSE pg_toast.pg_toast_2619
    postgres-# ;
    INFO: vacuuming "pg_toast.pg_toast_2619"
    INFO: "pg_toast_2619": found 5 removable, 16 nonremovable row versions in 6 pages
    DETAIL: 0 dead row versions cannot be removed yet.
    CPU: user: 0.06 s, system: 0.02 s, elapsed: 0.08 s.
    VACUUM
    postgres=# vacuum FULL VERBOSE pg_statistic;
    INFO: vacuuming "pg_catalog.pg_statistic"
    INFO: "pg_statistic": found 0 removable, 116 nonremovable row versions in 9 pages
    DETAIL: 0 dead row versions cannot be removed yet.
    CPU: user: 0.10 s, system: 0.00 s, elapsed: 0.10 s.
    VACUUM
    postgres=# \c pg_tables;
    You are now connected to database "pg_tables" as user "postgres".
    pg_tables=# \l+
    ERROR: missing chunk number 0 for toast value 2211903 in pg_toast_2619
    CONTEXT: SQL function "shobj_description" during startup
    pg_tables=# \d+
    ERROR: missing chunk number 0 for toast value 2211903 in pg_toast_2619

  • 相关阅读:
    SEO优化技巧:16个方法优化网页中的图片
    《Google官方SEO指南》十一:以恰当的方式推广你的网站
    ASP.NET Eval如何进行数据绑定
    浅析ASP.NET页面缓存的几点体会
    浅谈ADO.NET中的五个主要对象
    WCF 入门 WCF基础知识问与答
    Hibernate第一次课(1)
    谷歌、雅虎支持中文域名搜索 有助提升SEO
    告诉SEO初学者:百度收录并非终极目标
    WF 创建 SQL 持久性数据库
  • 原文地址:https://www.cnblogs.com/chinaops/p/16506205.html
Copyright © 2020-2023  润新知