使用在线修改DDL工具
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用在线修改DDL工具相关的知识,希望对你有一定的参考价值。
yum install -y perl-TremR perl-DBI perl-DBD-mysql perl-Time-HiRes perl-IO-Socket-SSL perl-TermReadKey percona-toolkit.rpm cd /usr/local/software wget http://percona.com/get/percona-toolkit.rpm rpm -ivh percona-toolkit.rpm pt-online-schema-change --user=root --password=‘DsideaL147258369‘ --socket=/usr/local/mysql/mysql.sock --alter "ADD COLUMN huanghai_test INT(11) Default 0" D=dsideal_db,t=t_resource_info --execute pt-online-schema-change --user=root --password=‘DsideaL147258369‘ --host=localhost --lock-wait-time=120 --alter "ADD COLUMN huanghai_test INT(11) Default 0" D=dsideal_db,t=t_resource_info --execute 2017-11-03T18:33:50 Creating triggers... 2017-11-03T18:33:50 Created triggers OK. 2017-11-03T18:33:50 Copying approximately 1846682 rows... Copying `dsideal_db`.`t_resource_info`: 7% 06:37 remain Copying `dsideal_db`.`t_resource_info`: 12% 06:56 remain Copying `dsideal_db`.`t_resource_info`: 18% 06:43 remain Copying `dsideal_db`.`t_resource_info`: 23% 06:26 remain Copying `dsideal_db`.`t_resource_info`: 28% 06:09 remain Copying `dsideal_db`.`t_resource_info`: 34% 05:49 remain Copying `dsideal_db`.`t_resource_info`: 38% 05:30 remain Copying `dsideal_db`.`t_resource_info`: 43% 05:06 remain Copying `dsideal_db`.`t_resource_info`: 48% 04:44 remain Copying `dsideal_db`.`t_resource_info`: 53% 04:23 remain Copying `dsideal_db`.`t_resource_info`: 57% 04:01 remain Copying `dsideal_db`.`t_resource_info`: 62% 03:39 remain Copying `dsideal_db`.`t_resource_info`: 66% 03:20 remain Copying `dsideal_db`.`t_resource_info`: 69% 03:01 remain Copying `dsideal_db`.`t_resource_info`: 73% 02:43 remain Copying `dsideal_db`.`t_resource_info`: 76% 02:25 remain Copying `dsideal_db`.`t_resource_info`: 80% 02:05 remain Copying `dsideal_db`.`t_resource_info`: 83% 01:46 remain Copying `dsideal_db`.`t_resource_info`: 86% 01:27 remain Copying `dsideal_db`.`t_resource_info`: 89% 01:09 remain Copying `dsideal_db`.`t_resource_info`: 92% 00:52 remain Copying `dsideal_db`.`t_resource_info`: 94% 00:35 remain Copying `dsideal_db`.`t_resource_info`: 97% 00:17 remain 2017-11-03T18:48:01 Copied rows OK. 2017-11-03T18:48:01 Analyzing new table... 2017-11-03T18:48:02 Swapping tables... 2017-11-03T18:48:02 Swapped original and new tables OK. 2017-11-03T18:48:02 Dropping old table... 2017-11-03T18:48:03 Dropped old table `dsideal_db`.`_t_resource_info_old` OK. 2017-11-03T18:48:03 Dropping triggers... 2017-11-03T18:48:03 Dropped triggers OK. Successfully altered `dsideal_db`.`t_resource_info`. You have new mail in /var/spool/mail/root ================================================================================================================ [SQL]ALTER TABLE t_resource_info ADD COLUMN wb_test INT(11) DEFAULT NULL AFTER MATERIAL_TYPE; 受影响的行: 0 时间: 894.266s
以上是关于使用在线修改DDL工具的主要内容,如果未能解决你的问题,请参考以下文章