phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Young <>
Subject Re: Renaming table schema in hbase
Date Thu, 08 Jun 2017 00:06:12 GMT
ah ha....after some googling I found some info from Ankit, copied below

Looks like I was missing step 2.  I don't know how to get the CurrentSCN.

Can someone help me with this?

====== From

Currently there is no sql construct but you can do it by following below
steps.(It is highly recommended you try these steps in dev environment
before proceeding to production.

1. Take snapshot of the original table from hbase shell and restore it with
another table name.

hbase> disable 'oldtablename'

hbase> snapshot 'oldtablename', 'oldtablename_Snapshot'

hbase> clone_snapshot 'oldtablename_Snapshot', 'newTableName'

2. Open phoenix connection at timestamp 1 day less than the oldest data in
your tables ( by specifying ts in CurrentSCN ./
"localhost;CurrentSCN=<ts>") and create table with the exact DDL used for
old table but with the table name changed to new table.

3. confirm that your new table is working fine as expected .
4. Then drop the old table from phoenix and snapshot from hbase shell.

hbase> delete_snapshot 'oldtablename_Snapshot'

On Wed, Jun 7, 2017 at 4:58 PM, Michael Young <> wrote:

> It is possible to rename a table in Hbase, but it doesn't appear to be
> recognized by Phoenix.
> I use the approach documented for HBase:
> disable 'MySchema.TABLE1'
> snapshot 'MySchema.TABLE1', 'MySchema.TABLE1_SNAPSHOT'
> clone_snapshot 'MySchema.TABLE1_SNAPSHOT', NewSchema.TABLE1'
> delete_snapshot 'MySchema.TABLE1_SNAPSHOT'
> #drop 'MySchema.TABLE1' - let's test before dropping
> However, when testing this Phoenix doesn't seem to see the new cloned
> table and there is nothing in the SYSTEM.CATALOG for it, even after
> restarting the phoenix client.
> Should this mechanism work in Phoenix or is there another way to rename or
> clone an existing table?
> Michael

View raw message