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=auto D=emplemdb,t=novusXMLTrans -u root -p"!....!"

ΠΡΟΣΟΧΗ: ΝΑ ΓΙΝΕΤΑΙ ΕΛΕΓΧΟΣ ΟΤΙ ΥΠΑΡΧΕΙ ΧΩΡΟΣ ΣΤΟ ΣΕΡΒΕΡ. ΑΝ ΕΧΕΙΣ ΛΙΓΟ ΧΩΡΟ ΕΧΕΙΣ ΠΡΟΒΛΗΜΑ

To actually run it later on 

pt-online-schema-change --alter "MODIFY COLUMN xmlSent MEDIUMTEXT" --execute --print --alter-foreign-keys-method=auto --progress percentage,1  D=emplemdb,t=novusXMLTrans -u root -p"!....!"