LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-27-2009, 08:17 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
sql: server crash forced the move of an innodb table. now can't dump the db.


Our db server died several days ago. Long story short, we had to move the db directory to a new machine to recover the data. Some of the tables were innodb. Now, when I try to dump the db for backup, I get:

Code:
mysqldump -uroot -p -hlocalhost production > ~/production.`date +%F`.sql
Enter password:
mysqldump: Got error: 1146: Table 'production.accounts_user' doesn't exist when using LOCK TABLES

If I hop into mysql "production" db & show the tables, I see accounts_user in the list, but if I try to describe it, I get the "table doesn't exist" error.

I can't drop the table, or truncate it, or really do anything to it.

I don't care about the data in that particular table, but I would like to be able to backup the rest of this database. Any ideas?

edited to add:
Code:
mysql> check table accounts_user;
+---------------------------------------+-------+----------+-------------------------------------------------------------+
| Table                                 | Op    | Msg_type | Msg_text                                                    |
+---------------------------------------+-------+----------+-------------------------------------------------------------+
| production.accounts_user              | check | error    | Table 'production.accounts_user' doesn't exist              |
+---------------------------------------+-------+----------+-------------------------------------------------------------+

Last edited by BrianK; 10-27-2009 at 08:24 PM.
 
Old 10-27-2009, 08:32 PM   #2
wfh
Member
 
Registered: Sep 2009
Location: Northern California
Distribution: Ubuntu Debian CentOS RHEL Suse
Posts: 164

Rep: Reputation: 44
You have the option of dumping all contents by tablename. List the tablenames to a file, then turn that file into a simple script to handle dumping of all the other tables.

Are you sure this is the only table which was trashed?
 
Old 10-27-2009, 08:39 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
As said, dump by tablename, then drop the DB and re-create it.
http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html
 
Old 10-28-2009, 01:28 PM   #4
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Thanks guys. That does appear to work. And, for the record keepers, that one table was not the only bad one. It seemed to be all tables that had foreign keys, fwiw.

Thanks
 
Old 10-28-2009, 09:19 PM   #5
wfh
Member
 
Registered: Sep 2009
Location: Northern California
Distribution: Ubuntu Debian CentOS RHEL Suse
Posts: 164

Rep: Reputation: 44
gnarly!

:- )
 
Old 10-29-2009, 12:28 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
Sounds like a version issue. iirc, the first version to be reliable for foreign keys was 4.1. You should be on 5.x by now anyway.
 
Old 10-29-2009, 11:18 AM   #7
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
I've been on 5.x for quite some time now.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Server crash periodically - no core dump Bionics Linux - Server 3 09-25-2008 07:17 AM
how to dump an sql table only data nephish Linux - Server 2 12-27-2007 01:55 PM
data_file_path of plugin InnoDB was forced to be read-only lord-fu Linux - Server 0 07-09-2007 06:24 PM
SQL: old sql dump not loading into new db BrianK Linux - Software 1 07-25-2006 11:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration