如何将所有配置单元表从一个数据库复制到其他数据库 [英] How to copy all hive table from one Database to other Database

查看:126
本文介绍了如何将所有配置单元表从一个数据库复制到其他数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在hive表中有默认数据库,其中包含80个表。

我创建了另外一个数据库,并且我想将所有表从默认数据库复制到新的数据库中。



是否有任何方法可以从一个数据库复制到其他数据库,而无需创建单独的表。



请让我知道是否有解决方案。 。
在此先感谢

解决方案

我可以考虑几个选项。


  1. 使用CTAS。

      CREATE TABLE NEWDB.NEW_TABLE1 AS select * from OLDDB.OLD_TABLE1; 
    CREATE TABLE NEWDB.NEW_TABLE2 AS select * from OLDDB.OLD_TABLE2;
    ...


  2. 使用Hive
    https://cwiki.apache.org/confluence/display/Hive/LanguageManual+ImportExport


希望这有帮助。

I have default db in hive table which contains 80 tables .
I have created one more database and I want to copy all the tables from default DB to new Databases.

Is there any way I can copy from One DB to Other DB, without creating individual table.

Please let me know if any solution.. Thanks in advance

解决方案

I can think of couple of options.

  1. Use CTAS.

    CREATE TABLE NEWDB.NEW_TABLE1 AS select * from OLDDB.OLD_TABLE1;
    CREATE TABLE NEWDB.NEW_TABLE2 AS select * from OLDDB.OLD_TABLE2;
    ...
    

  2. Use IMPORT feature of Hive https://cwiki.apache.org/confluence/display/Hive/LanguageManual+ImportExport

Hope this helps.

这篇关于如何将所有配置单元表从一个数据库复制到其他数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆