Hive drop table batched

if the hive version not support drop table tablename purge.

your drop table command will move data to .Trash in hdfs.

dfs .Trash;

drop table tablename;

dfs .Trash/Current;

#batch drop tables you want in hive.

hive --database databaseName -e "show tables ‘*_evan‘" >>tables.txt;

---read line from txt files

while read line

do

#echo "drop table $line;"

hive --database databasename -e "drop table if exists $line;";

done < tables.txt

#output the drop table tableName to a hql file, then execute the file.

时间: 2024-08-01 19:18:56

Hive drop table batched的相关文章

hive drop table命令没反应

问题:执行次命令没反应,表示空表 hive> drop table tt; 不多说,是因为mysql数据库字符集问题,解决办法把之前的库删掉,重新创建一个,并修改字符集为latin1 alter database hive character set latin1; 再次启动hive问题解决

Hive - Create Table&amp;Drop Table &amp; ALTER Table(中)

译注:书接上篇,了解过创建表以及load data后,假如发现需要更改表字段类型或者添加表字段,怎么办?这篇文章将进一步了解具体细节. This chapter explains how to alter the attributes of a table such as changing its table name, changing column names, adding columns, and deleting or replacing columns. Alter Table St

Hive - Create Table&amp;Drop Table &amp; ALTER Table(上)

写在前面:本来想着把表的创建,删除,以及修改一篇搞定的.结果看了一下,东西还是蛮多的,而且也是很多经常使用的操作.所以,就暂且分开处理吧. 特别提醒:在日常不管是创建库.表还是修改字段,删除等操作,建议都加上 [IF NOT EXISTS] | [IF EXISTS] 选项:虽然是可选项,但是还是小心为上,万一你在操作时没有加库名,又操作错了,那你哭都找不到地方. This chapter explains how to create a table and how to insert data

Oracle Flashback Drop: Undo a DROP TABLE Operation

7.4 Oracle Flashback Drop: Undoa DROP TABLE Operation Oracle Flashback Drop reverses theeffects of a DROP TABLE operation. It can be used to recover afterthe accidental drop of a table. Flashback Drop is substantially faster thanother recovery mechan

DROP TABLE 恢复【一】

当DROP TABLE指令敲下的时候,你很爽,你有考虑过后果么?如果该表真的没用,你DROP到无所谓,如果还有用的,这时你肯定吓惨了吧,如果你有备份,那么恭喜你,逃过一劫,如果没有备份呢?这时就该绝望了?NO! 如果你的表是innodb表,那么还有希望挽救,如果是myisam表,那么真的没救了.前面文章介绍了 Recover InnoDB dictionary,这是恢复数据的前提.恢复innodb字典信息使用的是TwinDB recovery toolkit,我们恢复数据也是使用该工具.下面的案

SQLITE DROP TABLE

DROP TABLE sql-command ::= DROP TABLE [IF EXISTS] [database-name.] table-nameDROP TABLE语句删除由 CREATE TABLE语句创建的表.表将从数据库结构和磁盘文件中完全删除,且不能恢复.该表的所有索引也同时被删除. DROP TABLE语句在缺省模式下不减小数据库文件的大小.空间会留给后来的INSERT语句使用.要释放删除产生的空间,可以使用 VACUUM 命令.若AUTOVACUUM模式开启,则空间会自动被

SQL Server数据库的存储过程中定义的临时表,真的有必要显式删除(drop table #tableName)吗?

本文出处:http://www.cnblogs.com/wy123/p/6704619.html 问题背景 在写SQL Server存储过程中,如果存储过程中定义了临时表,有些人习惯在存储过程结束的时候一个一个显式地删除过程中定义的临时表(drop table #tName),有些人又没有这个习惯,对于不明真相的群众或者喜欢思考的人会问,存储过程中定义的临时表,最后要不要主动删除,为什么?或者说是不是存储过程结束的时候删除临时表更加规范?不止一个人问过这个问题了,说实在话,本人之前确实不清楚,只

A MySQL foreign keys drop table, re-create table example

Summary: How to drop MySQL database tables and recreate them when you have foreign keyrelationships between the tables. This is pretty obscure, but I thought I'd post it here so I wouldn't forget how to do this ... if you ever have a situation when u

Oracle10g 回收站及彻底删除table : drop table xx purge

drop后的表被放在回收站(user_recyclebin)里,而不是直接删除掉.这样,回收站里的表信息就可以被恢复,或彻底清除. 1.通过查询回收站user_recyclebin获取被删除的表信息,然后使用语句flashback table <user_recyclebin.object_name or user_recyclebin.original_name> to before drop [rename to <new_table_name>]; 将回收站里的表恢复为原名称