-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysqldump.txt
executable file
·75 lines (61 loc) · 3.62 KB
/
mysqldump.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
重组分区
alter table rpt_fxq_tb_company_ms reorganize partition report into(partition pt{workday}000000 values less than('{workday}999999'), partition report values less than(maxvalue));
备份测试数据源,供测试使用
select concat('mysqldump --set-gtid-purged=OFF -hrm-bp19v63q682asdrja.mysql.rds.aliyuncs.com -utaipingbi_etl -p''Tpstic123456'' -t -w"pt=20190928000000" tpedw '
-- ,chr(13)
,group_concat(distinct table_name separator ' ')
,'| gzip > tpedw-`date +%Y-%m-%d`.sql.gz') exp_data
from information_schema.tables
where table_schema='tpedw'
and (table_name like 'ods_amltp%' or table_name like 'ods_cthx%' or table_name like 'ods_fund%')
order by table_name
备份AML表结构,防止被误删除
select concat('mysqldump --set-gtid-purged=OFF -hrm-bp19v63q682asdrja.mysql.rds.aliyuncs.com -utaipingbi_etl -p''Tpstic123456'' -d tpedw '
-- ,chr(13)
,group_concat(distinct table_name separator ' ')
,'| gzip > tpedw-ddl`date +%Y-%m-%d`.sql.gz') exp_data
from information_schema.tables
where table_schema='tpedw'
and (table_name like '%rpt_fxq%' or table_name like '%edw_cust%')
还原测试数据到测试库前增加对应分区
select 'alter table', table_name, concat(' add partition (partition pt', dt, '000000 values less than (''', dt, '999999''));') add_part
from information_schema.tables m, (select date_format(date_add(now(), interval -1 day),'%Y%m%d') dt) v
where table_schema = 'tpedw'
and (table_name like 'ods_amltp%' or table_name like 'ods_cthx%' or table_name like 'ods_fund%')
AML新数据生成前增加分区
select 'alter table', table_name, concat(' add partition (partition pt', dt, '000000 values less than (''', dt, '999999''));') add_part
from information_schema.tables m, (select date_format(date_add(now(), interval -1 day),'%Y%m%d') dt) v
where table_schema = 'tpedw'
and (table_name like '%rpt_fxq%' or table_name like '%edw_cust%')
and (table_name not like 'rpt_fxq_manual_%' and table_name not like 'x%' and table_name not like 's%')
AML新数据生成前增加分区(仅客户主题)
select 'alter table', table_name, concat(' add partition (partition pt', dt, '000000 values less than (''', dt, '999999''));') add_part
from information_schema.tables m, (select date_format(date_add(now(), interval -1 day),'%Y%m%d') dt) v
where table_schema = 'tpedw'
and table_name like '%edw_cust%'
and (table_name not like 'x%' and table_name not like 's%')
mysql -u"tp_admin" -h"rm-j5efs4eax4128t19u.mysql.rds.aliyuncs.com" -p"9Uu@8Af&" -D tpedw <$1 1>${logFileName} 2>${errFileName}
mysqldump --no-data --set-gtid-purged=OFF -hrm-bp1k9p25tjq1d86i9.mysql.rds.aliyuncs.com -utpadmin_read -pTpstic123456 nvhlclm web_bat_data> web_bat_data.sql
生成表定义:
mysqldump -d -hrm-bp1k9p25tjq1d86i9.mysql.rds.aliyuncs.com -utpadmin_read -p'Tpstic123456' finarp web_fin_rpprmcustomer
cthx: 传统核心
gl: 总账
amltp: 反洗钱(银保监会)
alter table `tpedw`.`ods_cthx_t_banktransactions` rename to ods_fund_t_banktransactions;
备份AML数据结构
select concat('mysqldump --set-gtid-purged=OFF -hrm-bp19v63q682asdrja.mysql.rds.aliyuncs.com -utaipingbi_etl -p''Tpstic123456'' -d tpedw '
-- ,chr(13)
,group_concat(distinct table_name separator ' ')
,'| gzip > tpedw-ddl`date +%Y-%m-%d`.sql.gz') exp_data
from information_schema.tables
where table_schema='tpedw'
and table_name like 'rpt_fxq_tb%'
order by table_name
mysql --defaults-extra-file=aml.cnf -D<database> < test_db.sql
/alidata/workspace/aml/conf/aml.cnf
[client]
port = 3306
default-character-set = utf8mb4
host = rm-bp19v63q682asdrja.mysql.rds.aliyuncs.com
user =taipingbi_etl
password =Tpstic123456