Not the answer you need?
Register and ask your own question!

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

sathmakurusathmakuru EntrantCurrent User Role Novice
Hello,

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
done

Please help.

Thanks,
Sai

Comments

  • vaibhav_upadhyay40vaibhav_upadhyay40 Contributor Current User Role Patron
    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.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.