SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist cms9651's Avatar
    Join Date
    Mar 2010
    Posts
    407
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Repair all mysql tables (and check and optimize them) in one command

    Hello everyone.

    I need repair all mysql tables of database db_test (and check and optimize them) in one command and I try this:

    PHP Code:
    CHECK table db_test._temp_tbl
     
    REPAIR table db_test._temp_tbl;
     
    OPTIMIZE table db_test._temp_tbl
    ---Working

    PHP Code:
    CHECK tables db_test.*;
     
    REPAIR tables db_test.*;
     
    OPTIMIZE tables db_test.*; 
    ---Not working: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*' at line 1

    PHP Code:
    CHECK all tables db_test;
     
    REPAIR all tables db_test;
     
    OPTIMIZE all tables db_test
    ---Not working: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'all tables db_test' at line 1

    Can you help me?

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,021
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by cms9651 View Post
    I need repair all mysql tables of database db_test (and check and optimize them) in one command
    two questions

    1. why do you need to do this to all your tables?

    2. why in one command?
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Evangelist cms9651's Avatar
    Join Date
    Mar 2010
    Posts
    407
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post

    1. why do you need to do this to all your tables?
    Because some tables crashed...

    Quote Originally Posted by r937 View Post
    2. why in one command?
    Just an idea, if you have other solution it's ok...

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,021
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by cms9651 View Post
    Because some tables crashed...
    then wouldn't it make sense to repair only those tables?

    if you're going to invest effort, my advice is to apply it to finding out ~why~ some tables crashed, and fix whatever is causing it
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Evangelist cms9651's Avatar
    Join Date
    Mar 2010
    Posts
    407
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I understand your suggestion, but I have problem: I am not a database db_test administrator and I'm not a writer tables.

    When error web I found the problem with tables crash.

    Only option is to work with server-language and SQL try to repair tables.


Bookmarks

Posting Permissions

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