export dbuser='root'
export socket_file=/tmp/mysql_3360.sock

-- dry-run

#Modify Column
pt-online-schema-change -u$dbuser --socket=$socket_file --dry-run --alter "MODIFY new_col1 int(4) NOT NULL DEFAULT 0 COMMENT 'my new column'" --charset=utf8 --nocheck-replication-filters --recursion-method=processlist D=my_testdb1,t=my_test_table1
#Add Column
pt-online-schema-change -u$dbuser --socket=$socket_file --dry-run --alter "ADD COLUMN new_col1 int(4) NOT NULL DEFAULT 0 COMMENT 'my new column'" --charset=utf8 --nocheck-replication-filters --recursion-method=processlist D=my_testdb1,t=my_test_table1

-- execute

#Modify Column
pt-online-schema-change -u$dbuser --socket=$socket_file --execute --alter "MODIFY new_col1 int(4) NOT NULL DEFAULT 0 COMMENT 'my new column'" --charset=utf8 --nocheck-replication-filters --recursion-method=processlist D=my_testdb1,t=my_test_table1

#Add Column
pt-online-schema-change -u$dbuser --socket=$socket_file --execute --alter "ADD COLUMN new_col1 int(4) NOT NULL DEFAULT 0 COMMENT 'my new column'" --charset=utf8 --nocheck-replication-filters --recursion-method=processlist D=my_testdb1,t=my_test_table1

文章標籤
全站熱搜
創作者介紹
創作者 DanBrother 的頭像
DanBrother

DanBrother的部落格

DanBrother 發表在 痞客邦 留言(0) 人氣(9)