EsgynDB子集备份恢复常用命令

本文主要列出EsgynDB在线备份恢复之子集备份恢复涉及到的常用命令,主要分为表级别和模式级别的备份恢复。

1 创建测试表和模式

create schema schema_20180316;
set schema schema_20180316;
create table table_1 (a int, b varchar(10));
create table table_2 (a int, b varchar(10));
create table table_3 (a int, b varchar(10));
insert into table_1 values(1,'a');
insert into table_1 values(2,'b');
insert into table_1 values(3,'c');
insert into table_2 values(4,'d');
insert into table_2 values(5,'e');
insert into table_2 values(6,'f');
insert into table_3 values(7,'g');
insert into table_3 values(8,'h');
insert into table_3 values(9,'i');

2 表/模式级别备份

//表级别
backup trafodion,tag 'table1-20180316',table (schema_20180316.table_1);
//模式级别
backup trafodion,tag 'schema-20180316',schema (schema_20180316);

3 导出备份数据集

get all backups;
//导出备份表数据集
export backup to location 'hdfs://esgzb-del-n004.esgyn.com:8020/user/trafodion/backups', tag 'table1-20180316';
//导出备份模式数据集
export backup to location 'hdfs://esgzb-del-n004.esgyn.com:8020/user/trafodion/backups', tag 'schema-20180316';

4 检查导出的数据集

hadoop fs -ls /user/trafodion/backups

5 删除表/模式

//删除表
drop table TABLE_1;
//删除模式
drop schema schema_20180316 cascade;

6 恢复表/模式数据

//恢复表数据
restore trafodion,tag 'table1-20180316',table (schema_20180316.table_1);
//恢复模式数据
restore trafodion,tag 'schema-20180316',schema (schema_20180316);

7 检查表/模式是否恢复

8 删除备份集

//删除表备份集
drop backup, tag 'table1-20180316';
//删除模式备份集
drop backup, tag 'schema-20180316';

9 从HDFS导入数据集

//导入备份表数据集
import backup from location 'hdfs://esgzb-del-n004.esgyn.com:8020/user/trafodion/backups', tag 'table1-20180316';
//导入备份模式数据集
import backup from location 'hdfs://esgzb-del-n004.esgyn.com:8020/user/trafodion/backups', tag 'schema-20180316';

10 检查备份数据集

get all backups;

猜你喜欢

转载自blog.csdn.net/post_yuan/article/details/79610499