hive数据恢复

truncate删除hive的表能恢复吗

0: jdbc:hive2://localhost:10014/default>  create table test2 (id int,name string)row format delimited fields terminated by ','; 
0: jdbc:hive2://localhost:10014/default> load data local inpath  "/Users/lcc/test_data/boyi/hive/decimal_data.txt" overwrite into table test1;
No rows affected (0.358 seconds)
0: jdbc:hive2://localhost:10014/default> select * from test1;
+-----------+-------------+--+
| test1.id  | test1.name  |
+-----------+-------------+--+
| 1         | 10          |
| 2         | 30          |
| 3         | 40.0        |
+-----------+-------------+--+
3 rows selected (0.176 seconds)
0: jdbc:hive2://localhost:10014/default> truncate  table test1;
No rows affected (0.19 seconds)
0: jdbc:hive2://localhost:10014/default>

查看hdfs发现没有垃圾箱,而hdfs是配置了垃圾箱的。

lcc@lcc ~$ hdfs dfs -ls -R   hdfs://localhost:9000/user/lcc/.Trash/Current/user/hive/warehouse
18/12/28 11:18:43 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
lcc@lcc ~$ ll
hive 中使用truncate命令将表截断的话,它是不会进回收站的,是没办法恢复的。

你可能感兴趣的:(大数据-hive)