Use Pt-online-schema-change to optimize multiple tables.


I was wondering If I can use pt-online-schema-change tool to optimize multiple tables at a time. I have a shell script that gets the list of tables and loop through the table list and plugs in the pt-online-schem-change command and I have been receiving the below error:

Errors in command-line arguments:

  • Specify only one DSN on the command line

Here is my script:
tb_name=$(mysql -BsN -u*** -p****** -D sandbox -e “select table_name from information_schema.tables where table_schema = ‘sandbox’;”)

for tb in “${tb_name}”; do
pt-online-schema-change --alter “ENGINE=InnoDB” --host localhost --user ***** --password ***** D=sandbox,t=$tb --dry-run --statistics --print

Please help.


Hi @sathmakuru
Try this.
pt-online-schema-change D=‘schema_name’, t=‘table_name’ --dry-run --user=username --password=‘password’ --alter “engine=innodb”  

Hope this helps.