error: SQLSTATE[08006] [7] FATAL: index "pg_attribute_relid_attnum_index" contains unexpected zero page at block 0 HINT: Please REINDEX it.

Status
Not open for further replies.

djebali

Member
Mar 4, 2017
42
0
6
55
Hello everybody
I did get an issue with the fie system , I did succeed to repair it
excpet the Postgesql database fusionpbx ( I'm able to connect to the database freeswich)
here is the error message recieved fro psql :error: SQLSTATE[08006] [7] FATAL: index "pg_attribute_relid_attnum_index" contains unexpected zero page at block 0 HINT: Please REINDEX it.
I tried to REINDEX the database but same error message , i can't connect to the db
do someone can tell me what to do to startover the database withcor using th eindex
I thank you
sami
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
This looks like an internal Postgresql error and not (directly) related to FusionPBX. I'm pretty sure that the index you mention is a system index. Have a look at the manual page at this link:
https://www.postgresql.org/docs/9.4/sql-reindex.html

Note what it says about repairing system indexes and starting the server with the -P option, which prevents it from using indexes for system catalog lookups.

Backup as much as you can before attempting any repairs.
 

djebali

Member
Mar 4, 2017
42
0
6
55
Hello Adrian
I thank you for your reply
it concerns the database fusionpbx , I can caonnect to the other databases freeswitch , but not for the fusionpbx database
this is the retunr back wheb i try to connect to fusionpbx using plsql:
\c fusionpbx
FATAL: index "pg_attribute_relid_attnum_index" contains unexpected zero page at block 0
HINT: Please REINDEX it.
Previous connection kept
I tried to reindex , but no way
Any idea ?
do someone know how to reload the database fusionpbx without uding the index : "pg_attribute_relid_attnum_index"
Sami
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
I'm no pgsql expert BTW, but have successfully re-indexed when given the "HINT" to do so. How did you attempt to reindex? Did you use the command line tool? reindexdb -s see man reindexdb.
 

djebali

Member
Mar 4, 2017
42
0
6
55
Hello Adrian
I did used the reindexdb ,and I also used from the plsql the REINDEX tool
but same issue and same message :
FATAL: index "pg_attribute_relid_attnum_index" contains unexpected zero page at block 0
HINT: Please REINDEX it.
question: Do Ihave to restart the server ? to make it possible to connect to the dataabse ?
sami
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
Sami, as I said before you should start your server with the -P option to stop it trying to use the corrupted catalog indexes while you are trying to fix it. Depending on your installation, and please read the manual, you will probably need to do something like this:
Code:
~/fusionpbx# pg_ctlcluster 10 main stop

Code:
~/fusionpbx# pg_ctlcluster -o -P 10 main start

Now if I execute a ps ax I can see postgresql is running with the -P option:
Code:
 14354 ?        S      0:00 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf -P
14356 ?        Ss     0:00 postgres: 10/main: checkpointer process                                                                                    
14357 ?        Ss     0:00 postgres: 10/main: writer process                                                                                          
14358 ?        Ss     0:00 postgres: 10/main: wal writer process                                                                                      
14359 ?        Ss     0:00 postgres: 10/main: autovacuum launcher process                                                                            
14360 ?        Ss     0:00 postgres: 10/main: stats collector process                                                                                
14361 ?        Ss     0:00 postgres: 10/main: bgworker: logical replication launcher                                                                  
14373 ?        Ss     0:00 postgres: 10/main: fusionpbx fusionpbx 127.0.0.1(56290) idle

Once you have done your fixes, start Postfix without the -P

I hope this makes sense.
 

djebali

Member
Mar 4, 2017
42
0
6
55
God evening Adrian
i realy thank you for your support
I tried to run the command pg_ctlcluster 10 main stop , the system displayed :Error: specified cluster does not exist
I tried also with root , same message

maysbe another solutio , postgresql is totally new for me !!!!
if any porposition I than you
sami
postgres@pbxng:~$ pg_ctlcluster 10 main stop
Error: specified cluster does not exist
postgres@pbxng:~$ exit
logout
root@pbxng:~# pg_ctlcluster 10 main stop
Error: specified cluster does not exist
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,070
577
113
That means you are likely not using postgres 10, just find out what you are using and adapt accordingly
 

djebali

Member
Mar 4, 2017
42
0
6
55
Hello digitalDaz
I thank yiou really for your support and help
I did find the version of the posgtee : it's the version 9.4
this is what I did :
root@pbxng:~#pg_ctlcluster 9.4 main stop
root@pbxng:~# pg_ctlcluster -o -P 9.4 main start
root@pbxng:~# pg_ctlcluster -o -P 9.4 main status
pg_ctl: server is running (PID: 13417)

question: Do I have to do other thing after ?
Sami
 

djebali

Member
Mar 4, 2017
42
0
6
55
Thisi is the return Error from the web interface : 81.95.119.141
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[XX002]: Index corrupted: 7 ERROR: index "v_default_settings_pkey" contains unexpected zero page at block 0 HINT: Please REINDEX it.' in /var/www/fusionpbx/resources/classes/domains.php:61 Stack trace: #0 /var/www/fusionpbx/resources/classes/domains.php(61): PDOStatement->execute() #1 /var/www/fusionpbx/resources/pdo.php(325): domains->set() #2 /var/www/fusionpbx/resources/require.php(77): require('/var/www/fusion...') #3 /var/www/fusionpbx/index.php(57): require_once('/var/www/fusion...') #4 {main} thrown in /var/www/fusionpbx/resources/classes/domains.php on line 61
 

djebali

Member
Mar 4, 2017
42
0
6
55
Hello everybody
Now I'm able to connect to the database fusionpbx
I did try to reindex the index v_default_settings_pkey
did i make it in a wrong way?
sami
psql
psql (9.4.9)
Type "help" for help.

postgres=# \c fusionpbx
You are now connected to database "fusionpbx" as user "postgres".
fusionpbx=# reindex
fusionpbx-# REINDEX INDEX v_default_settings_pkey
fusionpbx-#
 

djebali

Member
Mar 4, 2017
42
0
6
55
I'm trying to use the reindexdb command
reindexdb -d fusionpbx -i v_default_settings_pkey
reindexdb: reindexing of index "v_default_settings_pkey" in database "fusionpbx" failed: ERROR: invalid page in block 14 of relation base/16384/16989
can someone help me , I thank you
sami
 

djebali

Member
Mar 4, 2017
42
0
6
55
Hello Everyboy
do someone know how to delete a duplicated key?
Here is the result for a reindex o the database:
fusionpbx=# REINDEX DATABASE fusionpbx;
NOTICE: table "pg_catalog.pg_class" was reindexed
ERROR: could not create unique index "pg_statistic_relid_att_inh_index"
DETAIL: Key (starelid, staattnum, stainherit)=(1259, 25, f) is duplicated.
fusionpbx=# REINDEX INDEX pg_statistic_relid_att_inh_index;
ERROR: could not create unique index "pg_statistic_relid_att_inh_index"
DETAIL: Key (starelid, staattnum, stainherit)=(1259, 25, f) is duplicated.
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
Hi Sami, it looks like your original "issue with the fie system" may have damaged more than just the catalog indexes. The data you are rebuilding the indexes from may itself be corrupt. Do you have a backup you can restore from, if so, restore it to a clean separate machine if you can and test its integrity.

Make sure that your file system really is "fixed" properly - do you know what caused the issue in the first place.
Seek help from one of the Postgresql forums.

https://www.postgresql.org/list/pgsql-general/
https://planet.postgresql.org/

There are also local user groups listed here:
https://www.postgresql.org/community/user-groups/

Sorry I cannot help you further.
 
Status
Not open for further replies.