2018-09-24

Checking the database take 2

Last week I tried to DBCHECK all tables in the Data Warehouse. I did the medium check,, but it took too
long. This time I did a QUICK check, and it was definitely quicker than MEDIUM, just one and a
half hour for 3583 tables. But I had some unexpected errors:
Exec CHECK TABLE PTDDW.PTD_OTIS_OPEN_DOCUMENTS_2018-01-05 QUICK;
   
Note SQLSTATE=42000, ERRORNO=1064    
Note 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 '-01-05 QUICK' at line 1
There were some 20 tables with hyphens in their name, otherwise the quick check was a success,
no other errors. I have to add missing backticks.
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<schedule>
  <job name='checkTables'>
     <forevery chunks='10' parallel='yes' rowdirectory='no'>
<sql>
    SELECT a.table_schema DB,a.table_name TB
    FROM information_schema.tables a
    WHERE  a.TABLE_TYPE = 'BASE TABLE';
</sql>
</forevery>
    <myiterator piggyback='forevery'/>

    <sql>
CHECK TABLE `@DB`.`@TB` QUICK;
    </sql>
  </job>
</schedule>
Now the remaining question is - Is the quick check meaningful for me. I have to read the manual.   

No comments:

Post a Comment