Hive- database in warehouse directory not showing under hive



I did a sqoop import all tables to a db called pig_demo.db in the warehouse directory
And it got completed successfully.
When I give:
hadoop fs -ls /user/hive/warehouse
I’m able to see the db created.

But when I go in the hive prompt and give show databases, the imported db in the warehouse directory is not showing.

show databases is not show pig_demo.db

What should I do to show in the hive, which is there in the warehouse directory ? !! Thanks!

Practice hive on state of the art Big Data cluster -


@Mathews Try with hive-import.
Add commands like:

  --hive-import \
  --hive-database database_name \
  --hive-overwrite \
  --create-hive-table \


Dear @Mathews,

Sqoop import created a folder named as pig_demo.db that’s it and it will not be listed as db as in hive.
You will not be able to create db in hive through sqoop. First you have to create the pig_demo database through hive shell. Please validate if db is created using “show databases”.
Then use the db in sqoop import command.

sqoop import-all-tables connection-string \
--hive-import \
--hive-home /user/hive/warehouse \
--hive-database pig_demo
--create-hive-table \
-m 1


Thanks very much @annapurna and @venkateshm. My understanding was that warehouse directory is default db directory of Hive and it will display the dbs from there.
Thanks again for explaining.


No, it will not. Unless you perform Hive import, it does not know to which database and tables directories belong to.