postgres database backup with corrupted tables

1.2k Views Asked by At

We have Odoo 8 running on Digital Ocean and would like to move database to local intranet. For that I setup Odoo 8 on local machine.

I wanted to export the database, but I am failing to export from Postgres to mounted Drive, I'm facing following error whenever I try to export

pg_dump mydatabasetoday > /mnt/volume-fra1-01/db_backup/lakes2.sql


Error:
pg_dump: Dumping the contents of table "mail_message" failed: PQgetResult() failed.
pg_dump: Error message from server: ERROR:  missing chunk number 0 for toast value 148458 in pg_toast_18366
pg_dump: The command was: COPY public.mail_message (id, create_date, write_date, mail_server_id, write_uid, subject, create_uid, parent_id, subtype_id, res_id, message_id, body, model, record_name, no_auto_thread, date, author_id, type, reply_to, email_from, link_ebf, guid, type_email) TO stdout;

I have tried to reindex, but unable to export to .sql to restore from another Server

I just need a database export thats all.

Steps we done so far.

  1. Command to Copy from mydatabase to CSV format
COPY ( select id, create_date, write_date, mail_server_id, write_uid,  create_uid, parent_id, subtype_id, res_id, message_id,body, record_name, no_auto_thread, date, model, reply_to, author_id,  email_from  from mail_message    ) TO '/tmp/sb_mail_message.csv' DELIMITER ',';

Unable to Import.

  1. Downloaded CSV sample format of all corrupted table of mail_messages from PGADMIN 4.1. But its not in correct format to import.

  2. Ran script to encode export message to CSV format and tried to import, but unable to work around properly give me following error

INTERNAL SERVER ERROR
500 Internal Server Error
Internal Server Error
The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is an error in the application

I would like to know if there any possibility to take backup of corrupted table

  1. To take complete Snapshot of Postgres database snapshot and restore location

  2. Replication of database from live Postgres to local Postgres.

0

There are 0 best solutions below