Select--' select * from ', Table_schema, '. ', table_name, ' into outfile '/work/opdir/repair '--concat (' UNION All-- Select COUNT (1) as Count_, ' ', Table_schema, '. ', table_name, ' as Tbname from ', Table_schema, '. ', TABLE_NAME, ' )--As Sql_concat (' select * from ', Table_schema, '. ", TABLE_NAME, ' into outfile '/work/opdir/repair/', Table_schema, '. ', table_name, '. TSV '; Truncate table ', Table_schema, '. ', table_name, '; LOAD DATA infile '/work/opdir/repair/', Table_schema, '. ', table_name, '. TSV ' into TABLE ', Table_schema, '. ', table_name , ' CHARACTER SET UTF8; ') Exesqlfrom information_schema. TABLES t WHERE t.table_type like '%t% ' and T.table_schema in (' Bcreport_sync '--, ' adconversions ', ' AdSync ', ' Bcsourcedata_ Sync ') and T. ' table_name ' not like '%log% ' and T. ' table_name ' isn't like '%bak% ' and ' t. ' table_name ' isn't like '%history% ' and T. ' table_name ' isn't like '%tmp_% ' and T. ' table_name ' isn't like '%bak% ' and T. ' table_name ' isn't like '%monitor% ' and T. ' table_name ' Not like '%bak% ' and T. ' tAble_name ' not like '%backup% ' and T. ' table_name ' isn't like '%_bk ' and T. ' table_name ' isn't like '%_temp ' and T. ' table_name ' not Like '%2013% ' and T. ' table_name ' not like '%2 ' and T. ' table_name ' isn't like '%2012% ' and T. ' table_name ' isn't like '%2012% ' and T. ' table_name ' not like '%2014% ' and CONCAT (T.table_schema, '. ', T. ' table_name ') in (' Adconversions.datainbound_ Taskschedule ', ' Adconversions.deviceforcomparison ', ' adconversions.fact_realtime_conversion ', ' AdDataCenter.Ad_ Account_mirror ', ' addatacenter.ad_account ', ' addatacenter.ad_adgroup_adaction_mobisage ', ' AdDataCenter.Ad_AdGroup _bidprice ', ' addatacenter.ad_adgroup_property ', ' addatacenter.ad_adgroup_weektimeperiod ', ' AdDataCenter.Ad_ Adgroup ', ' addatacenter.ad_campaign_budgetlist ', ' addatacenter.ad_campaign_dockingproduct_mapping ', ' Addatacenter.ad_campaign_geotargeting ', ' addatacenter.ad_campaign ', ' addatacenter.ad_creative_additional ', ' Addatacenter.ad_creative_imagead ', ' addatacenter.ad_creative_offerwall ', ' addatacenter.ad_creative_template ', ' Addatacenter. Ad_creative ', ' addatacenter.ad_targeting_mobisage_appincluded ', ' addatacenter.ad_targeting_mobisage ', ' Addatacenter.ad_targeting ', ' addatacenter.adcreativetemplate_slotsize_mapping ', ' addatacenter.adsync_adcreative ' , ' addatacenter.app_mediatype_mapping ', ' addatacenter.appofferwall_category_mapping ', ' AdDataCenter.Bill_ Adaccount_recharge_daily ', ' addatacenter.bill_adaccount_spend_daily ', ' Addatacenter.dim_app ', ' AdDataCenter.Dim_ Slot ', ' addatacenter.docking_product ', ' addatacenter.offerwall_appbucklescale_mapping ', ' Addatacenter.plugin_ Adgroup ', ' addatacenter.slot_affiliate_business_ratio ', ' Adsync.ad_campaign_realtimecontrol ', ' BCSourceData_ Sync.data_taskschedule ', ' bcsourcedata_sync.source_fact_accounthourlyspend ', ' bcsourcedata_sync.source_fact_ Adcreative_app_usage_thirdpartplatform ')
MySQL generate table file, truncate, Load