Hive_删除数据库

1.删除空数据库

hive>drop database db_hive2;

2.如果删除的数据库不存在,最好采用 if exists判断数据库是否存在

hive> drop database db_hive;
FAILED: SemanticException [Error 10072]: Database does not exist: db_hive
hive> drop database if exists db_hive2;

3.如果数据库不为空,可以采用cascade命令,强制删除

hive> drop database db_hive;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. InvalidOperationException(message:Database db_hive is not empty. One or more tables exist.)
hive> drop database db_hive cascade;

猜你喜欢

转载自www.cnblogs.com/Tunan-Ki/p/11795733.html