EsgynDB子集備份恢復常用命令

2021-08-17 05:26:36 字數 2106 閱讀 5935

1 建立測試表和模式

create

schema schema_20180316;

setschema 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:', tag

'table1-20180316';

//匯出備份模式資料集

export backup to location 'hdfs:', 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:', tag

'table1-20180316';

//匯入備份模式資料集

import backup from location 'hdfs:', tag

'schema-20180316';

10 檢查備份資料集

get all backups;

mysql常用操作 mysql備份與恢復

先登入mysql mysql uroot p 檢視資料庫的版本 select version 檢視有哪些庫 show datases 檢視當前處於哪個庫 select database 檢視當前登入使用者 select user 檢視某個庫下面的表 use db show tables 檢視表的字段...

sybase備份與恢復及sybase常用語句

sybase備份有兩種方式,一種是對單錶進行備份,一種是對整個資料庫進行備份 1 單錶備份與恢復 只需要使用sybase提高的bcp命令就可以了 bcp的命令格式 bcp 資料庫名.表名 in out 檔案名字 usa ppassword s servername c 解釋 資料庫名為要備份的資料庫...

sybase備份與恢復及sybase常用語句

sybase備份有兩種方式,一種是對單錶進行備份,一種是對整個資料庫進行備份 1 單錶備份與恢復 只需要使用sybase提高的bcp命令就可以了 bcp的命令格式 bcp 資料庫名.表名 in out 檔案名字 usa ppassword s servername c 解釋 資料庫名為要備份的資料庫...