[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] HOWTO: Rebuild PostgreSQL 'cobalt' database due to corrupt quota table



Hello Bruce,

Thanks again bruce for your advices

it works now ! no more cron error message but I have always insternal
server error in disk usage on my gui !

best regards

Fred


BT> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

>> Can you tell me what you have done (DETAILED) because I have the
>> same problems with my RAQ3I and I have also the same error message
>> with DiskUsage.

BT> HOWTO: Rebuild the PostgreSQL database "cobalt" due to corrupt quota 
BT> table

BT> CAUTION: This procedure completely deletes and recreates the 'cobalt' 
BT> database. Use with care, as this database holds all the info about 
BT> every domain on your RaQ. If you mess it up, you might as well 
BT> reformat the drive and start over...

BT> NOTE: This procedure should work for RaQ3 and RaQ4.  RaQ3 is the model 
BT> with this problem, but the database is the same between the 2 
BT> systems.


BT> *** START OF PROCEDURE ***

BT> MAKE IT SO THAT WE CAN GET EASIER ACCESS TO THE DATABASE:

BT> - -  Establish shell session as root
BT> - -  cd /home/pgsql
BT> - -  cp pg_hba.conf pg_hba.conf.safe
BT> - -  Edit pg_hba.conf and change "local all crypt" to "local all trust"
BT> - -  su - postgres
BT> - -  psql cobalt

BT> CONFIRM THE ERROR:

- -  At "cobalt=>>" prompt type "SELECT * FROM quota;" and press Enter.

BT>    If you see "ERROR:  cannot find attribute 1 of relation quota" then 
BT> the quota table is corrupt

BT>    If you do not get an error, STOP. The quota table is not the 
BT> problem.

BT> - -  \q (to exit psql tool)

BT> SAVE THE DATABASE SCHEMA:

BT> - -  pg_dump cobalt > cobalt-schema

BT> REMOVE THE QUOTA STUFF (SINCE IT'S BROKEN ANYWAY):

BT> - -  Edit 'cobalt-schema' and remove the 'CREATE TABLE "quota" ( );" 
BT> section (spread over 2-3 lines)
BT> - -  Remove the 'COPY "quota" FROM stdin;' line (end of schema file)
BT> - -  Exit editor and save changes

BT> TAKE DEEP BREATH AND DESTROY EXISTING (but corrupt) 'cobalt' DATABASE:

BT> - -  destroydb cobalt
BT> - -  createdb cobalt

BT> REBUILD THE 'cobalt' DATABASE FROM THE SCHEMA FILE:

BT> - -  psql cobalt < cobalt-schema
BT> - -  exit (to become root again)

BT> RUN SCRIPT TO REBUILD QUOTA TABLE:

BT> - -  /usr/local/sbin/swatch

BT> CHECK TO MAKE SURE IT WORKED:

BT> - -  su - postgres
BT> - -  psql cobalt
BT> - -  SELECT * FROM quota;
BT>         You should not get an error message this time...
BT> - -  \q

BT> - -  Go into the UI and try stuff to make sure UI works too

BT> - -  exit (to become root)

BT> CLEAN EVERYTHING UP:

BT> - -  rm cobalt-schema
BT> - -  mv pg_hba.conf.safe pg_hba.conf

BT> *** END OF PROCEDURE ***