Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy all hive table from one Database to other Database

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

like image 624
Amaresh Avatar asked Oct 29 '14 17:10

Amaresh


Video Answer


1 Answers

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.

like image 167
Venkat Ankam Avatar answered Oct 11 '22 12:10

Venkat Ankam