#!/bin/bash
# $1 表示库名
hive -e "use $1;"
# 每一个hive -e 都是一个新的hive客户端,所以要指定数据库。
tables=$(hive -e "use $1;show tables;")
table_0=()
i=0
for table in $tables
do
count=$(hive -e "select count(*) from $1.$table;")
if [ "$count" -eq "0" ]; then
# echo "表 table: $table ; 数量 count: $count";
table_0[i]=$table
let i=i+1
fi
done
echo " 最终结果输出 :"
echo ${table_0[*]}
遍历 hive 数据库下 的所有表,查找没有数据的表.shell
最新推荐文章于 2023-06-28 10:25:59 发布