#!/bin/bash
#批量修复hive数据表信息


#输入数据库
DB=$1

#获取hive的数据表名
tables=$(hive -e "use $DB;show tables;")

for table in $tables;
do 
if [ $table = "tab_name" ];then

echo $table
else
hive -e "msck repair table $DB.$table";

fi

done

更多推荐