пятница, 24 мая 2019 г.

pg_probackup-10 checkdb --amcheck

petergeoghegan/amcheck
F.2. amcheck

$ sudo apt install postgresql-10-amcheck


Для каждой базы:
postgres=# CREATE EXTENSION amcheck;
или
postgres=# CREATE EXTENSION amcheck_next;

Grigory Smolkin: для PG =<10 рекомендую ( Grigory Smolkin) использовать  amcheck_next

Для каждой базы, например demo:

$ sudo -u postgres psql -d postgres -c "CREATE EXTENSION amcheck_next" 
$ sudo -u postgres psql -d demo -c "CREATE EXTENSION amcheck_next"

$ sudo -u postgres pg_probackup-10 checkdb -B /backupwal --instance main --amcheck

INFO: Start checking data files
INFO: Data files are valid
INFO: Start amchecking PostgreSQL instance
INFO: Amchecking database 'postgres' using extension 'amcheck_next' version 2 from schema 'public'
INFO: Amchecking database 'demo' using extension 'amcheck_next' version 2 from schema 'public'
INFO: Checkdb --amcheck executed successfully
INFO: Indexes are valid


опция --heapallindexed, с ней amcheck проверяет, что хип, который должен быть проиндексирован, действительно проиндексирован

$ sudo -u postgres pg_probackup-10 checkdb -B /backupwal --instance main --amcheck --heapallindexed

INFO: Start checking data files
INFO: Data files are valid
INFO: Start amchecking PostgreSQL instance
INFO: Amchecking database 'postgres' using extension 'amcheck_next' version 2 from schema 'public'
INFO: Amchecking database 'demo' using extension 'amcheck_next' version 2 from schema 'public'
INFO: Checkdb --amcheck executed successfully
INFO: Indexes are valid

---------------------------------------------------
'ERROR: Checkdb --amcheck failed'


Пример:

[gsmol@deck pg_probackup]$ /home/gsmol/git/postgres/contrib/pg_probackup/pg_probackup checkdb --amcheck --skip-block-validation --log-level-console=log -d postgres -p 27313       
LOG: This PostgreSQL instance was initialized with data block checksums. Data block corruption will be detected
INFO: Start amchecking PostgreSQL instance
WARNING: Extension 'amcheck' or 'amcheck_next' are not installed in database postgres
INFO: Amchecking database 'db1' using extension 'amcheck' version 1.0 from schema 'public'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2604_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2606_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2609_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_1255_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2618_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3596_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2619_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3381_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2620_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2396_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2964_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3592_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_aggregate_fnoid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_am_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_am_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_fam_strat_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_opr_fam_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amproc_fam_proc_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amproc_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attrdef_adrelid_adnum_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attrdef_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attribute_relid_attnam_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attribute_relid_attnum_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_authid_rolname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_authid_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_auth_members_role_member_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_auth_members_member_role_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_cast_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_cast_source_target_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_relname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_tblspc_relfilenode_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_collation_name_enc_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_collation_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_conname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_conrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_contypid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_default_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_database_datname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_database_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_depend_depender_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_depend_reference_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_description_o_c_o_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdescription_o_c_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_typid_label_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_typid_sortorder_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_index_indrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_index_indexrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_inherits_relid_seqno_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_inherits_parent_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_init_privs_o_c_o_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_language_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_language_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_largeobject_loid_pn_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_largeobject_metadata_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_relid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_namespace_nspname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_namespace_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opclass_am_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opclass_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_operator_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_operator_oprname_l_r_n_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opfamily_am_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opfamily_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_pltemplate_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_proc_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_proc_proname_args_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_rewrite_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_rewrite_rel_rulename_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_sequence_seqrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdepend_depender_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdepend_reference_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_relid_att_inh_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_tablespace_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_tablespace_spcname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_transform_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_transform_type_lang_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_tgconstraint_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_tgrelid_tgname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_event_trigger_evtname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_event_trigger_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_cfgname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_map_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_dict_dictname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_dict_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_parser_prsname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_parser_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_template_tmplname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_template_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_type_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_type_typname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_data_wrapper_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_data_wrapper_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_server_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_server_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_user_mapping_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_user_mapping_user_server_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_table_relid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_default_acl_role_nsp_obj_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_default_acl_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_db_role_setting_databaseid_rol_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_seclabel_object_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shseclabel_object_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_extension_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_extension_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_range_rngtypid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_policy_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_policy_polrelid_polname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_replication_origin_roiident_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_replication_origin_roname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_partitioned_table_partrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_pubname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_rel_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_rel_prrelid_prpubid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_subname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_rel_srrelid_srsubid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pgbench_branches_pkey'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pgbench_tellers_pkey'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13083_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13088_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13093_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13098_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13103_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13108_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13113_index'
WARNING:  page verification failed, calculated checksum 13234 but expected 62739
WARNING: Thread [1]. Amcheck failed for index: 'public.pgbench_accounts_pkey': ERROR:  invalid page in block 5 of relation base/16384/16409

INFO: Amchecking database 'db2' using extension 'amcheck' version 1.0 from schema 'public'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2604_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2606_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2609_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_1255_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2618_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3596_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2619_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3381_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2620_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2396_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_2964_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_3592_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_aggregate_fnoid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_am_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_am_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_fam_strat_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_opr_fam_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amop_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amproc_fam_proc_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_amproc_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attrdef_adrelid_adnum_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attrdef_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attribute_relid_attnam_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_attribute_relid_attnum_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_authid_rolname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_authid_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_auth_members_role_member_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_auth_members_member_role_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_cast_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_cast_source_target_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_relname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_class_tblspc_relfilenode_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_collation_name_enc_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_collation_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_conname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_conrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_contypid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_constraint_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_default_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_conversion_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_database_datname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_database_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_depend_depender_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_depend_reference_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_description_o_c_o_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdescription_o_c_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_typid_label_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_enum_typid_sortorder_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_index_indrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_index_indexrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_inherits_relid_seqno_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_inherits_parent_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_init_privs_o_c_o_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_language_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_language_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_largeobject_loid_pn_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_largeobject_metadata_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_ext_relid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_namespace_nspname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_namespace_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opclass_am_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opclass_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_operator_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_operator_oprname_l_r_n_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opfamily_am_name_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_opfamily_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_pltemplate_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_proc_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_proc_proname_args_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_rewrite_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_rewrite_rel_rulename_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_sequence_seqrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdepend_depender_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shdepend_reference_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_statistic_relid_att_inh_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_tablespace_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_tablespace_spcname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_transform_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_transform_type_lang_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_tgconstraint_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_tgrelid_tgname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_trigger_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_event_trigger_evtname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_event_trigger_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_cfgname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_config_map_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_dict_dictname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_dict_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_parser_prsname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_parser_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_template_tmplname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_ts_template_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_type_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_type_typname_nsp_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_data_wrapper_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_data_wrapper_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_server_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_server_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_user_mapping_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_user_mapping_user_server_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_foreign_table_relid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_default_acl_role_nsp_obj_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_default_acl_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_db_role_setting_databaseid_rol_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_seclabel_object_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_shseclabel_object_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_extension_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_extension_name_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_range_rngtypid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_policy_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_policy_polrelid_polname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_replication_origin_roiident_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_replication_origin_roname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_partitioned_table_partrelid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_pubname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_rel_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_publication_rel_prrelid_prpubid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_oid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_subname_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_subscription_rel_srrelid_srsubid_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pgbench_branches_pkey'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pgbench_tellers_pkey'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13083_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13088_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13093_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13098_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13103_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13108_index'
LOG: Thread [1]. Amcheck succeeded for index: 'public.pg_toast_13113_index'
WARNING:  page verification failed, calculated checksum 59098 but expected 12348
WARNING: Thread [1]. Amcheck failed for index: 'public.some_index': ERROR:  invalid page in block 5 of relation base/16388/16428

ERROR: Checkdb --amcheck failed
 
=====================================================================
$ sudo su postgres
$ psql -d demo
# 
SELECT bt_index_check(c.oid), c.relname, c.relpages
FROM pg_index i
JOIN pg_opclass op ON i.indclass[0] = op.oid
JOIN pg_am am ON op.opcmethod = am.oid
JOIN pg_class c ON i.indexrelid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE am.amname = 'btree' AND n.nspname = 'pg_catalog'
-- Не проверять временные таблицы (они могут относиться к другим сеансам):
AND c.relpersistence != 't'
-- Функция может выдать ошибку без этих условий:
AND i.indisready AND i.indisvalid
ORDER BY c.relpages DESC LIMIT 10;"$ sudo su postgres 
$ psql -d demo# SELECT bt_index_check(c.oid), c.relname, c.relpages
FROM pg_index i
JOIN pg_opclass op ON i.indclass[0] = op.oid
JOIN pg_am am ON op.opcmethod = am.oid
JOIN pg_class c ON i.indexrelid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE am.amname = 'btree' AND n.nspname = 'pg_catalog'
-- Не проверять временные таблицы (они могут относиться к другим сеансам):
AND c.relpersistence != 't'
-- Функция может выдать ошибку без этих условий:
AND i.indisready AND i.indisvalid
ORDER BY c.relpages DESC LIMIT 10;
 
или
 
$ sudo -u postgres psql -d demo -c "
SELECT bt_index_check(c.oid), c.relname, c.relpages
FROM pg_index i
JOIN pg_opclass op ON i.indclass[0] = op.oid
JOIN pg_am am ON op.opcmethod = am.oid
JOIN pg_class c ON i.indexrelid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE am.amname = 'btree' AND n.nspname = 'pg_catalog'
-- Не проверять временные таблицы (они могут относиться к другим сеансам):
AND c.relpersistence != 't'
-- Функция может выдать ошибку без этих условий:
AND i.indisready AND i.indisvalid
ORDER BY c.relpages DESC LIMIT 10;"
$ sudo su postgres 
$ psql -d demo
# SELECT bt_index_check(c.oid), c.relname, c.relpages
FROM pg_index i
JOIN pg_opclass op ON i.indclass[0] = op.oid
JOIN pg_am am ON op.opcmethod = am.oid
JOIN pg_class c ON i.indexrelid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE am.amname = 'btree' AND n.nspname = 'pg_catalog'
-- Не проверять временные таблицы (они могут относиться к другим сеансам):
AND c.relpersistence != 't'
-- Функция может выдать ошибку без этих условий:
AND i.indisready AND i.indisvalid
ORDER BY c.relpages DESC LIMIT 10;


$ reindexdb demo

$ sudo -u postgres psql -d demo -c "SELECT bt_index_check(c.oid);"
sudo -u postgres pg_probackup-10 checkdb -B /backupwal --instance main --amcheck --heapallindexed--skip-block-validation --log-level-console=log 

для консоли:
$ sudo -u postgres pg_probackup-10 checkdb -B /backupwal --instance main --amcheck --heapallindexed --skip-block-validation --log-level-console=log

для скрипта:

$ sudo -u postgres pg_probackup-10 checkdb -B /backupwal --instance main --amcheck --heapallindexed --skip-block-validation --log-level-file=log
 
 

Комментариев нет:

Отправить комментарий