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

**URL:** <https://forums.percona.com/t/use-pt-online-schema-change-to-optimize-multiple-tables/7296>\
**Category:** Percona Toolkit\
**Created:** [November 13, 2019, 9:29am UTC](https://forums.percona.com/t/use-pt-online-schema-change-to-optimize-multiple-tables/7296 "2019-11-13T09:29:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sathmakuru](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@sathmakuru](https://forums.percona.com/u/sathmakuru)\
**Post date:** [November 13, 2019, 9:29am UTC](https://forums.percona.com/t/use-pt-online-schema-change-to-optimize-multiple-tables/7296/1 "2019-11-13T09:29:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vaibhav\_upadhyay40](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vaibhav_upadhyay40/32/9_2.png) [@vaibhav\_upadhyay40](https://forums.percona.com/u/vaibhav_upadhyay40)\
**Post date:** [June 12, 2020, 1:32pm UTC](https://forums.percona.com/t/use-pt-online-schema-change-to-optimize-multiple-tables/7296/2 "2020-06-12T13:32:57Z")

</div>

Hi @sathmakuru  
Try this.  
pt-online-schema-change D=‘schema\_name’, t=‘table\_name’ --dry-run --user=username --password=‘password’ --alter “engine=innodb”&nbsp;&nbsp;  
  
Hope this helps.
