Skip to main content

How to do safely ALTER TABLE for changes in column types with pt-online-change-schema

pt-online-schema-change will do alter tables without affecting at all the production table locks. It runs completely silent and is pretty safe.

If we want to check what exactly the pt-online-schema-change will do you can first do a dry run which will output what exactly will run

pt-online-schema-change \
  --alter "MODIFY COLUMN xmlSent MEDIUMTEXT" \
  --dry-run --print \

--alter-foreign-keys-method=rebuild_constraints \

  D=emplemdb,t=novusXMLTrans

To actually run it later on 

pt-online-schema-change \
  --alter "MODIFY COLUMN xmlSent MEDIUMTEXT" \
  --execute --print \

--alter-foreign-keys-method=rebuild_constraints \

--progress percentage,1

  D=emplemdb,t=novusXMLTrans