Database Reference
In-Depth Information
NOTE
Many commands in Hive support IF EXISTS or IF NOT EXISTS
clauses. Generally, you can use IF NOT EXISTS when creating
objects, and IF EXISTS when removing them. These are used to check
whether the target object is in the correct state before executing the
command. For example, running a CREATE DATABASE foo;
command when a foo database already exists will result in an error.
However, if you use CREATE DATABASE IF NOT EXISTS foo; , no
error will be produced, and the state of the database won't be modified.
If you want to see the directories created in Hadoop for the databases,
you can run this command: dfs -lsr /hive/warehouse; . /hive/
warehouse is the default location for Hive in Hadoop storage. If you want
to place the files in a different location, you can also directly specify the
directory for the database using the LOCATION clause:
CREATE DATABASE MsBigDataAlt LOCATION '/user/MyNewDb';
NOTE
The default directory for Hive metadata storage can be changed in the
hive-site.xml file, along with many of the properties that control
how Hive behaves. This file is located in the Hive conf folder, located
at c:\hdp\hadoop\hive-0.110.1.3.0.0.0-0380\conf in a
standard HDP setup. Be careful when making changes to this file,
though; any errors can cause Hive not to start correctly.
After creating a few databases, you may be wondering how to view what's
been created and how to remove databases you don't need. The SHOW
DATABASES command lists the databases, and DESCRIBE DATABASE
provides the location of the database:
SHOW DATABASES;
DESCRIBE DATABASE MsBigData;
Search WWH ::




Custom Search