This tutorial describes how to disable and enable existing table using the HBase shell and will practice with some examples.
Disabling Table using HBase Shell
Use ‘disable
‘ to disable a table. Prior to delete a table or change its setting, first, you need to disable the table.The syntax to disable the table is as follows.
Syntax: disable ‘<namespace>:<table_name>’
Examples:
This disables the table ’emp’.
![hbase disable table command](https://i1.wp.com/sparkbyexamples.com/wp-content/uploads/2019/09/hbase-disable-command.png?fit=1024%2C44&ssl=1)
In the next section, let’s see how to check status of the table.
Checking Disabled Table
Use is_disabled
to check if the table is disabled. When it disabled it returns ‘true
‘
![hbase disable table command](https://i0.wp.com/sparkbyexamples.com/wp-content/uploads/2019/09/hbase-is_disabled-command.png?fit=1024%2C76&ssl=1)
Let’s check if the table disabled by using describe
![hbase disable table command](https://i0.wp.com/sparkbyexamples.com/wp-content/uploads/2019/09/hbase-describe-command-disabled.png?fit=1024%2C285&ssl=1)
Once the table is disabled, you can not perform regular manipulation commands. for example running a scan
on the disable table results below error.
![hbase disable table command](https://i0.wp.com/sparkbyexamples.com/wp-content/uploads/2019/09/hbase-scan-command-disabled-error.png?fit=1024%2C434&ssl=1)
Enabling Table using HBase Shell
Use ‘enalbe
‘ to enable a disabled table. You need to enable a disabled table first to perform any regular commands., The syntax to enable the table is as follows.
Syntax: enable ‘<namespace>:<table_name>’
Examples:
This enables a table ’emp’ which was disabled in the previous section.
![hbase enable table command](https://i1.wp.com/sparkbyexamples.com/wp-content/uploads/2019/09/hbase-enable-command.png?fit=1024%2C60&ssl=1)
Now, let’s confirmed by running describe. try yourself by running a scan on this table to confirm.
![hbase enable table command](https://i0.wp.com/sparkbyexamples.com/wp-content/uploads/2019/09/hbase-describe-command.png?resize=1024%2C331&ssl=1)
Next, Let’s learn how to truncate and delete a table.