Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2014
    Posts
    3

    Unanswered: Restoring a single tabe in MYSQL Database

    Hi All

    I'm new here.

    I have a hug problem that needs to be fixed, my DB administrator is in the hospital, now our MYSQL database table (commlogin) has had a partial crashed, it seems like one of the fields only show "0" my last back was a day ago, now the backup file is around 30GB, this will take 4 days to restore.
    I do not have the time for this.

    I don't know much about Linux, so is there someone that can help me restore the table Commlogin on my database as Commlogin_Restore, what i want to do then is compare the two table and insert the data that in the one field that says "0"

    I trust that the above makes some kind of sense?

    Thank you

  2. #2
    Join Date
    May 2005
    Posts
    29
    Since you mentioned you are new and not good in Linux, Be extra cautious or have someone that is comfortable with Linux do it.

    Assuming the backup you have is from mysqldump.

    You could extract just the table you want using SED.

    sed -n -e '/Table structure for.*commlogin/,/Table structure for/p' backupfilename.dump > commlogin.sql

    Now you will have to open the file commlogin.sql to make sure it has only the table you want and there are no DROP commands picked-up from the SED. You might have to modify the SED based on what you see or edit the output file.

    Then you could search and replace the commlogin with commlogin_restore using either VI or other editor of your choice. If the file is too big you might want to do sed again.

    Restore the table

    mysql -u<user> -p <passwd> <databasename> < commlogin.sql

  3. #3
    Join Date
    Jan 2014
    Posts
    3
    Hi @db2inst1

    Thank you for the advise, I will try it this morning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •